aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/level_calc.py8
-rw-r--r--spaghetti-monster/anduril/cfg-sofirn-sp10-pro.h9
-rw-r--r--spaghetti-monster/anduril/strobe-modes.c2
-rw-r--r--spaghetti-monster/anduril/strobe-modes.h7
4 files changed, 20 insertions, 6 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
diff --git a/spaghetti-monster/anduril/cfg-sofirn-sp10-pro.h b/spaghetti-monster/anduril/cfg-sofirn-sp10-pro.h
index 293c84d..5507440 100644
--- a/spaghetti-monster/anduril/cfg-sofirn-sp10-pro.h
+++ b/spaghetti-monster/anduril/cfg-sofirn-sp10-pro.h
@@ -8,13 +8,13 @@
#define USE_DYNAMIC_UNDERCLOCKING
// 1....15: level_calc.py 3.01 1 15 7135 1 0.1 2 --pwm dyn:15:64:64
-// 16..150: level_calc.py 5.01 1 135 7135 1 2 800 --pwm dyn:49:4096:255
+// 16..150: level_calc.py 5.01 1 135 7135 1 2 800 --pwm dyn:49:3072:255:3.0
#define RAMP_LENGTH 150
#define USE_DYN_PWM
#define _PWM1_LEVELS_ 1,2,4,6,9,12,15,19,23,28,34,41,48,55,64
#define _PWM1_TOPS_ 64,64,64,64,64,64,64,64,64,64,64,64,64,64,64
-#define _PWM2_LEVELS_ 1,1,2,3,4,5,6,7,8,9,11,12,13,14,15,16,17,19,20,21,22,23,24,25,26,27,28,29,30,31,31,32,32,33,33,33,33,33,33,32,31,30,29,28,26,24,22,19,17,14,15,15,16,17,18,18,19,20,21,22,23,24,25,26,27,28,29,30,31,33,34,35,37,38,39,41,42,44,46,47,49,51,53,55,57,59,61,63,65,67,70,72,74,77,79,82,85,88,90,93,96,99,103,106,109,113,116,120,123,127,131,135,139,143,147,151,156,160,165,170,175,180,185,190,195,201,206,212,218,223,230,236,242,248,255
-#define _PWM2_TOPS_ 4096,2212,2316,2863,3070,3145,3154,3127,3080,3019,3284,3176,3071,2968,2869,2773,2680,2745,2647,2554,2464,2379,2297,2219,2144,2072,2004,1938,1875,1813,1698,1646,1545,1499,1411,1329,1253,1182,1116,1022,936,857,784,717,630,550,477,389,329,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
+#define _PWM2_LEVELS_ 1,1,2,2,3,3,4,4,5,5,6,6,6,7,7,7,7,7,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,9,9,9,10,10,10,11,11,12,13,13,14,15,15,16,17,18,18,19,20,21,22,23,24,25,26,27,28,29,30,31,33,34,35,37,38,39,41,42,44,46,47,49,51,53,55,57,59,61,63,65,67,70,72,74,77,79,82,85,88,90,93,96,99,103,106,109,113,116,120,123,127,131,135,139,143,147,151,156,160,165,170,175,180,185,190,195,201,206,212,218,223,230,236,242,248,255
+#define _PWM2_TOPS_ 3072,1960,2372,1476,2097,1572,1920,1570,1777,1524,1646,1454,1286,1369,1234,1115,1011,918,837,894,823,759,702,650,603,560,522,487,455,425,398,374,351,330,310,292,275,259,280,265,251,266,253,240,252,240,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
#define PWM1_LEVELS _PWM1_LEVELS_,_PWM2_TOPS_
#define PWM2_LEVELS 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,_PWM2_LEVELS_
#define PWM_TOPS _PWM1_TOPS_,_PWM2_TOPS_
@@ -53,7 +53,8 @@
#define MIN_THERM_STEPDOWN 65 // must be > end of dynamic PWM range
// slow down party strobe; this driver can't pulse for too short a time
-#define PARTY_STROBE_ONTIME 8
+//#define PARTY_STROBE_ONTIME 8
+#define STROBE_OFF_LEVEL 1 // keep the regulator chip on between pulses
// the default of 26 looks a bit flat, so increase it
#define CANDLE_AMPLITUDE 50
diff --git a/spaghetti-monster/anduril/strobe-modes.c b/spaghetti-monster/anduril/strobe-modes.c
index d5f12c0..e8d1dbb 100644
--- a/spaghetti-monster/anduril/strobe-modes.c
+++ b/spaghetti-monster/anduril/strobe-modes.c
@@ -215,7 +215,7 @@ inline void party_tactical_strobe_mode_iter(uint8_t st) {
nice_delay_ms(del >> 1);
}
#endif
- set_level(0);
+ set_level(STROBE_OFF_LEVEL);
nice_delay_ms(del); // no return check necessary on final delay
}
#endif
diff --git a/spaghetti-monster/anduril/strobe-modes.h b/spaghetti-monster/anduril/strobe-modes.h
index e2389ba..c6cfb53 100644
--- a/spaghetti-monster/anduril/strobe-modes.h
+++ b/spaghetti-monster/anduril/strobe-modes.h
@@ -62,6 +62,13 @@ strobe_mode_te strobe_type = 0;
#endif
#endif
+// some drivers need to keep the regulator chip on between pulses,
+// so set this to 1 to keep the light on at moon mode between pulses,
+// and thus keep the regulator powered up for the next flash
+#ifndef STROBE_OFF_LEVEL
+#define STROBE_OFF_LEVEL 0
+#endif
+
// party and tactical strobes
#ifdef USE_STROBE_STATE
uint8_t strobe_state(Event event, uint16_t arg);