mirror of
https://github.com/ivabus/speakersafetyd
synced 2024-11-10 02:15:16 +03:00
cargo fmt
Signed-off-by: Hector Martin <marcan@marcan.st>
This commit is contained in:
parent
c3307388aa
commit
d42f4817e0
11
src/types.rs
11
src/types.rs
|
@ -368,10 +368,10 @@ impl Speaker {
|
||||||
* data.
|
* data.
|
||||||
*/
|
*/
|
||||||
if pwr_avg < -0.01 {
|
if pwr_avg < -0.01 {
|
||||||
panic!(
|
panic!(
|
||||||
"{}: Negative power, bad ivsense data? ({})",
|
"{}: Negative power, bad ivsense data? ({})",
|
||||||
self.name, pwr_avg
|
self.name, pwr_avg
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
let pwr_avg = pwr_avg.max(0.0);
|
let pwr_avg = pwr_avg.max(0.0);
|
||||||
|
|
||||||
|
@ -386,8 +386,7 @@ impl Speaker {
|
||||||
|
|
||||||
let temp = s.t_coil_hyst.max(s.t_magnet_hyst);
|
let temp = s.t_coil_hyst.max(s.t_magnet_hyst);
|
||||||
|
|
||||||
let reduction =
|
let reduction = (temp - (self.t_limit - self.g.t_window)) / self.g.t_window;
|
||||||
(temp - (self.t_limit - self.g.t_window)) / self.g.t_window;
|
|
||||||
let gain = s.min_gain * reduction.max(0.);
|
let gain = s.min_gain * reduction.max(0.);
|
||||||
|
|
||||||
s.gain = gain;
|
s.gain = gain;
|
||||||
|
|
Loading…
Reference in a new issue