diff options
| author | Gabriel Hart | 2022-04-11 09:29:31 -0500 |
|---|---|---|
| committer | Gabriel Hart | 2022-04-11 09:29:31 -0500 |
| commit | 4d558992d4cc6434ec3ee94d535cd4b61a92a128 (patch) | |
| tree | 8ffc3723da4657518aa340dca5fdd7ef7fc8ad28 /bin/level_calc.py | |
| parent | Tweak a few MT35Mini settings (diff) | |
| parent | revert spurious change to version.h (diff) | |
| download | anduril-4d558992d4cc6434ec3ee94d535cd4b61a92a128.tar.gz anduril-4d558992d4cc6434ec3ee94d535cd4b61a92a128.tar.bz2 anduril-4d558992d4cc6434ec3ee94d535cd4b61a92a128.zip | |
Merge from TK's main A2 branch thru Rev 647 which includes several patches for the Sofirn SP10 Pro after TK merge that branch in
Diffstat (limited to 'bin/level_calc.py')
| -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 |
