Skip to content

Commit

Permalink
ec signal lamp: allow turning off the signal lamp
Browse files Browse the repository at this point in the history
fix calculation of average power on the signal lamp

should fix
#46
and
https://bugs.kde.org/show_bug.cgi?id=455968
  • Loading branch information
zoltanp committed Jun 26, 2022
1 parent 99a80fb commit 680651e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/electronics/components/ecsignallamp.cpp
Expand Up @@ -60,7 +60,7 @@ void ECSignalLamp::stepNonLogic()
if (advanceSinceUpdate == 0) {
advanceSinceUpdate = 1; // do not try to divide by 0
}
avgPower = fabs(avgPower * advanceSinceUpdate + (voltage * voltage / RESISTANCE)) / advanceSinceUpdate;
avgPower = fabs(avgPower * 0.99 + (voltage * voltage / RESISTANCE) * 0.01);
++advanceSinceUpdate;
}

Expand Down

0 comments on commit 680651e

Please sign in to comment.