From 757eb4836b733821d84b3941f9ee56c42810296e Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Thu, 1 Apr 2021 17:12:06 -0600 Subject: Added attiny1616 info to the README, and made bin/build.sh support more flexible. Set ATTINY_DFP environment variable in your shell to the location of the unzipped DFP files. --- README | 23 +++++++++++++++++++++++ bin/build.sh | 11 ++++++++--- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/README b/README index 59e1c8e..324e489 100644 --- a/README +++ b/README @@ -115,3 +115,26 @@ build Crescendo for an attiny25-based driver and then flash it: ../../bin/flash-tiny25.sh crescendo.hex Other useful tools are in bin/ too, so they might be worth a look. + + +ATtiny Series 1 (tiny1616) Support +================================== + +As of early 2021, the Debian packages for gcc-avr and avrdude do not include +support for the Tiny1 series chips. Extra steps are required to get these +working. + + - Download the Atmel ATtiny Series Device Support pack: + http://packs.download.atmel.com/ + + - Unzip the pack somewhere on your build computer + + - Set ATTINY_DFP=/path/to/where/you/unzipped/the/pack + (either in your shell, or in this repo's bin/build.sh script) + + - Make sure you're using gcc-avr 1:5.4.0+Atmel3.6.2 or newer. + 3.6.1 will not work. It gives errors like: + /usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: address 0x80381e of anduril.elf section `.data' is not within region `data' + This requires debian/bullseye or newer; buster has 3.6.1. + +This should at least allow the code to compile. diff --git a/bin/build.sh b/bin/build.sh index 6c21e30..c733320 100755 --- a/bin/build.sh +++ b/bin/build.sh @@ -11,12 +11,17 @@ fi export ATTINY=$1 ; shift export PROGRAM=$1 ; shift + +# path to the Atmel ATtiny device family pack: (for attiny1616 support) +# http://packs.download.atmel.com/ +if [ -z "$ATTINY_DFP" ]; then export ATTINY_DFP=~/avr/attiny_dfp ; fi + export MCU=attiny$ATTINY -export DFP=~/avr/attiny_dfp export CC=avr-gcc export OBJCOPY=avr-objcopy -export CFLAGS="-Wall -g -Os -mmcu=$MCU -c -std=gnu99 -fgnu89-inline -fwhole-program -DATTINY=$ATTINY -I.. -I../.. -I../../.. -fshort-enums -B $DFP/gcc/dev/$MCU/ -I $DFP/include/" -export OFLAGS="-Wall -g -Os -mmcu=$MCU -B $DFP/gcc/dev/$MCU/ -I $DFP/include/" +export DFPFLAGS="-B $ATTINY_DFP/gcc/dev/$MCU/ -I $ATTINY_DFP/include/" +export CFLAGS="-Wall -g -Os -mmcu=$MCU -c -std=gnu99 -fgnu89-inline -fwhole-program -DATTINY=$ATTINY -I.. -I../.. -I../../.. -fshort-enums $DFPFLAGS" +export OFLAGS="-Wall -g -Os -mmcu=$MCU $DFPFLAGS" export LDFLAGS="-fgnu89-inline" export OBJCOPYFLAGS='--set-section-flags=.eeprom=alloc,load --change-section-lma .eeprom=0 --no-change-warnings -O ihex' export OBJS=$PROGRAM.o -- cgit v1.2.3 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 +++++++---- tk-attiny.h | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) 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 } } } diff --git a/tk-attiny.h b/tk-attiny.h index 441f177..ae70afd 100644 --- a/tk-attiny.h +++ b/tk-attiny.h @@ -156,6 +156,7 @@ typedef enum { // Actual clock is 20 MHz, but assume that 5 MHz is the top speed and work from there + // TODO: measure PWM speed and power use at 1.25/2.5/5/10 MHz, to determine which speeds are optimal clock_div_1 = (CLKCTRL_PDIV_4X_gc | CLKCTRL_PEN_bm), // 5 MHz clock_div_2 = (CLKCTRL_PDIV_8X_gc | CLKCTRL_PEN_bm), // 2.5 MHz clock_div_4 = (CLKCTRL_PDIV_16X_gc | CLKCTRL_PEN_bm), // 1.25 MHz -- 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(-) 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. --- hwdef-gchart-fet1-t16.h | 99 ----------------------- hwdef-gchart-fet1-t1616.h | 99 +++++++++++++++++++++++ spaghetti-monster/anduril/MODELS | 2 +- spaghetti-monster/anduril/cfg-gchart-fet1-t16.h | 34 -------- spaghetti-monster/anduril/cfg-gchart-fet1-t1616.h | 34 ++++++++ 5 files changed, 134 insertions(+), 134 deletions(-) delete mode 100644 hwdef-gchart-fet1-t16.h create mode 100644 hwdef-gchart-fet1-t1616.h delete mode 100644 spaghetti-monster/anduril/cfg-gchart-fet1-t16.h create mode 100644 spaghetti-monster/anduril/cfg-gchart-fet1-t1616.h diff --git a/hwdef-gchart-fet1-t16.h b/hwdef-gchart-fet1-t16.h deleted file mode 100644 index e8fd11c..0000000 --- a/hwdef-gchart-fet1-t16.h +++ /dev/null @@ -1,99 +0,0 @@ -#ifndef HWDEF_GCH_FET1_T16_H -#define HWDEF_GCH_FET1_T16_H - -/* gChart's custom FET+1 driver layout - -PB0 - PWM for FET (TCA - WO0) -PB1 - PWM for 7135 (TCA - WO1) -PB2 - Switch pin, internal pullup -PB3 - Aux LED with 4700 Ohm series resistor -Read voltage from VCC pin, has diode with ~0.4v drop - -*/ - - -#define LAYOUT_DEFINED - -#ifdef ATTINY -#undef ATTINY -#endif -#define ATTINY 1616 -#include - -#define PWM_CHANNELS 2 - -#ifndef SWITCH_PIN -#define SWITCH_PIN PIN2_bp -#define SWITCH_PORT VPORTB.IN -#define SWITCH_ISC_REG PORTB.PIN2CTRL -#define SWITCH_VECT PORTB_PORT_vect -#define SWITCH_INTFLG VPORTB.INTFLAGS -#endif - - -// 7135 channel -#ifndef PWM1_PIN -#define PWM1_PIN PB1 // -#define PWM1_LVL TCA0.SINGLE.CMP1 // CMP1 is the output compare register for PB1 -#endif - -// FET channel -#ifndef PWM2_PIN -#define PWM2_PIN PB0 // -#define PWM2_LVL TCA0.SINGLE.CMP0 // CMP0 is the output compare register for PB0 -#endif - -// average drop across diode on this hardware -#ifndef VOLTAGE_FUDGE_FACTOR -#define VOLTAGE_FUDGE_FACTOR 8 // 4 = add 0.20V -#endif - - -// lighted button -#ifndef AUXLED_PIN -#define AUXLED_PIN PIN3_bp -#define AUXLED_PORT PORTB -#endif - - -// with so many pins, doing this all with #ifdefs gets awkward... -// ... so just hardcode it in each hwdef file instead -inline void hwdef_setup() { - - // set up the system clock to run at 5 MHz instead of the default 3.33 MHz - _PROTECTED_WRITE( CLKCTRL.MCLKCTRLB, CLKCTRL_PDIV_4X_gc | CLKCTRL_PEN_bm ); - - //VPORTA.DIR = 0b00000010; - VPORTB.DIR = PIN0_bm | PIN1_bm | PIN3_bm; - //VPORTC.DIR = 0b00000000; - - // enable pullups on the input pins to reduce power - PORTA.PIN0CTRL = PORT_PULLUPEN_bm; - PORTA.PIN1CTRL = PORT_PULLUPEN_bm; - PORTA.PIN2CTRL = PORT_PULLUPEN_bm; - PORTA.PIN3CTRL = PORT_PULLUPEN_bm; - PORTA.PIN4CTRL = PORT_PULLUPEN_bm; - PORTA.PIN5CTRL = PORT_PULLUPEN_bm; - PORTA.PIN6CTRL = PORT_PULLUPEN_bm; - PORTA.PIN7CTRL = PORT_PULLUPEN_bm; - - //PORTB.PIN0CTRL = PORT_PULLUPEN_bm; // FET channel - //PORTB.PIN1CTRL = PORT_PULLUPEN_bm; // 7135 channel - PORTB.PIN2CTRL = PORT_PULLUPEN_bm | PORT_ISC_BOTHEDGES_gc; // switch - //PORTB.PIN3CTRL = PORT_PULLUPEN_bm; // Aux LED - PORTB.PIN4CTRL = PORT_PULLUPEN_bm; - PORTB.PIN5CTRL = PORT_PULLUPEN_bm; - - PORTC.PIN0CTRL = PORT_PULLUPEN_bm; - PORTC.PIN1CTRL = PORT_PULLUPEN_bm; - PORTC.PIN2CTRL = PORT_PULLUPEN_bm; - PORTC.PIN3CTRL = PORT_PULLUPEN_bm; - - // set up the PWM - TCA0.SINGLE.CTRLB = TCA_SINGLE_CMP0EN_bm | TCA_SINGLE_CMP1EN_bm | TCA_SINGLE_WGMODE_SINGLESLOPE_gc; - TCA0.SINGLE.PER = 255; - TCA0.SINGLE.CTRLA = TCA_SINGLE_CLKSEL_DIV1_gc | TCA_SINGLE_ENABLE_bm; -} - - -#endif diff --git a/hwdef-gchart-fet1-t1616.h b/hwdef-gchart-fet1-t1616.h new file mode 100644 index 0000000..43255d8 --- /dev/null +++ b/hwdef-gchart-fet1-t1616.h @@ -0,0 +1,99 @@ +#ifndef HWDEF_GCH_FET1_T1616_H +#define HWDEF_GCH_FET1_T1616_H + +/* gChart's custom FET+1 driver layout + +PB0 - PWM for FET (TCA - WO0) +PB1 - PWM for 7135 (TCA - WO1) +PB2 - Switch pin, internal pullup +PB3 - Aux LED with 4700 Ohm series resistor +Read voltage from VCC pin, has diode with ~0.4v drop + +*/ + + +#define LAYOUT_DEFINED + +#ifdef ATTINY +#undef ATTINY +#endif +#define ATTINY 1616 +#include + +#define PWM_CHANNELS 2 + +#ifndef SWITCH_PIN +#define SWITCH_PIN PIN2_bp +#define SWITCH_PORT VPORTB.IN +#define SWITCH_ISC_REG PORTB.PIN2CTRL +#define SWITCH_VECT PORTB_PORT_vect +#define SWITCH_INTFLG VPORTB.INTFLAGS +#endif + + +// 7135 channel +#ifndef PWM1_PIN +#define PWM1_PIN PB1 // +#define PWM1_LVL TCA0.SINGLE.CMP1 // CMP1 is the output compare register for PB1 +#endif + +// FET channel +#ifndef PWM2_PIN +#define PWM2_PIN PB0 // +#define PWM2_LVL TCA0.SINGLE.CMP0 // CMP0 is the output compare register for PB0 +#endif + +// average drop across diode on this hardware +#ifndef VOLTAGE_FUDGE_FACTOR +#define VOLTAGE_FUDGE_FACTOR 8 // 4 = add 0.20V +#endif + + +// lighted button +#ifndef AUXLED_PIN +#define AUXLED_PIN PIN3_bp +#define AUXLED_PORT PORTB +#endif + + +// with so many pins, doing this all with #ifdefs gets awkward... +// ... so just hardcode it in each hwdef file instead +inline void hwdef_setup() { + + // set up the system clock to run at 5 MHz instead of the default 3.33 MHz + _PROTECTED_WRITE( CLKCTRL.MCLKCTRLB, CLKCTRL_PDIV_4X_gc | CLKCTRL_PEN_bm ); + + //VPORTA.DIR = 0b00000010; + VPORTB.DIR = PIN0_bm | PIN1_bm | PIN3_bm; + //VPORTC.DIR = 0b00000000; + + // enable pullups on the input pins to reduce power + PORTA.PIN0CTRL = PORT_PULLUPEN_bm; + PORTA.PIN1CTRL = PORT_PULLUPEN_bm; + PORTA.PIN2CTRL = PORT_PULLUPEN_bm; + PORTA.PIN3CTRL = PORT_PULLUPEN_bm; + PORTA.PIN4CTRL = PORT_PULLUPEN_bm; + PORTA.PIN5CTRL = PORT_PULLUPEN_bm; + PORTA.PIN6CTRL = PORT_PULLUPEN_bm; + PORTA.PIN7CTRL = PORT_PULLUPEN_bm; + + //PORTB.PIN0CTRL = PORT_PULLUPEN_bm; // FET channel + //PORTB.PIN1CTRL = PORT_PULLUPEN_bm; // 7135 channel + PORTB.PIN2CTRL = PORT_PULLUPEN_bm | PORT_ISC_BOTHEDGES_gc; // switch + //PORTB.PIN3CTRL = PORT_PULLUPEN_bm; // Aux LED + PORTB.PIN4CTRL = PORT_PULLUPEN_bm; + PORTB.PIN5CTRL = PORT_PULLUPEN_bm; + + PORTC.PIN0CTRL = PORT_PULLUPEN_bm; + PORTC.PIN1CTRL = PORT_PULLUPEN_bm; + PORTC.PIN2CTRL = PORT_PULLUPEN_bm; + PORTC.PIN3CTRL = PORT_PULLUPEN_bm; + + // set up the PWM + TCA0.SINGLE.CTRLB = TCA_SINGLE_CMP0EN_bm | TCA_SINGLE_CMP1EN_bm | TCA_SINGLE_WGMODE_SINGLESLOPE_gc; + TCA0.SINGLE.PER = 255; + TCA0.SINGLE.CTRLA = TCA_SINGLE_CLKSEL_DIV1_gc | TCA_SINGLE_ENABLE_bm; +} + + +#endif 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 85a7115dea0082468d72883587209a33dddeddd0 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Thu, 1 Apr 2021 22:01:28 -0600 Subject: minor formatting cleanup on t1616 hwdef files --- hwdef-BLF_Q8-T1616.h | 19 ++++++++++--------- hwdef-Sofirn_SP10S.h | 20 +++++++++++--------- hwdef-gchart-fet1-t1616.h | 19 ++++++++++--------- 3 files changed, 31 insertions(+), 27 deletions(-) diff --git a/hwdef-BLF_Q8-T1616.h b/hwdef-BLF_Q8-T1616.h index 6dfb4ab..2a0e6ff 100644 --- a/hwdef-BLF_Q8-T1616.h +++ b/hwdef-BLF_Q8-T1616.h @@ -24,7 +24,7 @@ Driver pinout: #define PWM_CHANNELS 2 #ifndef SWITCH_PIN -#define SWITCH_PIN PIN5_bp +#define SWITCH_PIN PIN5_bp #define SWITCH_PORT VPORTA.IN #define SWITCH_ISC_REG PORTA.PIN2CTRL #define SWITCH_VECT PORTA_PORT_vect @@ -34,13 +34,13 @@ Driver pinout: // 7135 channel #ifndef PWM1_PIN -#define PWM1_PIN PB1 // +#define PWM1_PIN PB1 // #define PWM1_LVL TCA0.SINGLE.CMP1 // CMP1 is the output compare register for PB1 #endif // FET channel #ifndef PWM2_PIN -#define PWM2_PIN PB0 // +#define PWM2_PIN PB0 // #define PWM2_LVL TCA0.SINGLE.CMP0 // CMP0 is the output compare register for PB0 #endif @@ -61,8 +61,8 @@ Driver pinout: // ... so just hardcode it in each hwdef file instead inline void hwdef_setup() { - // set up the system clock to run at 5 MHz instead of the default 3.33 MHz - _PROTECTED_WRITE( CLKCTRL.MCLKCTRLB, CLKCTRL_PDIV_4X_gc | CLKCTRL_PEN_bm ); + // set up the system clock to run at 5 MHz instead of the default 3.33 MHz + _PROTECTED_WRITE( CLKCTRL.MCLKCTRLB, CLKCTRL_PDIV_4X_gc | CLKCTRL_PEN_bm ); //VPORTA.DIR = ...; VPORTB.DIR = PIN0_bm | PIN1_bm | PIN5_bm; // Outputs: Aux LED and PWMs @@ -77,20 +77,21 @@ inline void hwdef_setup() { PORTA.PIN5CTRL = PORT_PULLUPEN_bm | PORT_ISC_BOTHEDGES_gc; // eSwitch PORTA.PIN6CTRL = PORT_PULLUPEN_bm; PORTA.PIN7CTRL = PORT_PULLUPEN_bm; - + //PORTB.PIN0CTRL = PORT_PULLUPEN_bm; // FET channel //PORTB.PIN1CTRL = PORT_PULLUPEN_bm; // 7135 channel PORTB.PIN2CTRL = PORT_PULLUPEN_bm; PORTB.PIN3CTRL = PORT_PULLUPEN_bm; PORTB.PIN4CTRL = PORT_PULLUPEN_bm; //PORTB.PIN5CTRL = PORT_PULLUPEN_bm; // Aux LED - + PORTC.PIN0CTRL = PORT_PULLUPEN_bm; PORTC.PIN1CTRL = PORT_PULLUPEN_bm; PORTC.PIN2CTRL = PORT_PULLUPEN_bm; PORTC.PIN3CTRL = PORT_PULLUPEN_bm; - - // set up the PWM + + // set up the PWM + // TODO: add references to MCU documentation TCA0.SINGLE.CTRLB = TCA_SINGLE_CMP0EN_bm | TCA_SINGLE_CMP1EN_bm | TCA_SINGLE_WGMODE_SINGLESLOPE_gc; TCA0.SINGLE.PER = 255; TCA0.SINGLE.CTRLA = TCA_SINGLE_CLKSEL_DIV1_gc | TCA_SINGLE_ENABLE_bm; diff --git a/hwdef-Sofirn_SP10S.h b/hwdef-Sofirn_SP10S.h index 75d79a1..0ee3332 100644 --- a/hwdef-Sofirn_SP10S.h +++ b/hwdef-Sofirn_SP10S.h @@ -1,6 +1,8 @@ #ifndef HWDEF_SOFIRN_SP10S_H #define HWDEF_SOFIRN_SP10S_H +// TODO: rename to sofirn-sp10s-gchart? + /* gChart's PIC12 to ATTINY1616 v1 adapter for the SP10S https://oshpark.com/shared_projects/b4IZEGSy @@ -34,7 +36,7 @@ ATTINY1616 Mapping: #include #ifndef SWITCH_PIN -#define SWITCH_PIN 3 +#define SWITCH_PIN 3 #define SWITCH_PORT VPORTB.IN #define SWITCH_ISC_REG PORTB.PIN3CTRL #define SWITCH_VECT PORTB_PORT_vect @@ -81,14 +83,13 @@ ATTINY1616 Mapping: // ... so just hardcode it in each hwdef file instead inline void hwdef_setup() { - // set up the system clock to run at 5 MHz instead of the default 3.33 MHz - _PROTECTED_WRITE( CLKCTRL.MCLKCTRLB, CLKCTRL_PDIV_4X_gc | CLKCTRL_PEN_bm ); + // set up the system clock to run at 5 MHz instead of the default 3.33 MHz + _PROTECTED_WRITE( CLKCTRL.MCLKCTRLB, CLKCTRL_PDIV_4X_gc | CLKCTRL_PEN_bm ); VPORTA.DIR = PIN1_bm; // Boost enable pin VPORTB.DIR = PIN0_bm | PIN5_bm; // PWM pins as output //VPORTC.DIR = ...; - // enable pullups on the input pins to reduce power PORTA.PIN0CTRL = PORT_PULLUPEN_bm; //PORTA.PIN1CTRL = PORT_PULLUPEN_bm; // Boost enable pin @@ -98,21 +99,22 @@ inline void hwdef_setup() { PORTA.PIN5CTRL = PORT_PULLUPEN_bm; PORTA.PIN6CTRL = PORT_PULLUPEN_bm; PORTA.PIN7CTRL = PORT_PULLUPEN_bm; - + //PORTB.PIN0CTRL = PORT_PULLUPEN_bm; // Big PWM channel PORTB.PIN1CTRL = PORT_PULLUPEN_bm; PORTB.PIN2CTRL = PORT_PULLUPEN_bm; PORTB.PIN3CTRL = PORT_PULLUPEN_bm | PORT_ISC_BOTHEDGES_gc; // Switch //PORTB.PIN4CTRL = PORT_PULLUPEN_bm; // Voltage divider //PORTB.PIN5CTRL = PORT_PULLUPEN_bm; // Small PWM channel - + //PORTC.PIN0CTRL = PORT_PULLUPEN_bm; connected to the ADC via airwire PORTC.PIN1CTRL = PORT_PULLUPEN_bm; PORTC.PIN2CTRL = PORT_PULLUPEN_bm; PORTC.PIN3CTRL = PORT_PULLUPEN_bm; - - // set up the PWM - PORTMUX.CTRLC = PORTMUX_TCA02_ALTERNATE_gc; // Use alternate pin for TCA0:WO2 + + // set up the PWM + // TODO: add references to MCU documentation + PORTMUX.CTRLC = PORTMUX_TCA02_ALTERNATE_gc; // Use alternate pin for TCA0:WO2 TCA0.SINGLE.CTRLB = TCA_SINGLE_CMP0EN_bm | TCA_SINGLE_CMP2EN_bm | TCA_SINGLE_WGMODE_SINGLESLOPE_gc; TCA0.SINGLE.PER = 255; TCA0.SINGLE.CTRLA = TCA_SINGLE_CLKSEL_DIV1_gc | TCA_SINGLE_ENABLE_bm; diff --git a/hwdef-gchart-fet1-t1616.h b/hwdef-gchart-fet1-t1616.h index 43255d8..3d41951 100644 --- a/hwdef-gchart-fet1-t1616.h +++ b/hwdef-gchart-fet1-t1616.h @@ -23,7 +23,7 @@ Read voltage from VCC pin, has diode with ~0.4v drop #define PWM_CHANNELS 2 #ifndef SWITCH_PIN -#define SWITCH_PIN PIN2_bp +#define SWITCH_PIN PIN2_bp #define SWITCH_PORT VPORTB.IN #define SWITCH_ISC_REG PORTB.PIN2CTRL #define SWITCH_VECT PORTB_PORT_vect @@ -33,13 +33,13 @@ Read voltage from VCC pin, has diode with ~0.4v drop // 7135 channel #ifndef PWM1_PIN -#define PWM1_PIN PB1 // +#define PWM1_PIN PB1 // #define PWM1_LVL TCA0.SINGLE.CMP1 // CMP1 is the output compare register for PB1 #endif // FET channel #ifndef PWM2_PIN -#define PWM2_PIN PB0 // +#define PWM2_PIN PB0 // #define PWM2_LVL TCA0.SINGLE.CMP0 // CMP0 is the output compare register for PB0 #endif @@ -60,8 +60,8 @@ Read voltage from VCC pin, has diode with ~0.4v drop // ... so just hardcode it in each hwdef file instead inline void hwdef_setup() { - // set up the system clock to run at 5 MHz instead of the default 3.33 MHz - _PROTECTED_WRITE( CLKCTRL.MCLKCTRLB, CLKCTRL_PDIV_4X_gc | CLKCTRL_PEN_bm ); + // set up the system clock to run at 5 MHz instead of the default 3.33 MHz + _PROTECTED_WRITE( CLKCTRL.MCLKCTRLB, CLKCTRL_PDIV_4X_gc | CLKCTRL_PEN_bm ); //VPORTA.DIR = 0b00000010; VPORTB.DIR = PIN0_bm | PIN1_bm | PIN3_bm; @@ -76,20 +76,21 @@ inline void hwdef_setup() { PORTA.PIN5CTRL = PORT_PULLUPEN_bm; PORTA.PIN6CTRL = PORT_PULLUPEN_bm; PORTA.PIN7CTRL = PORT_PULLUPEN_bm; - + //PORTB.PIN0CTRL = PORT_PULLUPEN_bm; // FET channel //PORTB.PIN1CTRL = PORT_PULLUPEN_bm; // 7135 channel PORTB.PIN2CTRL = PORT_PULLUPEN_bm | PORT_ISC_BOTHEDGES_gc; // switch //PORTB.PIN3CTRL = PORT_PULLUPEN_bm; // Aux LED PORTB.PIN4CTRL = PORT_PULLUPEN_bm; PORTB.PIN5CTRL = PORT_PULLUPEN_bm; - + PORTC.PIN0CTRL = PORT_PULLUPEN_bm; PORTC.PIN1CTRL = PORT_PULLUPEN_bm; PORTC.PIN2CTRL = PORT_PULLUPEN_bm; PORTC.PIN3CTRL = PORT_PULLUPEN_bm; - - // set up the PWM + + // set up the PWM + // TODO: add references to MCU documentation TCA0.SINGLE.CTRLB = TCA_SINGLE_CMP0EN_bm | TCA_SINGLE_CMP1EN_bm | TCA_SINGLE_WGMODE_SINGLESLOPE_gc; TCA0.SINGLE.PER = 255; TCA0.SINGLE.CTRLA = TCA_SINGLE_CLKSEL_DIV1_gc | TCA_SINGLE_ENABLE_bm; -- 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(-) 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 eb1c72b72bc663239ae229eae8c5c05ca4846a1d Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Thu, 1 Apr 2021 23:16:58 -0600 Subject: added attiny1616 flashing instructions, and made flash-tiny1616.sh configurable via environment variables --- README | 35 +++++++++++++++++++++++++++++++++-- bin/flash-tiny1616.sh | 13 ++++++++++++- 2 files changed, 45 insertions(+), 3 deletions(-) diff --git a/README b/README index 324e489..816475b 100644 --- a/README +++ b/README @@ -131,10 +131,41 @@ working. - Set ATTINY_DFP=/path/to/where/you/unzipped/the/pack (either in your shell, or in this repo's bin/build.sh script) - + + export ATTINY_DFP=$HOME/src/torches/atmel/attiny-dfp + - Make sure you're using gcc-avr 1:5.4.0+Atmel3.6.2 or newer. 3.6.1 will not work. It gives errors like: /usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: address 0x80381e of anduril.elf section `.data' is not within region `data' This requires debian/bullseye or newer; buster has 3.6.1. - + This should at least allow the code to compile. + +Some extra steps are also needed to make flashing (avrdude) work: + + - Get an AVR jtag2 device. + The one I'm using is: "HWAYEH AVR JTAG ICE Version 2.0" + Connect the cables: + - GND = - + - Vtref = + + - nSRST = R (reset/UPDI) + + - Flash the jtag2 device with the relevant firmware: + https://github.com/ElTangas/jtag2updi/tree/master/tools/avrjtagicev2 + + - Get an avrdude.conf which supports jtag2updi: + + - Download avrdude.conf from https://github.com/ElTangas/jtag2updi + and put it in /etc + + - Or grab the source and set an environment variable: + + cd ~/src/torches/avrdude + git clone https://github.com/ElTangas/jtag2updi + export AVRDUDE_CONF="-C$HOME/src/torches/avrdude/jtag2updi/avrdude.conf" + + - Maybe configure which USB serial port to use too: + export AVRDUDE_TTYUSB="/dev/ttyUSB2" + +Afterward, flashing should work. You may need to unplug and replug the jtag2 +USB device between uses though, since it may stop responding after each use. diff --git a/bin/flash-tiny1616.sh b/bin/flash-tiny1616.sh index 31c8406..44d716c 100755 --- a/bin/flash-tiny1616.sh +++ b/bin/flash-tiny1616.sh @@ -1,3 +1,14 @@ #/bin/sh FIRMWARE=$1 -avrdude -c jtag2updi -P /dev/ttyUSB0 -p t1616 -u -Uflash:w:$FIRMWARE \ No newline at end of file +if [ -z "$AVRDUDE_TTYUSB" ]; then AVRDUDE_TTYUSB=/dev/ttyUSB0 ; fi + +# In your shell config: +# from https://github.com/ElTangas/jtag2updi ... +# export AVRDUDE_CONF="-C$HOME/path/to/jtag2updi/avrdude.conf" +# export AVRDUDE_TTYUSB="/dev/ttyUSB2" + +avrdude $AVRDUDE_CONF \ + -c jtag2updi \ + -P $AVRDUDE_TTYUSB \ + -p t1616 \ + -u -Uflash:w:$FIRMWARE -- cgit v1.2.3 From a3b9184af454f85da688e8975e248c69418bca02 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Fri, 2 Apr 2021 14:07:02 -0600 Subject: need to do some measurements sometime to determine if fast or phase-correct PWM is better on t1616 --- hwdef-gchart-fet1-t1616.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hwdef-gchart-fet1-t1616.h b/hwdef-gchart-fet1-t1616.h index 3d41951..365ecd7 100644 --- a/hwdef-gchart-fet1-t1616.h +++ b/hwdef-gchart-fet1-t1616.h @@ -91,6 +91,9 @@ inline void hwdef_setup() { // set up the PWM // TODO: add references to MCU documentation + // TODO: measure 5 MHz fast PWM vs 10 MHz phase-correct, to see if it + // still has issues at 0/255 and 255/255 like older models did + // (and maybe switch to phase-correct@10MHz) TCA0.SINGLE.CTRLB = TCA_SINGLE_CMP0EN_bm | TCA_SINGLE_CMP1EN_bm | TCA_SINGLE_WGMODE_SINGLESLOPE_gc; TCA0.SINGLE.PER = 255; TCA0.SINGLE.CTRLA = TCA_SINGLE_CLKSEL_DIV1_gc | TCA_SINGLE_ENABLE_bm; -- 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(+) 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(-) 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(-) 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(-) 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