From 56fed712d41b0f5f19e91d84c802a3a6079e771c Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Sat, 13 Nov 2021 05:06:17 -0700 Subject: increased SP10 PWM speed as much as possible without making ramp bumpy, and made party strobe pulses much faster Reduced max PWM TOP to 3072, because 2048 wasn't enough and 4096 was more than necessary. Also, Ch1 lumens / 256 / ch2 lumens = 6, so 256 * 6 * 2 is the lowest value which allows ch1 to start at half of ch2's power. I tried 1536 initially, but it made the ramp visibly malformed at the channel boundary. However, 3072 seems about right. Implemented a non-linear PWM_TOP ramp-down in level_calc, to allow it to converge faster and reduce the number of levels with visible pulses. Added an option to keep the regulator chips on between strobe pulses, by keeping the LEDs at moon instead of turning completely off. This allows the SP10 party strobe to use much shorter, more consistent pulses. --- bin/level_calc.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/level_calc.py b/bin/level_calc.py index 2998b44..60416db 100755 --- a/bin/level_calc.py +++ b/bin/level_calc.py @@ -65,10 +65,16 @@ def main(args): dpwm_steps = int(parts[1]) dpwn_max = int(parts[2]) dpwn_min = int(parts[3]) + dpwm_shape = 'linear' + if parts[4]: + dpwm_shape = float(parts[4]) max_pwms = [dpwn_min] * answers.num_levels for i in range(dpwm_steps): span = dpwn_max - dpwn_min - x = dpwn_min + (span * (float(dpwm_steps - i) / dpwm_steps)) + if dpwm_shape == 'linear': + x = dpwn_min + (span * (float(dpwm_steps - i) / dpwm_steps)) + else: # variable curve + x = dpwn_min + (span * ((float(dpwm_steps - i) / dpwm_steps) ** dpwm_shape)) max_pwms[i] = int(x) max_pwm = dpwn_min -- cgit v1.2.3