From c7b6a22af23fb611c66d3f6c5d6e9a934589f0ca Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Fri, 28 Jun 2019 03:41:42 -0600 Subject: added support for Mateminco MF01-Mini --- .../anduril/cfg-mateminco-mf01-mini.h | 61 ++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 spaghetti-monster/anduril/cfg-mateminco-mf01-mini.h (limited to 'spaghetti-monster') diff --git a/spaghetti-monster/anduril/cfg-mateminco-mf01-mini.h b/spaghetti-monster/anduril/cfg-mateminco-mf01-mini.h new file mode 100644 index 0000000..2d1e5c7 --- /dev/null +++ b/spaghetti-monster/anduril/cfg-mateminco-mf01-mini.h @@ -0,0 +1,61 @@ +// Mateminco/Astrolux MF01-Mini options for Anduril +#include "hwdef-Mateminco_MF01-Mini.h" + +// the button lights up +#define USE_INDICATOR_LED +#define INDICATOR_LED_SKIP_LOW // low mode doesn't work on this driver +// the button is visible while main LEDs are on +//#define USE_INDICATOR_LED_WHILE_RAMPING +// enable blinking indicator LED while off +#define TICK_DURING_STANDBY +#define STANDBY_TICK_SPEED 3 // every 0.128 s +#define USE_FANCIER_BLINKING_INDICATOR +// off mode: high (2) +// lockout: blinking (3) +#define INDICATOR_LED_DEFAULT_MODE ((3<<2) + 2) + + +// don't blink during ramp, it's irrelevant and annoying on this light +#define BLINK_AT_RAMP_CEILING +#undef BLINK_AT_RAMP_MIDDLE +#undef BLINK_AT_RAMP_FLOOR + +// measured brightness with Sofirn 5500mAh cell at 3.97V: +// moon: 0.3 lm +// channel 1: 113 lm +// channel 2: 718 lm +// channel 3: 3500 lm +// ../../../bin/level_calc.py ninth 3 150 7135 1 2.5 115.65 7135 11 5 708.65 FET 1 10 3500 +// (plus some manual tweaks for a smoother ramp) +#define RAMP_LENGTH 150 +#define PWM1_LEVELS 1,1,2,2,3,3,4,5,5,6,7,8,9,9,10,14,15,16,17,18,19,20,21,22,24,26,28,30,32,34,37,39,42,45,48,51,54,58,62,65,69,74,78,83,88,93,98,104,110,116,123,130,137,145,153,161,170,179,188,198,208,219,231,243,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,0 +#define PWM2_LEVELS 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,13,16,18,20,23,25,28,31,34,37,40,43,47,50,54,58,62,66,70,75,80,85,90,95,100,106,112,118,125,131,138,145,153,161,169,177,185,194,204,213,223,233,244,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,0 +#define PWM3_LEVELS 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,6,10,13,17,21,24,28,33,37,41,46,50,55,60,66,71,76,82,88,94,101,107,114,121,128,135,143,151,159,167,176,185,194,203,213,223,233,244,255 +#define MAX_1x7135 65 // ~113 lm +#define MAX_Nx7135 110 +#define HALFSPEED_LEVEL 16 +#define QUARTERSPEED_LEVEL 8 + +#define RAMP_SMOOTH_FLOOR 1 // ~0.3 lm +#define RAMP_SMOOTH_CEIL 130 // ~??? lm +// 14/135/6 = 14, 38, 62, 86, [110], 135 +// 20/110/7 = 20, 35, 50, [65], 80, 95, [110] +// 15/130/7 = 15, 34, 53, 72, 91, [110], 130 +#if 1 +#define RAMP_DISCRETE_FLOOR 15 // ~?? lm +#define RAMP_DISCRETE_CEIL 130 // ~??? lm +#define RAMP_DISCRETE_STEPS 7 // ??, ??, ... lm +#else // testing only; for calibrating the ramp in detail +#define RAMP_DISCRETE_FLOOR 1 // ~?? lm +#define RAMP_DISCRETE_CEIL 150 // ~??? lm +#define RAMP_DISCRETE_STEPS 150 // ??, ??, ... lm +#endif + + +#define USE_TENCLICK_THERMAL_CONFIG // by request +#define THERM_FASTER_LEVEL 130 // throttle back faster when high +//#define THERM_HARD_TURBO_DROP // this light is massively overpowered +#define THERMAL_WARNING_SECONDS 1 // FIXME: increase by 2 after merging newer code +//#define THERMAL_UPDATE_SPEED 1 +//#define THERM_PREDICTION_STRENGTH 4 + -- cgit v1.2.3 From 3f89c8d35619e37fd6d80b75a7574c7802b3556b Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Wed, 31 Jul 2019 14:47:19 -0600 Subject: mf01-mini: enable aux LED low mode --- spaghetti-monster/anduril/cfg-mateminco-mf01-mini.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'spaghetti-monster') diff --git a/spaghetti-monster/anduril/cfg-mateminco-mf01-mini.h b/spaghetti-monster/anduril/cfg-mateminco-mf01-mini.h index 2d1e5c7..e5db4f4 100644 --- a/spaghetti-monster/anduril/cfg-mateminco-mf01-mini.h +++ b/spaghetti-monster/anduril/cfg-mateminco-mf01-mini.h @@ -3,16 +3,16 @@ // the button lights up #define USE_INDICATOR_LED -#define INDICATOR_LED_SKIP_LOW // low mode doesn't work on this driver +//#define INDICATOR_LED_SKIP_LOW // low mode doesn't work on this driver // the button is visible while main LEDs are on //#define USE_INDICATOR_LED_WHILE_RAMPING // enable blinking indicator LED while off #define TICK_DURING_STANDBY #define STANDBY_TICK_SPEED 3 // every 0.128 s #define USE_FANCIER_BLINKING_INDICATOR -// off mode: high (2) +// off mode: low (1) // lockout: blinking (3) -#define INDICATOR_LED_DEFAULT_MODE ((3<<2) + 2) +#define INDICATOR_LED_DEFAULT_MODE ((3<<2) + 1) // don't blink during ramp, it's irrelevant and annoying on this light -- cgit v1.2.3 From 64da1475d73d5d021f125209360c024518fc1751 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Mon, 26 Aug 2019 16:31:12 -0600 Subject: just cleaning up some comments --- spaghetti-monster/anduril/cfg-mateminco-mf01-mini.h | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'spaghetti-monster') diff --git a/spaghetti-monster/anduril/cfg-mateminco-mf01-mini.h b/spaghetti-monster/anduril/cfg-mateminco-mf01-mini.h index e5db4f4..bbf751b 100644 --- a/spaghetti-monster/anduril/cfg-mateminco-mf01-mini.h +++ b/spaghetti-monster/anduril/cfg-mateminco-mf01-mini.h @@ -40,16 +40,10 @@ #define RAMP_SMOOTH_CEIL 130 // ~??? lm // 14/135/6 = 14, 38, 62, 86, [110], 135 // 20/110/7 = 20, 35, 50, [65], 80, 95, [110] -// 15/130/7 = 15, 34, 53, 72, 91, [110], 130 -#if 1 +// 15/130/7 = 15, 34, 53, 72, 91, [110], 130 <-- #define RAMP_DISCRETE_FLOOR 15 // ~?? lm #define RAMP_DISCRETE_CEIL 130 // ~??? lm #define RAMP_DISCRETE_STEPS 7 // ??, ??, ... lm -#else // testing only; for calibrating the ramp in detail -#define RAMP_DISCRETE_FLOOR 1 // ~?? lm -#define RAMP_DISCRETE_CEIL 150 // ~??? lm -#define RAMP_DISCRETE_STEPS 150 // ??, ??, ... lm -#endif #define USE_TENCLICK_THERMAL_CONFIG // by request -- cgit v1.2.3 From 62223a6e1c304d3e5952a0a7138b75dc3c232dfc Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Thu, 29 Aug 2019 04:57:54 -0600 Subject: added Emisar D4S V2 support --- spaghetti-monster/anduril/cfg-emisar-d4sv2-219.h | 10 ++++ spaghetti-monster/anduril/cfg-emisar-d4sv2.h | 63 ++++++++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 spaghetti-monster/anduril/cfg-emisar-d4sv2-219.h create mode 100644 spaghetti-monster/anduril/cfg-emisar-d4sv2.h (limited to 'spaghetti-monster') diff --git a/spaghetti-monster/anduril/cfg-emisar-d4sv2-219.h b/spaghetti-monster/anduril/cfg-emisar-d4sv2-219.h new file mode 100644 index 0000000..9898246 --- /dev/null +++ b/spaghetti-monster/anduril/cfg-emisar-d4sv2-219.h @@ -0,0 +1,10 @@ +// Emisar D4Sv2-219 config options for Anduril +#include "cfg-emisar-d4sv2.h" +// ATTINY: 1634 + +#undef PWM1_LEVELS +#undef PWM2_LEVELS +#undef PWM3_LEVELS +#define PWM1_LEVELS 1,1,2,2,3,3,4,5,5,6,7,8,9,10,11,12,13,17,18,19,20,21,22,24,26,28,30,33,35,38,41,44,47,50,54,57,61,65,69,74,79,84,89,94,100,106,113,119,126,134,142,150,158,167,176,186,196,207,218,230,242,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 PWM2_LEVELS 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,16,21,25,30,35,41,46,52,58,64,71,77,84,92,99,107,115,124,133,142,151,161,172,182,193,205,217,229,242,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 PWM3_LEVELS 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,4,6,7,9,10,12,13,15,17,18,20,22,24,26,28,30,33,35,37,40,43,45,48,50,53,56,59,62,65,69,72,76,80,83,87,91,95,99,104,108,113,117,123,127,132,138,143,148,154,160,166,172,178,185,192 diff --git a/spaghetti-monster/anduril/cfg-emisar-d4sv2.h b/spaghetti-monster/anduril/cfg-emisar-d4sv2.h new file mode 100644 index 0000000..acc9101 --- /dev/null +++ b/spaghetti-monster/anduril/cfg-emisar-d4sv2.h @@ -0,0 +1,63 @@ +// Emisar D4S V2 config options for Anduril +#include "hwdef-Emisar_D4Sv2.h" +// ATTINY: 1634 + +// this light has three aux LED channels: R, G, B +#define USE_AUX_RGB_LEDS +// the aux LEDs are front-facing, so turn them off while main LEDs are on +#ifdef USE_INDICATOR_LED_WHILE_RAMPING +#undef USE_INDICATOR_LED_WHILE_RAMPING +#endif +// enable blinking aux LEDs +#define TICK_DURING_STANDBY +#define STANDBY_TICK_SPEED 3 // every 0.128 s +//#define STANDBY_TICK_SPEED 4 // every 0.256 s +//#define STANDBY_TICK_SPEED 5 // every 0.512 s + + +// 1x7135 + 3x7135 + FET +// ../../../bin/level_calc.py seventh 3 150 7135 1 2.3 130 7135 11 5 400.1 FET 2 10 4000 +// (and some manual edits to make the clock speed changes smoother) +#define PWM1_LEVELS 1,1,2,2,3,3,4,5,5,6,7,8,9,10,11,12,13,17,18,19,20,21,22,24,26,28,30,33,35,38,41,44,47,50,54,57,61,65,69,74,79,84,89,94,100,106,113,119,126,134,142,150,158,167,176,186,196,207,218,230,242,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,0 +#define PWM2_LEVELS 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,16,21,25,30,35,41,46,52,58,64,71,77,84,92,99,107,115,124,133,142,151,161,172,182,193,205,217,229,242,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,0 +#define PWM3_LEVELS 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,5,6,8,10,12,14,16,18,20,23,25,27,30,32,35,38,41,44,47,50,53,57,60,64,67,71,75,79,83,87,92,96,101,106,111,116,121,127,132,138,144,150,156,163,169,176,183,190,197,205,213,221,229,237,246,255 +#define MAX_1x7135 62 +#define MAX_Nx7135 93 +#define HALFSPEED_LEVEL 18 +#define QUARTERSPEED_LEVEL 8 + +#define RAMP_SMOOTH_FLOOR 1 +#define RAMP_SMOOTH_CEIL 130 +// 20, 38, 56, 75, [93], 111, 130 +#define RAMP_DISCRETE_FLOOR 20 +#define RAMP_DISCRETE_CEIL RAMP_SMOOTH_CEIL +#define RAMP_DISCRETE_STEPS 7 + +#define DEFAULT_LEVEL MAX_Nx7135 +#define STROBE_BRIGHTNESS MAX_LEVEL + +#define MUGGLE_FLOOR RAMP_DISCRETE_FLOOR +#define MUGGLE_CEILING MAX_Nx7135 + +// stop panicking at ~50% power or ~2000 lm +#define THERM_FASTER_LEVEL 130 + +// no need to be extra-careful on this light +#ifdef THERM_HARD_TURBO_DROP +#undef THERM_HARD_TURBO_DROP +#endif + +// respond to thermal changes faster +#define THERMAL_WARNING_SECONDS 3 +#define THERMAL_UPDATE_SPEED 2 +#define THERM_PREDICTION_STRENGTH 4 + +// easier access to thermal config mode, for Emisar +#define USE_TENCLICK_THERMAL_CONFIG + +#ifdef BLINK_AT_RAMP_MIDDLE +#undef BLINK_AT_RAMP_MIDDLE +#endif + +// seems relevant on attiny1634 +#define THERM_CAL_OFFSET 5 -- cgit v1.2.3 From 2fcf49ed1f04d560ae2f422aa85e626147089171 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Sun, 15 Sep 2019 15:37:12 -0600 Subject: added some ideas for stuff to do, updated the UI diagram to show the stepped ramp mode differently --- spaghetti-monster/anduril/anduril-ui.png | Bin 286759 -> 281904 bytes spaghetti-monster/anduril/anduril.svg | 238 ++++++++++++++++++++++++------- spaghetti-monster/anduril/anduril.txt | 6 + 3 files changed, 195 insertions(+), 49 deletions(-) (limited to 'spaghetti-monster') diff --git a/spaghetti-monster/anduril/anduril-ui.png b/spaghetti-monster/anduril/anduril-ui.png index 3c032bc..70f6be0 100644 Binary files a/spaghetti-monster/anduril/anduril-ui.png and b/spaghetti-monster/anduril/anduril-ui.png differ diff --git a/spaghetti-monster/anduril/anduril.svg b/spaghetti-monster/anduril/anduril.svg index 36840a4..d58e478 100644 --- a/spaghetti-monster/anduril/anduril.svg +++ b/spaghetti-monster/anduril/anduril.svg @@ -22,6 +22,49 @@ inkscape:export-ydpi="109.75774"> + + + + + + + + + @@ -57,7 +100,7 @@ @@ -1896,16 +1939,6 @@ style="fill-rule:evenodd;stroke:#000000;stroke-width:0.42666668pt" inkscape:connector-curvature="0" /> - + + + + + + + + inkscape:snap-bbox-midpoints="true" + inkscape:snap-midpoints="true" + inkscape:snap-object-midpoints="true" + inkscape:object-paths="true" + inkscape:snap-intersection-paths="true"> + + + - Ceil Floor @@ -3245,22 +3354,16 @@ - 6 Clicks + transform="translate(-191.75097,7.3367765)"> + transform="translate(-281.95292,43.516866)"> @@ -4289,7 +4392,7 @@ sodipodi:nodetypes="cc" /> @@ -4639,11 +4742,11 @@ 3C 3C @@ -4799,5 +4902,42 @@ x="1091.5458" y="1212.6874" id="tspan43995-1">Factory Reset: Loosen tailcap, Hold button, Tighten tailcap, Hold 3s (or 13H from Off) + 3C + + + + + + diff --git a/spaghetti-monster/anduril/anduril.txt b/spaghetti-monster/anduril/anduril.txt index db73cdb..0a3dc4c 100644 --- a/spaghetti-monster/anduril/anduril.txt +++ b/spaghetti-monster/anduril/anduril.txt @@ -162,6 +162,12 @@ Indicator LED / aux LED support: TODO: + - change 6C to 6H for exiting muggle mode? + - move muggle mode from 6C to ... 8C or something? + - add 4H from lockout to turn light on and start ramping up? + - move config modes to 5C instead of 4C, and move manual memory to 4C? + - remove beacon config mode, and use a hold to set timing instead? + - rewrite muggle mode to split it into on and off states * save settings in eeprom * decide on "hold until hot" or "click N times" for thermal config mode * test thermal regulation on an actual light -- cgit v1.2.3 From dc8ec8b1817591e929555dcf6ae7302bbec758e8 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Tue, 24 Sep 2019 00:00:39 -0600 Subject: made the maximum number of clicks 15 instead of 14 --- spaghetti-monster/fsm-events.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spaghetti-monster') diff --git a/spaghetti-monster/fsm-events.c b/spaghetti-monster/fsm-events.c index 362a5cc..f35607d 100644 --- a/spaghetti-monster/fsm-events.c +++ b/spaghetti-monster/fsm-events.c @@ -42,7 +42,7 @@ uint8_t push_event(uint8_t ev_type) { // set press flag current_event |= B_PRESS; // increase click counter - if ((current_event & B_COUNT) < (B_COUNT-1)) { + if ((current_event & B_COUNT) < (B_COUNT)) { current_event ++; } return 1; // event pushed, even if max clicks already reached -- cgit v1.2.3 From 4948fc7cfb09d5d9bf7f899917f5aa7d274f1a1a Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Tue, 24 Sep 2019 00:01:31 -0600 Subject: sped up blink_digit() a little bit, because it was annoyingly slow --- spaghetti-monster/fsm-misc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'spaghetti-monster') diff --git a/spaghetti-monster/fsm-misc.c b/spaghetti-monster/fsm-misc.c index 8e88cbd..0a3cdca 100644 --- a/spaghetti-monster/fsm-misc.c +++ b/spaghetti-monster/fsm-misc.c @@ -41,20 +41,21 @@ void auto_clock_speed() { #endif #if defined(USE_BLINK_NUM) || defined(USE_BLINK_DIGIT) +#define BLINK_SPEED 1000 uint8_t blink_digit(uint8_t num) { //StatePtr old_state = current_state; // "zero" digit gets a single short blink - uint8_t ontime = 200; + uint8_t ontime = BLINK_SPEED * 2 / 10; if (!num) { ontime = 8; num ++; } for (; num>0; num--) { set_level(BLINK_BRIGHTNESS); nice_delay_ms(ontime); set_level(0); - nice_delay_ms(400); + nice_delay_ms(BLINK_SPEED * 3 / 10); } - return nice_delay_ms(600); + return nice_delay_ms(BLINK_SPEED * 5 / 10); } #endif -- cgit v1.2.3 From e2b727acfce7bc19843cdcc7f327efc9c61230d8 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Tue, 24 Sep 2019 00:32:53 -0600 Subject: added a version check function on 15+ clicks from off, added a safety ramp-down if button is held too long at ceiling (also removed muggle mode from a couple build targets because it doesn't fit, not enough ROM) --- spaghetti-monster/anduril/anduril.c | 38 ++++++++++++++++++++++ spaghetti-monster/anduril/build-all.sh | 2 ++ spaghetti-monster/anduril/cfg-emisar-d18.h | 6 ++++ .../anduril/cfg-mateminco-mf01-mini.h | 6 ++++ 4 files changed, 52 insertions(+) (limited to 'spaghetti-monster') diff --git a/spaghetti-monster/anduril/anduril.c b/spaghetti-monster/anduril/anduril.c index 8ab66f5..1505f59 100644 --- a/spaghetti-monster/anduril/anduril.c +++ b/spaghetti-monster/anduril/anduril.c @@ -35,6 +35,8 @@ // (currently incompatible with factory reset) //#define START_AT_MEMORIZED_LEVEL +// include a function to blink out the firmware version +#define USE_VERSION_CHECK // short blip when crossing from "click" to "hold" from off // (helps the user hit moon mode exactly, instead of holding too long @@ -483,6 +485,11 @@ uint8_t triangle_wave(uint8_t phase); volatile uint8_t beacon_seconds = 2; #endif +#ifdef USE_VERSION_CHECK +#include "version.h" +const PROGMEM uint8_t version_number[] = VERSION_NUMBER; +uint8_t version_check_state(Event event, uint16_t arg); +#endif uint8_t off_state(Event event, uint16_t arg) { // turn emitter off when entering state @@ -682,6 +689,13 @@ uint8_t off_state(Event event, uint16_t arg) { return MISCHIEF_MANAGED; } #endif + #ifdef USE_VERSION_CHECK + // 15+ clicks: show the version number + else if (event == EV_15clicks) { + set_state(version_check_state, 0); + return MISCHIEF_MANAGED; + } + #endif #if defined(USE_FACTORY_RESET) && defined(USE_SOFT_FACTORY_RESET) // 13 clicks and hold the last click: invoke factory reset (reboot) else if (event == EV_click13_hold) { @@ -792,6 +806,10 @@ uint8_t steady_state(Event event, uint16_t arg) { // (off->hold->stepped_min->release causes this state) else if (actual_level <= mode_min) { ramp_direction = 1; } } + // if the button is stuck, err on the side of safety and ramp down + else if ((arg > TICKS_PER_SECOND * 5) && (actual_level >= mode_max)) { + ramp_direction = -1; + } memorized_level = nearest_level((int16_t)actual_level \ + (ramp_step_size * ramp_direction)); #else @@ -1956,6 +1974,13 @@ uint8_t muggle_state(Event event, uint16_t arg) { #endif +#ifdef USE_VERSION_CHECK +uint8_t version_check_state(Event event, uint16_t arg) { + return EVENT_NOT_HANDLED; +} +#endif + + // ask the user for a sequence of numbers, then save them and return to caller uint8_t config_state_base(Event event, uint16_t arg, uint8_t num_config_steps, @@ -2558,6 +2583,19 @@ void loop() { if (0) {} + #ifdef USE_VERSION_CHECK + else if (state == version_check_state) { + for (uint8_t i=0; i version.h + for TARGET in cfg-*.h ; do NAME=$(echo "$TARGET" | perl -ne '/cfg-(.*).h/ && print "$1\n";') echo "===== $NAME =====" diff --git a/spaghetti-monster/anduril/cfg-emisar-d18.h b/spaghetti-monster/anduril/cfg-emisar-d18.h index 16fbacd..02e8f01 100644 --- a/spaghetti-monster/anduril/cfg-emisar-d18.h +++ b/spaghetti-monster/anduril/cfg-emisar-d18.h @@ -16,6 +16,12 @@ #define USE_TENCLICK_THERMAL_CONFIG +// save space, and remove a mode which doesn't make much sense on this light +#ifdef USE_MUGGLE_MODE +#undef USE_MUGGLE_MODE +#endif + + // level_calc.py seventh 3 150 7135 1 1.4 117.99 7135 6 1 1706.86 FET 3 10 13000 // (designed to make 1x hit at level 50, and Nx hit at level 100) #define RAMP_LENGTH 150 diff --git a/spaghetti-monster/anduril/cfg-mateminco-mf01-mini.h b/spaghetti-monster/anduril/cfg-mateminco-mf01-mini.h index bbf751b..a1d366d 100644 --- a/spaghetti-monster/anduril/cfg-mateminco-mf01-mini.h +++ b/spaghetti-monster/anduril/cfg-mateminco-mf01-mini.h @@ -15,6 +15,12 @@ #define INDICATOR_LED_DEFAULT_MODE ((3<<2) + 1) +// doesn't quite fit +#ifdef USE_MUGGLE_MODE +#undef USE_MUGGLE_MODE +#endif + + // don't blink during ramp, it's irrelevant and annoying on this light #define BLINK_AT_RAMP_CEILING #undef BLINK_AT_RAMP_MIDDLE -- cgit v1.2.3 From a86db913783008a14996415e09183a1097ab5389 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Sat, 28 Sep 2019 23:25:54 -0600 Subject: after safety ramp-down, if the button remains stuck, lock the light --- spaghetti-monster/anduril/anduril.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'spaghetti-monster') diff --git a/spaghetti-monster/anduril/anduril.c b/spaghetti-monster/anduril/anduril.c index 1505f59..48f4ac1 100644 --- a/spaghetti-monster/anduril/anduril.c +++ b/spaghetti-monster/anduril/anduril.c @@ -810,6 +810,11 @@ uint8_t steady_state(Event event, uint16_t arg) { else if ((arg > TICKS_PER_SECOND * 5) && (actual_level >= mode_max)) { ramp_direction = -1; } + // if the button is still stuck, lock the light + else if ((arg > TICKS_PER_SECOND * 10) && (actual_level <= mode_min)) { + blip(); + set_state(lockout_state, 0); + } memorized_level = nearest_level((int16_t)actual_level \ + (ramp_step_size * ramp_direction)); #else @@ -2589,10 +2594,13 @@ void loop() { blink_digit(pgm_read_byte(version_number + i) - '0'); nice_delay_ms(300); } - set_state(off_state, 0); // FIXME: when user interrupts with button, "off" takes an extra click // before it'll turn back on, because the click to cancel gets sent // to the "off" state instead of version_check_state + //while (button_is_pressed()) {} + //empty_event_sequence(); + + set_state(off_state, 0); } #endif // #ifdef USE_VERSION_CHECK -- cgit v1.2.3 From 06d75ac58143cf3dccd981975f20d589895de5b3 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Wed, 2 Oct 2019 00:02:27 -0600 Subject: added a default version.h for people who don't use the build script --- spaghetti-monster/anduril/version.h | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 spaghetti-monster/anduril/version.h (limited to 'spaghetti-monster') diff --git a/spaghetti-monster/anduril/version.h b/spaghetti-monster/anduril/version.h new file mode 100644 index 0000000..8cf3c90 --- /dev/null +++ b/spaghetti-monster/anduril/version.h @@ -0,0 +1,4 @@ +// this file is replaced automatically by the build script +// set your own date here if you're not using the build script +// otherwise, default to first human contact with the moon +#define VERSION_NUMBER "19690720" -- cgit v1.2.3 From fcc0cf099618c57e5a0635d35111bf75e1a2164e Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Wed, 2 Oct 2019 18:22:52 -0600 Subject: made lantern's muggle mode brighter (matches default stepped ramp level 4 of 5) and made the floor slightly lower (almost as low as level 1 of 5) because this light doesn't run hot enough for the previous limit to make sense (was roughly step 2.9 of 5) --- spaghetti-monster/anduril/cfg-blf-lantern.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'spaghetti-monster') diff --git a/spaghetti-monster/anduril/cfg-blf-lantern.h b/spaghetti-monster/anduril/cfg-blf-lantern.h index 9467397..bf183eb 100644 --- a/spaghetti-monster/anduril/cfg-blf-lantern.h +++ b/spaghetti-monster/anduril/cfg-blf-lantern.h @@ -51,6 +51,9 @@ #define RAMP_DISCRETE_CEIL RAMP_SMOOTH_CEIL #define RAMP_DISCRETE_STEPS 5 +#define MUGGLE_FLOOR 15 // about 20 lm +#define MUGGLE_CEILING 115 // about 350 lm + // the sensor (attiny85) is nowhere near the emitters // so thermal regulation can't work #ifdef USE_THERMAL_REGULATION -- cgit v1.2.3