From 1afe3758f58c1adc76c847d134e21f69faacc64e Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Mon, 16 Mar 2020 04:23:43 -0600 Subject: removed more references to THERM_HARD_TURBO_DROP --- spaghetti-monster/anduril/cfg-emisar-d1.h | 5 ----- spaghetti-monster/anduril/cfg-emisar-d1s.h | 5 ----- spaghetti-monster/anduril/cfg-emisar-d4.h | 4 ---- spaghetti-monster/anduril/cfg-emisar-d4s.h | 5 ----- 4 files changed, 19 deletions(-) (limited to 'spaghetti-monster') diff --git a/spaghetti-monster/anduril/cfg-emisar-d1.h b/spaghetti-monster/anduril/cfg-emisar-d1.h index 35e91db..9276ba3 100644 --- a/spaghetti-monster/anduril/cfg-emisar-d1.h +++ b/spaghetti-monster/anduril/cfg-emisar-d1.h @@ -8,8 +8,3 @@ #undef THERM_FASTER_LEVEL #endif #define THERM_FASTER_LEVEL (RAMP_SIZE*9/10) // throttle back faster when high - -// no need to be extra-careful on this light -#ifdef THERM_HARD_TURBO_DROP -#undef THERM_HARD_TURBO_DROP -#endif diff --git a/spaghetti-monster/anduril/cfg-emisar-d1s.h b/spaghetti-monster/anduril/cfg-emisar-d1s.h index 56200a2..c01c37d 100644 --- a/spaghetti-monster/anduril/cfg-emisar-d1s.h +++ b/spaghetti-monster/anduril/cfg-emisar-d1s.h @@ -8,8 +8,3 @@ #undef THERM_FASTER_LEVEL #endif #define THERM_FASTER_LEVEL 144 // throttle back faster when high - -// no need to be extra-careful on this light -#ifdef THERM_HARD_TURBO_DROP -#undef THERM_HARD_TURBO_DROP -#endif diff --git a/spaghetti-monster/anduril/cfg-emisar-d4.h b/spaghetti-monster/anduril/cfg-emisar-d4.h index 501b9c7..7700d88 100644 --- a/spaghetti-monster/anduril/cfg-emisar-d4.h +++ b/spaghetti-monster/anduril/cfg-emisar-d4.h @@ -18,10 +18,6 @@ #define RAMP_DISCRETE_CEIL RAMP_SMOOTH_CEIL #define RAMP_DISCRETE_STEPS 7 -// optional, makes initial turbo step-down faster so first peak isn't as hot -// the D4 runs very very hot, so be extra careful -//#define THERM_HARD_TURBO_DROP - // stop panicking at ~30% power or ~1200 lm #define THERM_FASTER_LEVEL 105 diff --git a/spaghetti-monster/anduril/cfg-emisar-d4s.h b/spaghetti-monster/anduril/cfg-emisar-d4s.h index 88465da..f5addb2 100644 --- a/spaghetti-monster/anduril/cfg-emisar-d4s.h +++ b/spaghetti-monster/anduril/cfg-emisar-d4s.h @@ -37,8 +37,3 @@ #endif #define MIN_THERM_STEPDOWN 60 // lowest value it'll step down to #define THERM_FASTER_LEVEL (RAMP_SIZE-20) // don't throttle back faster when high - -// no need to be extra-careful on this light -#ifdef THERM_HARD_TURBO_DROP -#undef THERM_HARD_TURBO_DROP -#endif -- cgit v1.2.3 From ff9eedb56927387201f96f90bf3d39b99f86e283 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Sun, 22 Mar 2020 01:25:55 -0600 Subject: apparently the D1 can also be purchased with a D4v2 driver... so it's basically a D1v2 --- spaghetti-monster/anduril/cfg-emisar-d1v2.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 spaghetti-monster/anduril/cfg-emisar-d1v2.h (limited to 'spaghetti-monster') diff --git a/spaghetti-monster/anduril/cfg-emisar-d1v2.h b/spaghetti-monster/anduril/cfg-emisar-d1v2.h new file mode 100644 index 0000000..63cb0e9 --- /dev/null +++ b/spaghetti-monster/anduril/cfg-emisar-d1v2.h @@ -0,0 +1,17 @@ +// Emisar D1v2 config options for Anduril (D1 w/ D4v2 driver) +// ATTINY: 1634 +// same as Emisar D4v2, mostly +#include "cfg-emisar-d4v2.h" + +// there are no aux LED on a D1 +#undef USE_AUX_RGB_LEDS +// ... and no button LED +#undef USE_BUTTON_LED +// no aux LEDs means no need for sleep ticks +#undef TICK_DURING_STANDBY + +// stop panicking at ~75% power or ~1000 lm (D1 has a decent power-to-thermal-mass ratio) +#ifdef THERM_FASTER_LEVEL +#undef THERM_FASTER_LEVEL +#endif +#define THERM_FASTER_LEVEL (RAMP_SIZE*9/10) // throttle back faster when high -- cgit v1.2.3 From c6db8faca50762aea53fb38c48c1bd5fae092f19 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Mon, 13 Apr 2020 19:50:05 -0600 Subject: recalibrated timing of nice_delay_ms() based on strobe speed measurements... gets very close to 24.2 Hz and 10.0 Hz for default strobe settings now --- spaghetti-monster/anduril/anduril.c | 2 +- spaghetti-monster/fsm-events.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'spaghetti-monster') diff --git a/spaghetti-monster/anduril/anduril.c b/spaghetti-monster/anduril/anduril.c index cb48b45..0758327 100644 --- a/spaghetti-monster/anduril/anduril.c +++ b/spaghetti-monster/anduril/anduril.c @@ -490,7 +490,7 @@ volatile strobe_mode_te strobe_type = 0; #if defined(USE_PARTY_STROBE_MODE) || defined(USE_TACTICAL_STROBE_MODE) // party / tactical strobe timing -volatile uint8_t strobe_delays[] = { 40, 67 }; // party strobe, tactical strobe +volatile uint8_t strobe_delays[] = { 41, 67 }; // party strobe 24 Hz, tactical strobe 10 Hz #endif // bike mode config options diff --git a/spaghetti-monster/fsm-events.c b/spaghetti-monster/fsm-events.c index a1b013a..ad869a6 100644 --- a/spaghetti-monster/fsm-events.c +++ b/spaghetti-monster/fsm-events.c @@ -120,7 +120,7 @@ uint8_t nice_delay_ms(uint16_t ms) { uint8_t level = actual_level; // volatile, avoid repeat access if (level < QUARTERSPEED_LEVEL) { clock_prescale_set(clock_div_4); - _delay_loop_2(BOGOMIPS*95/100/4); + _delay_loop_2(BOGOMIPS*90/100/4); } //else if (level < HALFSPEED_LEVEL) { // clock_prescale_set(clock_div_2); @@ -128,7 +128,7 @@ uint8_t nice_delay_ms(uint16_t ms) { //} else { clock_prescale_set(clock_div_1); - _delay_loop_2(BOGOMIPS*95/100); + _delay_loop_2(BOGOMIPS*90/100); } // restore regular clock speed clock_prescale_set(clock_div_1); @@ -136,13 +136,13 @@ uint8_t nice_delay_ms(uint16_t ms) { // underclock MCU to save power clock_prescale_set(clock_div_4); // wait - _delay_loop_2(BOGOMIPS*95/100/4); + _delay_loop_2(BOGOMIPS*90/100/4); // restore regular clock speed clock_prescale_set(clock_div_1); #endif // ifdef USE_RAMPING #else // wait - _delay_loop_2(BOGOMIPS*95/100); + _delay_loop_2(BOGOMIPS*90/100); #endif // ifdef USE_DYNAMIC_UNDERCLOCKING // run pending system processes while we wait -- cgit v1.2.3 From 1c741d98cc30a62511120ec80f73f30e9ba30eb8 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Mon, 13 Apr 2020 19:50:41 -0600 Subject: added a noFET build for D4v2, by request --- spaghetti-monster/anduril/cfg-emisar-d1v2.h | 2 +- spaghetti-monster/anduril/cfg-emisar-d4v2-nofet.h | 34 +++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 spaghetti-monster/anduril/cfg-emisar-d4v2-nofet.h (limited to 'spaghetti-monster') diff --git a/spaghetti-monster/anduril/cfg-emisar-d1v2.h b/spaghetti-monster/anduril/cfg-emisar-d1v2.h index 63cb0e9..91be3f3 100644 --- a/spaghetti-monster/anduril/cfg-emisar-d1v2.h +++ b/spaghetti-monster/anduril/cfg-emisar-d1v2.h @@ -3,7 +3,7 @@ // same as Emisar D4v2, mostly #include "cfg-emisar-d4v2.h" -// there are no aux LED on a D1 +// there are no aux LEDs on a D1 #undef USE_AUX_RGB_LEDS // ... and no button LED #undef USE_BUTTON_LED diff --git a/spaghetti-monster/anduril/cfg-emisar-d4v2-nofet.h b/spaghetti-monster/anduril/cfg-emisar-d4v2-nofet.h new file mode 100644 index 0000000..cbb5891 --- /dev/null +++ b/spaghetti-monster/anduril/cfg-emisar-d4v2-nofet.h @@ -0,0 +1,34 @@ +// Emisar D4v2-noFET config options for Anduril +#include "cfg-emisar-d4v2.h" +// ATTINY: 1634 + +#undef PWM_CHANNELS +#define PWM_CHANNELS 1 +#undef PWM1_LEVELS +#undef PWM2_LEVELS +#define PWM1_LEVELS 1,1,1,2,2,2,2,3,3,3,3,4,4,5,5,6,6,6,7,8,8,9,9,10,10,11,12,13,13,14,15,16,16,17,18,19,20,21,22,23,23,24,26,27,28,29,30,31,32,33,34,36,37,38,39,41,42,43,45,46,47,49,50,52,53,55,56,58,59,61,62,64,66,67,69,71,72,74,76,78,80,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109,111,113,116,118,120,122,125,127,129,132,134,136,139,141,144,146,148,151,154,156,159,161,164,166,169,172,174,177,180,183,185,188,191,194,197,200,203,205,208,211,214,217,220,223,226,230,233,236,239,242,245,249,252,255 +#undef MAX_1x7135 +#define MAX_1x7135 150 +#undef QUARTERSPEED_LEVEL +#undef HALFSPEED_LEVEL +#define QUARTERSPEED_LEVEL 8 +#define HALFSPEED_LEVEL 16 + +#define DEFAULT_LEVEL 80 + +#undef RAMP_SMOOTH_CEIL +#define RAMP_SMOOTH_CEIL 150 +// 10, 45, 80, 115, 150 +#undef RAMP_DISCRETE_FLOOR +#undef RAMP_DISCRETE_CEIL +#undef RAMP_DISCRETE_STEPS +#define RAMP_DISCRETE_FLOOR 10 +#define RAMP_DISCRETE_CEIL 150 +#define RAMP_DISCRETE_STEPS 5 + +#define CANDLE_AMPLITUDE 60 + +#undef THERM_FASTER_LEVEL +#define THERM_FASTER_LEVEL 150 + +#undef USE_THERMAL_REGULATION -- cgit v1.2.3 From 11e2778dabb5ff6fa12475c752044c7ff35cf94c Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Thu, 14 May 2020 16:20:33 -0600 Subject: fixed build when USE_GOODNIGHT_MODE not enabled --- spaghetti-monster/anduril/anduril.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'spaghetti-monster') diff --git a/spaghetti-monster/anduril/anduril.c b/spaghetti-monster/anduril/anduril.c index 8a9584e..a23b2e1 100644 --- a/spaghetti-monster/anduril/anduril.c +++ b/spaghetti-monster/anduril/anduril.c @@ -1593,11 +1593,25 @@ uint8_t battcheck_state(Event event, uint16_t arg) { set_state(off_state, 0); return MISCHIEF_MANAGED; } + #ifdef USE_GOODNIGHT_MODE // 2 clicks: goodnight mode else if (event == EV_2clicks) { set_state(goodnight_state, 0); return MISCHIEF_MANAGED; } + #elif defined(USE_BEACON_MODE) + // 2 clicks: beacon mode + else if (event == EV_2clicks) { + set_state(beacon_state, 0); + return MISCHIEF_MANAGED; + } + #elif defined(USE_THERMAL_REGULATION) + // 2 clicks: tempcheck mode + else if (event == EV_2clicks) { + set_state(tempcheck_state, 0); + return MISCHIEF_MANAGED; + } + #endif return EVENT_NOT_HANDLED; } #endif -- cgit v1.2.3 From 72542bdb90a0ab9e7a7dc8faad86a646507ef6f7 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Thu, 14 May 2020 16:29:29 -0600 Subject: fixed build of "momentary" example UI --- spaghetti-monster/fsm-events.h | 2 +- spaghetti-monster/momentary/momentary.c | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'spaghetti-monster') diff --git a/spaghetti-monster/fsm-events.h b/spaghetti-monster/fsm-events.h index 6760fdd..a132d5a 100644 --- a/spaghetti-monster/fsm-events.h +++ b/spaghetti-monster/fsm-events.h @@ -218,8 +218,8 @@ void emit(Event event, uint16_t arg); void emit_current_event(uint16_t arg); uint8_t nice_delay_ms(uint16_t ms); -//uint8_t nice_delay_4ms(uint8_t ms); //uint8_t nice_delay_s(); inline void interrupt_nice_delays(); +void delay_4ms(uint8_t ms); #endif diff --git a/spaghetti-monster/momentary/momentary.c b/spaghetti-monster/momentary/momentary.c index 26acd44..c7a8cf1 100644 --- a/spaghetti-monster/momentary/momentary.c +++ b/spaghetti-monster/momentary/momentary.c @@ -22,7 +22,6 @@ #include "hwdef-Emisar_D4.h" #define USE_LVP #define USE_DEBUG_BLINK -#define USE_DELAY_4MS #include "spaghetti-monster.h" volatile uint8_t brightness; -- cgit v1.2.3 From 4958a769029f7d1f444c5662fc0bee54a377229e Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Thu, 14 May 2020 16:49:14 -0600 Subject: fixed eeprom_wl functions on attiny1634 (didn't build before, due to a data type mismatch) --- spaghetti-monster/fsm-eeprom.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'spaghetti-monster') diff --git a/spaghetti-monster/fsm-eeprom.c b/spaghetti-monster/fsm-eeprom.c index 77352cf..0de7e05 100644 --- a/spaghetti-monster/fsm-eeprom.c +++ b/spaghetti-monster/fsm-eeprom.c @@ -67,7 +67,7 @@ void save_eeprom() { #ifdef USE_EEPROM_WL uint8_t eeprom_wl[EEPROM_WL_BYTES]; -EEP_OFFSET_T eep_wl_prev_offset; +uint8_t * eep_wl_prev_offset; uint8_t load_eeprom_wl() { #ifdef LED_ENABLE_PIN @@ -77,11 +77,11 @@ uint8_t load_eeprom_wl() { cli(); // check if eeprom has been initialized; abort if it hasn't uint8_t found = 0; - EEP_OFFSET_T offset; + uint8_t * offset; for(offset = 0; - offset < EEP_WL_SIZE - EEPROM_WL_BYTES - 1; + offset < (uint8_t *)(EEP_WL_SIZE - EEPROM_WL_BYTES - 1); offset += (EEPROM_WL_BYTES + 1)) { - if (eeprom_read_byte((uint8_t *)offset) == EEP_MARKER) { + if (eeprom_read_byte(offset) == EEP_MARKER) { found = 1; eep_wl_prev_offset = offset; break; @@ -91,7 +91,7 @@ uint8_t load_eeprom_wl() { if (found) { // load the actual data for(uint8_t i=0; i EEP_WL_SIZE-EEPROM_WL_BYTES-1) offset = 0; + if (offset > (uint8_t *)(EEP_WL_SIZE-EEPROM_WL_BYTES-1)) offset = 0; eep_wl_prev_offset = offset; // marker byte // FIXME: write the marker last, to signal completed transaction - eeprom_update_byte((uint8_t *)offset, EEP_MARKER); + eeprom_update_byte(offset, EEP_MARKER); offset ++; // user data for(uint8_t i=0; i TICKS_PER_SECOND*5) { // sleep after 5 seconds go_to_standby = 1; // sleep while light is off // turn off lighted button @@ -1898,7 +1902,9 @@ uint8_t momentary_state(Event event, uint16_t arg) { rgb_led_update(0, 0); #endif } + #ifdef USE_STROBE_STATE } + #endif return MISCHIEF_MANAGED; } -- cgit v1.2.3 From 45c6e163739d3ac095f283d07b31e65d6218e0b6 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Mon, 1 Jun 2020 20:58:45 -0600 Subject: "SOS" is treated as one "letter" in Morse code... it's not three letters (so, don't put the normal inter-letter gap between) --- spaghetti-monster/anduril/anduril.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'spaghetti-monster') diff --git a/spaghetti-monster/anduril/anduril.c b/spaghetti-monster/anduril/anduril.c index 167c14d..01904dc 100644 --- a/spaghetti-monster/anduril/anduril.c +++ b/spaghetti-monster/anduril/anduril.c @@ -1572,7 +1572,8 @@ void sos_blink(uint8_t num, uint8_t dah) { nice_delay_ms(DIT_LENGTH); } // three "off" dits (or one "dah") between letters - nice_delay_ms(DIT_LENGTH*2); + // (except for SOS, which is collectively treated as a single "letter") + //nice_delay_ms(DIT_LENGTH*2); } inline void sos_mode_iter() { -- cgit v1.2.3