aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorSelene ToyKeeper2021-11-13 05:06:17 -0700
committerSelene ToyKeeper2021-11-13 05:06:17 -0700
commit56fed712d41b0f5f19e91d84c802a3a6079e771c (patch)
tree23cef40543fea2e085d01d01f5a16d3cf3a9a8a4 /bin
parentreduced SP10 firefly/moon power usage slightly, by keeping CPU underclocked m... (diff)
downloadanduril-56fed712d41b0f5f19e91d84c802a3a6079e771c.tar.gz
anduril-56fed712d41b0f5f19e91d84c802a3a6079e771c.tar.bz2
anduril-56fed712d41b0f5f19e91d84c802a3a6079e771c.zip
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.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/level_calc.py8
1 files changed, 7 insertions, 1 deletions
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
If you find this content useful please consider a small donation via bitcoin: bitcoin:1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2?amount=0.001&message=Donation Scraping git contents via cgit is very resource intensive. The continued hosting of these git repositories is entirely financed by your bitcoin contributions. For donations of a least 1 mBTC you include your IP address in the message of your bitcoin donation. This will remove this message in the future for requests from your IP, which will significantly reduce token usage. In any case, any contributions to bitcoin address 1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2 are very welcome. Thanks in advance for you contribution to a self-sustaining ecosystem.