diff options
| author | Selene ToyKeeper | 2022-04-09 02:46:15 -0600 |
|---|---|---|
| committer | Selene ToyKeeper | 2022-04-09 02:46:15 -0600 |
| commit | 3a0f2bb9fa050bf9a0e8dd38cf32d316e1b18f56 (patch) | |
| tree | 0bfc60c84622b2b23593a76e6dae2d94ad8078be /bin | |
| parent | k9.3 tint-toggle build is broken, generate a better fail error (until it's fi... (diff) | |
| parent | merged anduril2 branch for upstream changes (diff) | |
| download | anduril-3a0f2bb9fa050bf9a0e8dd38cf32d316e1b18f56.tar.gz anduril-3a0f2bb9fa050bf9a0e8dd38cf32d316e1b18f56.tar.bz2 anduril-3a0f2bb9fa050bf9a0e8dd38cf32d316e1b18f56.zip | |
merged sofirn sp10-pro branch (should have done it months ago, but forgot)
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/level_calc.py | 8 |
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 |
