aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSelene ToyKeeper2021-08-16 05:02:55 -0600
committerSelene ToyKeeper2021-08-16 05:02:55 -0600
commita3b9b7df2ad634f9351a2e4e2fa2ee72d01cf17b (patch)
tree00b21bfcc58dba56750cae488193702425593ab0
parentmade dynamic PWM phase-correct; replaced brute-force phase reset to avoid fli... (diff)
downloadanduril-a3b9b7df2ad634f9351a2e4e2fa2ee72d01cf17b.tar.gz
anduril-a3b9b7df2ad634f9351a2e4e2fa2ee72d01cf17b.tar.bz2
anduril-a3b9b7df2ad634f9351a2e4e2fa2ee72d01cf17b.zip
fixed spurious warnings in level_calc on multi-channel lights
(also fixed reported values being too low by a factor of channel.pwm_min)
Diffstat (limited to '')
-rwxr-xr-xbin/level_calc.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/bin/level_calc.py b/bin/level_calc.py
index 9d72d45..2998b44 100755
--- a/bin/level_calc.py
+++ b/bin/level_calc.py
@@ -202,10 +202,12 @@ def multi_pwm(answers, channels):
pwms = []
for c, channel in enumerate(channels):
top = channel.modes[i] - channel.pwm_min
+ if top < 0: top = 0
bot = max_pwms[i] - channel.pwm_min
ratio = 100 * (int(round(top)) / float(bot))
+ top, bot = channel.modes[i], max_pwms[i]
pwms.append('%.2f/%i (%.3f%%)' % (top, bot, ratio))
- if ratio < prev_ratios[c]:
+ if (ratio < prev_ratios[c]) and (ratio > 0):
pwms.append('WARN')
prev_ratios[c] = ratio
print('%i: visually %.2f (%.2f lm): %s' %