types: Display rounded-to-0 gain

So the display goes directly to 0.00 instead of flickering -0.00.

Signed-off-by: Hector Martin <marcan@marcan.st>
This commit is contained in:
Hector Martin 2023-10-29 00:35:07 +09:00
parent ac120b7be1
commit 7a82648d59

View file

@ -388,15 +388,15 @@ impl Speaker {
s.gain = gain;
debug!(
"{}: Coil {:.2} °C Magnet {:.2} °C Power {:.2} W Gain {:.2} dB",
self.name, s.t_coil, s.t_magnet, pwr_avg, gain
);
if s.gain > -0.01 {
s.gain = 0.;
}
debug!(
"{}: Coil {:.2} °C Magnet {:.2} °C Power {:.2} W Gain {:.2} dB",
self.name, s.t_coil, s.t_magnet, pwr_avg, s.gain
);
s.gain
}