From d40369595fef086cb070425930b882705f1ac20b Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Thu, 1 Apr 2021 18:29:17 -0600 Subject: touched up a bit of formatting and a note for later optimization --- spaghetti-monster/fsm-misc.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'spaghetti-monster') diff --git a/spaghetti-monster/fsm-misc.c b/spaghetti-monster/fsm-misc.c index edd982a..c2c1afe 100644 --- a/spaghetti-monster/fsm-misc.c +++ b/spaghetti-monster/fsm-misc.c @@ -111,6 +111,7 @@ uint8_t blink_num(uint8_t num) { void indicator_led(uint8_t lvl) { switch (lvl) { #ifdef AVRXMEGA3 // ATTINY816, 817, etc + case 0: // indicator off AUXLED_PORT.DIRSET = (1 << AUXLED_PIN); // set as output AUXLED_PORT.OUTCLR = (1 << AUXLED_PIN); // set output low @@ -139,6 +140,7 @@ void indicator_led(uint8_t lvl) { break; #else + case 0: // indicator off DDRB &= 0xff ^ (1 << AUXLED_PIN); PORTB &= 0xff ^ (1 << AUXLED_PIN); @@ -164,7 +166,7 @@ void indicator_led(uint8_t lvl) { #endif break; - #endif + #endif // MCU type } } @@ -183,6 +185,7 @@ void button_led_set(uint8_t lvl) { switch (lvl) { #ifdef AVRXMEGA3 // ATTINY816, 817, etc + case 0: // LED off BUTTON_LED_PORT.DIRSET = (1 << BUTTON_LED_PIN); // set as output BUTTON_LED_PORT.OUTCLR = (1 << BUTTON_LED_PIN); // set output low @@ -215,7 +218,7 @@ void button_led_set(uint8_t lvl) { BUTTON_LED_PORT |= (1 << BUTTON_LED_PIN); break; - #endif + #endif // MCU type } } #endif @@ -230,6 +233,7 @@ void rgb_led_set(uint8_t value) { switch (lvl) { #ifdef AVRXMEGA3 // ATTINY816, 817, etc + case 0: // LED off AUXLED_RGB_PORT.DIRSET = (1 << pin); // set as output AUXLED_RGB_PORT.OUTCLR = (1 << pin); // set output low @@ -262,8 +266,7 @@ void rgb_led_set(uint8_t value) { AUXLED_RGB_PORT |= (1 << pin); break; - #endif - + #endif // MCU type } } } -- cgit v1.2.3 From 15adc384caf1db3311a6ccd684a3dcf3757606cf Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Thu, 1 Apr 2021 18:37:31 -0600 Subject: slightly reorganized declaration of PCINT to make it easier to read --- spaghetti-monster/fsm-pcint.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) (limited to 'spaghetti-monster') diff --git a/spaghetti-monster/fsm-pcint.c b/spaghetti-monster/fsm-pcint.c index 4a3c193..4ada5b8 100644 --- a/spaghetti-monster/fsm-pcint.c +++ b/spaghetti-monster/fsm-pcint.c @@ -69,24 +69,20 @@ inline void PCINT_off() { //void button_change_interrupt() { #if (ATTINY == 25) || (ATTINY == 45) || (ATTINY == 85) || (ATTINY == 1634) -//EMPTY_INTERRUPT(PCINT0_vect); -#ifdef PCINT_vect -ISR(PCINT_vect) { -#else -ISR(PCINT0_vect) { -#endif - irq_pcint = 1; -} + #ifdef PCINT_vect + ISR(PCINT_vect) { + #else + ISR(PCINT0_vect) { + #endif #elif defined(AVRXMEGA3) // ATTINY816, 817, etc) -ISR(SWITCH_VECT) { - SWITCH_INTFLG |= (1 << SWITCH_PIN); // Write a '1' to clear the interrupt flag - irq_pcint = 1; -} + ISR(SWITCH_VECT) { + // Write a '1' to clear the interrupt flag + SWITCH_INTFLG |= (1 << SWITCH_PIN); #else #error Unrecognized MCU type #endif -/* -ISR(PCINT0_vect) { + + irq_pcint = 1; // let deferred code know an interrupt happened //DEBUG_FLASH; @@ -95,9 +91,7 @@ ISR(PCINT0_vect) { // noisy / bouncy switch (so the content of this function has been // moved to a separate function, called from WDT only) // PCINT_inner(button_is_pressed()); - } -*/ // should only be called from PCINT and/or WDT // (is a separate function to reduce code duplication) -- cgit v1.2.3 From 0cc485438d75143e0d08757103dc4e5615caae51 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Thu, 1 Apr 2021 18:59:11 -0600 Subject: Renamed gchart-fet1-t16 to t1616, to make it consistent with other t1616 models. --- spaghetti-monster/anduril/MODELS | 2 +- spaghetti-monster/anduril/cfg-gchart-fet1-t16.h | 34 ----------------------- spaghetti-monster/anduril/cfg-gchart-fet1-t1616.h | 34 +++++++++++++++++++++++ 3 files changed, 35 insertions(+), 35 deletions(-) delete mode 100644 spaghetti-monster/anduril/cfg-gchart-fet1-t16.h create mode 100644 spaghetti-monster/anduril/cfg-gchart-fet1-t1616.h (limited to 'spaghetti-monster') diff --git a/spaghetti-monster/anduril/MODELS b/spaghetti-monster/anduril/MODELS index 4dda62f..db56136 100644 --- a/spaghetti-monster/anduril/MODELS +++ b/spaghetti-monster/anduril/MODELS @@ -42,6 +42,6 @@ Model numbers: 0631 blf-q8-t1616 0632 sofirn-sp36-t1616 0633 blf-lantern-t1616 -1618 gchart-fet1-t16 +1618 gchart-fet1-t1616 Duplicates: Missing: diff --git a/spaghetti-monster/anduril/cfg-gchart-fet1-t16.h b/spaghetti-monster/anduril/cfg-gchart-fet1-t16.h deleted file mode 100644 index a6434b8..0000000 --- a/spaghetti-monster/anduril/cfg-gchart-fet1-t16.h +++ /dev/null @@ -1,34 +0,0 @@ -// gChart's custom FET+1 driver config options for Anduril -#define MODEL_NUMBER "1618" // Golden Ratio... because I can -#include "hwdef-gchart-fet1-t16.h" -// ATTINY: 1616 - -// the button lights up -#define USE_INDICATOR_LED -// 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 - -#undef BLINK_AT_RAMP_MIDDLE - -// Mostly borrowed from the D4 for now -#define RAMP_LENGTH 150 -#define PWM1_LEVELS 1,1,2,2,3,3,4,4,5,6,7,8,9,10,12,13,14,15,17,19,20,22,24,26,29,31,34,36,39,42,45,48,51,55,59,62,66,70,75,79,84,89,93,99,104,110,115,121,127,134,140,147,154,161,168,176,184,192,200,209,217,226,236,245,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,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,0,1,3,4,5,7,8,9,11,12,14,15,17,19,20,22,24,25,27,29,31,33,35,37,39,41,43,45,48,50,52,55,57,59,62,64,67,70,72,75,78,81,84,87,90,93,96,99,102,105,109,112,115,119,122,126,129,133,137,141,144,148,152,156,160,165,169,173,177,182,186,191,195,200,205,209,214,219,224,229,234,239,244,250,255 -#define MAX_1x7135 65 -#define HALFSPEED_LEVEL 14 -#define QUARTERSPEED_LEVEL 6 - -#define RAMP_SMOOTH_FLOOR 1 -#define RAMP_SMOOTH_CEIL 120 -// 10, 28, 46, [65], 83, 101, 120 -#define RAMP_DISCRETE_FLOOR 10 -#define RAMP_DISCRETE_CEIL RAMP_SMOOTH_CEIL -#define RAMP_DISCRETE_STEPS 7 - -// stop panicking at ~30% power -#define THERM_FASTER_LEVEL 105 - -// enable 2 click turbo -#define USE_2C_MAX_TURBO diff --git a/spaghetti-monster/anduril/cfg-gchart-fet1-t1616.h b/spaghetti-monster/anduril/cfg-gchart-fet1-t1616.h new file mode 100644 index 0000000..e9260eb --- /dev/null +++ b/spaghetti-monster/anduril/cfg-gchart-fet1-t1616.h @@ -0,0 +1,34 @@ +// gChart's custom FET+1 driver config options for Anduril +#define MODEL_NUMBER "1618" // Golden Ratio... because I can +#include "hwdef-gchart-fet1-t1616.h" +// ATTINY: 1616 + +// the button lights up +#define USE_INDICATOR_LED +// 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 + +#undef BLINK_AT_RAMP_MIDDLE + +// Mostly borrowed from the D4 for now +#define RAMP_LENGTH 150 +#define PWM1_LEVELS 1,1,2,2,3,3,4,4,5,6,7,8,9,10,12,13,14,15,17,19,20,22,24,26,29,31,34,36,39,42,45,48,51,55,59,62,66,70,75,79,84,89,93,99,104,110,115,121,127,134,140,147,154,161,168,176,184,192,200,209,217,226,236,245,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,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,0,1,3,4,5,7,8,9,11,12,14,15,17,19,20,22,24,25,27,29,31,33,35,37,39,41,43,45,48,50,52,55,57,59,62,64,67,70,72,75,78,81,84,87,90,93,96,99,102,105,109,112,115,119,122,126,129,133,137,141,144,148,152,156,160,165,169,173,177,182,186,191,195,200,205,209,214,219,224,229,234,239,244,250,255 +#define MAX_1x7135 65 +#define HALFSPEED_LEVEL 14 +#define QUARTERSPEED_LEVEL 6 + +#define RAMP_SMOOTH_FLOOR 1 +#define RAMP_SMOOTH_CEIL 120 +// 10, 28, 46, [65], 83, 101, 120 +#define RAMP_DISCRETE_FLOOR 10 +#define RAMP_DISCRETE_CEIL RAMP_SMOOTH_CEIL +#define RAMP_DISCRETE_STEPS 7 + +// stop panicking at ~30% power +#define THERM_FASTER_LEVEL 105 + +// enable 2 click turbo +#define USE_2C_MAX_TURBO -- cgit v1.2.3 From c123f5d558e56eb0c3805b31022e4fedf774c36b Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Thu, 1 Apr 2021 22:50:47 -0600 Subject: reverted version.h back to generic original --- spaghetti-monster/anduril/version.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'spaghetti-monster') diff --git a/spaghetti-monster/anduril/version.h b/spaghetti-monster/anduril/version.h index 14502aa..8cf3c90 100644 --- a/spaghetti-monster/anduril/version.h +++ b/spaghetti-monster/anduril/version.h @@ -1 +1,4 @@ -#define VERSION_NUMBER "20210201" +// 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 97c5b68bc4268583ed3ca9acc9803a12df75fde4 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Fri, 2 Apr 2021 14:07:53 -0600 Subject: fixed blinking aux LED on gchart-fet1-t1616 (was fast and bright, now uses 2-level heartbeat pattern) --- spaghetti-monster/anduril/cfg-gchart-fet1-t1616.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'spaghetti-monster') diff --git a/spaghetti-monster/anduril/cfg-gchart-fet1-t1616.h b/spaghetti-monster/anduril/cfg-gchart-fet1-t1616.h index e9260eb..101f25a 100644 --- a/spaghetti-monster/anduril/cfg-gchart-fet1-t1616.h +++ b/spaghetti-monster/anduril/cfg-gchart-fet1-t1616.h @@ -9,6 +9,11 @@ #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: low (1) +// lockout: blinking (3) +#define INDICATOR_LED_DEFAULT_MODE ((3<<2) + 1) #undef BLINK_AT_RAMP_MIDDLE -- cgit v1.2.3 From b5fa3880719f9cc3295b57a9e356c26c604eeff4 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Fri, 2 Apr 2021 14:09:38 -0600 Subject: re-numbered t1616 builds to reflect manufacturer better (all the Sofirn ones are pre-production builds intended to go on new Sofirn-produced hardware) --- spaghetti-monster/anduril/MODELS | 8 ++++---- spaghetti-monster/anduril/cfg-blf-lantern-t1616.h | 2 +- spaghetti-monster/anduril/cfg-blf-q8-t1616.h | 2 +- spaghetti-monster/anduril/cfg-sofirn-sp10s.h | 2 +- spaghetti-monster/anduril/cfg-sofirn-sp36-t1616.h | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) (limited to 'spaghetti-monster') diff --git a/spaghetti-monster/anduril/MODELS b/spaghetti-monster/anduril/MODELS index db56136..13ce2e4 100644 --- a/spaghetti-monster/anduril/MODELS +++ b/spaghetti-monster/anduril/MODELS @@ -37,11 +37,11 @@ Model numbers: 0521 mateminco-mf01-mini 0611 blf-q8 0612 sofirn-sp36 +0613 blf-q8-t1616 +0614 sofirn-sp36-t1616 0621 blf-lantern -0622 sofirn-sp10s -0631 blf-q8-t1616 -0632 sofirn-sp36-t1616 -0633 blf-lantern-t1616 +0622 blf-lantern-t1616 +0631 sofirn-sp10s 1618 gchart-fet1-t1616 Duplicates: Missing: diff --git a/spaghetti-monster/anduril/cfg-blf-lantern-t1616.h b/spaghetti-monster/anduril/cfg-blf-lantern-t1616.h index 7905eee..d602641 100644 --- a/spaghetti-monster/anduril/cfg-blf-lantern-t1616.h +++ b/spaghetti-monster/anduril/cfg-blf-lantern-t1616.h @@ -1,5 +1,5 @@ // BLF Lantern config options for Anduril using the Attiny1616 -#define MODEL_NUMBER "0633" +#define MODEL_NUMBER "0622" /* BLF Lantern pinout * PB0 is 5000K channel * PB1 is 3000K channel diff --git a/spaghetti-monster/anduril/cfg-blf-q8-t1616.h b/spaghetti-monster/anduril/cfg-blf-q8-t1616.h index e1e1598..73702a9 100644 --- a/spaghetti-monster/anduril/cfg-blf-q8-t1616.h +++ b/spaghetti-monster/anduril/cfg-blf-q8-t1616.h @@ -1,5 +1,5 @@ // BLF Q8 config options for Anduril using the Attiny1616 -#define MODEL_NUMBER "0631" +#define MODEL_NUMBER "0613" #include "hwdef-BLF_Q8-T1616.h" // ATTINY: 1616 diff --git a/spaghetti-monster/anduril/cfg-sofirn-sp10s.h b/spaghetti-monster/anduril/cfg-sofirn-sp10s.h index 054b1db..99ed17d 100644 --- a/spaghetti-monster/anduril/cfg-sofirn-sp10s.h +++ b/spaghetti-monster/anduril/cfg-sofirn-sp10s.h @@ -1,5 +1,5 @@ // gChart's custom SP10S driver config options for Anduril -#define MODEL_NUMBER "0622" +#define MODEL_NUMBER "0631" #include "hwdef-Sofirn_SP10S.h" // ATTINY: 1616 diff --git a/spaghetti-monster/anduril/cfg-sofirn-sp36-t1616.h b/spaghetti-monster/anduril/cfg-sofirn-sp36-t1616.h index 8eb7a5d..ce1c04a 100644 --- a/spaghetti-monster/anduril/cfg-sofirn-sp36-t1616.h +++ b/spaghetti-monster/anduril/cfg-sofirn-sp36-t1616.h @@ -2,7 +2,7 @@ // same as the BLF Q8, mostly #include "cfg-blf-q8-t1616.h" #undef MODEL_NUMBER -#define MODEL_NUMBER "0632" +#define MODEL_NUMBER "0614" // ATTINY: 1616 // voltage readings were a little high with the Q8 value -- cgit v1.2.3 From 671605807b746d4baa127d0988742eddb10df1ad Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Tue, 13 Apr 2021 02:44:13 -0600 Subject: fixed wrong word in manual (turbo is in full UI only) --- spaghetti-monster/anduril/anduril-manual.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spaghetti-monster') diff --git a/spaghetti-monster/anduril/anduril-manual.txt b/spaghetti-monster/anduril/anduril-manual.txt index b3a1cef..e3b3cf5 100644 --- a/spaghetti-monster/anduril/anduril-manual.txt +++ b/spaghetti-monster/anduril/anduril-manual.txt @@ -691,7 +691,7 @@ Ramp Simple 2C Go to/from ceiling Ramp Full 2C Go to/from ceiling (or turbo if at ceil already) Ramp Full 3C Change ramp style (smooth / stepped) Ramp Any 3H Tint ramping (on some lights) -Ramp Any 3H Momentary turbo (on lights without tint ramping) +Ramp Full 3H Momentary turbo (on lights without tint ramping) Ramp Any 4C Lockout mode Ramp Full 5C Momentary mode Ramp Full 5H Sunset timer on, and add 5 minutes -- cgit v1.2.3 From 16df5326767123a70fdd77892fbfc603f8180523 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Tue, 13 Apr 2021 02:44:56 -0600 Subject: fixed missing ifdef for simple UI --- spaghetti-monster/anduril/off-mode.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'spaghetti-monster') diff --git a/spaghetti-monster/anduril/off-mode.c b/spaghetti-monster/anduril/off-mode.c index 34d9e6d..e37f08d 100644 --- a/spaghetti-monster/anduril/off-mode.c +++ b/spaghetti-monster/anduril/off-mode.c @@ -157,9 +157,12 @@ uint8_t off_state(Event event, uint16_t arg) { } // click, hold: momentary at ceiling or turbo else if (event == EV_click2_hold) { + #ifdef USE_SIMPLE_UI if (simple_ui_active) { set_level(nearest_level(MAX_LEVEL)); - } else { + } else + #endif + { set_level(MAX_LEVEL); } return MISCHIEF_MANAGED; -- cgit v1.2.3