aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hwdef-Sofirn_SP10-Pro.h18
-rw-r--r--hwdef-thefreeman-lin16dac.h2
-rw-r--r--spaghetti-monster/anduril/cfg-sofirn-sp10-pro.h15
-rw-r--r--spaghetti-monster/fsm-ramping.c39
4 files changed, 40 insertions, 34 deletions
diff --git a/hwdef-Sofirn_SP10-Pro.h b/hwdef-Sofirn_SP10-Pro.h
index 7d0d7f5..e47131a 100644
--- a/hwdef-Sofirn_SP10-Pro.h
+++ b/hwdef-Sofirn_SP10-Pro.h
@@ -53,7 +53,7 @@ PA1 : Boost Enable
#define LED_ENABLE_PIN PIN1_bp
#define LED_ENABLE_PORT PORTA_OUT
-#define LED_DISABLE_DELAY 4
+#define LED_OFF_DELAY 4
#define USE_VOLTAGE_DIVIDER // use a dedicated pin, not VCC, because VCC input is flattened
#define DUAL_VOLTAGE_FLOOR 21 // for AA/14500 boost drivers, don't indicate low voltage if below this level
@@ -122,4 +122,20 @@ inline void hwdef_setup() {
}
+// set fuses, these carry over to the ELF file but not the HEX file
+// we need this for enabling BOD in Active Mode from the factory.
+// settings can be verified / dumped from the ELF file using this
+// command: avr-objdump -d -S -j .fuse anduril.elf
+FUSES = {
+ .WDTCFG = FUSE_WDTCFG_DEFAULT, /* Watchdog Configuration */
+ .BODCFG = FUSE_ACTIVE0_bm, /* BOD Configuration */
+ .OSCCFG = FUSE_OSCCFG_DEFAULT, /* Oscillator Configuration */
+ .TCD0CFG = FUSE_TCD0CFG_DEFAULT, /* TCD0 Configuration */
+ .SYSCFG0 = FUSE_SYSCFG0_DEFAULT, /* System Configuration 0 */
+ .SYSCFG1 = FUSE_SYSCFG1_DEFAULT, /* System Configuration 1 */
+ .APPEND = FUSE_APPEND_DEFAULT, /* Application Code Section End */
+ .BOOTEND = FUSE_BOOTEND_DEFAULT, /* Boot Section End */
+};
+
+
#endif
diff --git a/hwdef-thefreeman-lin16dac.h b/hwdef-thefreeman-lin16dac.h
index adb7886..9d6b145 100644
--- a/hwdef-thefreeman-lin16dac.h
+++ b/hwdef-thefreeman-lin16dac.h
@@ -47,7 +47,7 @@ Read voltage from VCC pin, has PFET so no drop
// For turning on and off the op-amp
#define LED2_ENABLE_PIN PIN7_bp
#define LED2_ENABLE_PORT PORTA_OUT
-#define LED2_ENABLE_DELAY 80 // how many ms to delay turning on the lights after enabling the channel
+#define LED2_ON_DELAY 80 // how many ms to delay turning on the lights after enabling the channel
// average drop across diode on this hardware
#ifndef VOLTAGE_FUDGE_FACTOR
diff --git a/spaghetti-monster/anduril/cfg-sofirn-sp10-pro.h b/spaghetti-monster/anduril/cfg-sofirn-sp10-pro.h
index a3463ae..bcfc80e 100644
--- a/spaghetti-monster/anduril/cfg-sofirn-sp10-pro.h
+++ b/spaghetti-monster/anduril/cfg-sofirn-sp10-pro.h
@@ -71,18 +71,3 @@
// enable factory reset on 13H without loosening tailcap
#define USE_SOFT_FACTORY_RESET
-
-// set fuses, these carry over to the ELF file but not the HEX file
-// we need this for enabling BOD in Active Mode from the factory.
-// settings can be verified / dumped from the ELF file using this
-// command: avr-objdump -d -S -j .fuse anduril.elf
-FUSES = {
- .WDTCFG = FUSE_WDTCFG_DEFAULT, /* Watchdog Configuration */
- .BODCFG = FUSE_ACTIVE0_bm, /* BOD Configuration */
- .OSCCFG = FUSE_OSCCFG_DEFAULT, /* Oscillator Configuration */
- .TCD0CFG = FUSE_TCD0CFG_DEFAULT, /* TCD0 Configuration */
- .SYSCFG0 = FUSE_SYSCFG0_DEFAULT, /* System Configuration 0 */
- .SYSCFG1 = FUSE_SYSCFG1_DEFAULT, /* System Configuration 1 */
- .APPEND = FUSE_APPEND_DEFAULT, /* Application Code Section End */
- .BOOTEND = FUSE_BOOTEND_DEFAULT, /* Boot Section End */
-}; \ No newline at end of file
diff --git a/spaghetti-monster/fsm-ramping.c b/spaghetti-monster/fsm-ramping.c
index 2e6901d..ade49b7 100644
--- a/spaghetti-monster/fsm-ramping.c
+++ b/spaghetti-monster/fsm-ramping.c
@@ -93,9 +93,10 @@ void set_level(uint8_t level) {
TINT1_LVL = 0;
TINT2_LVL = 0;
#endif
- // for drivers with a slow regulator chip (eg, boost converter, delay before turning off to prevent flashes
- #ifdef LED_DISABLE_DELAY
- delay_4ms(LED_DISABLE_DELAY/4);
+ #ifdef LED_OFF_DELAY
+ // for drivers with a slow regulator chip (eg, boost converter),
+ // delay before turning off to prevent flashes
+ delay_4ms(LED_OFF_DELAY/4);
#endif
// disable the power channel, if relevant
#ifdef LED_ENABLE_PIN
@@ -108,10 +109,10 @@ void set_level(uint8_t level) {
// enable the power channel, if relevant
#ifndef USE_TINT_RAMPING // update_tint handles this better
#ifdef LED_ENABLE_PIN
- #ifdef LED_ENABLE_DELAY
+ #ifdef LED_ON_DELAY
uint8_t led_enable_port_save = LED_ENABLE_PORT;
#endif
-
+
#ifndef LED_ENABLE_PIN_LEVEL_MIN
LED_ENABLE_PORT |= (1 << LED_ENABLE_PIN);
#else
@@ -122,24 +123,28 @@ void set_level(uint8_t level) {
else // disable during other parts of the ramp
LED_ENABLE_PORT &= ~(1 << LED_ENABLE_PIN);
#endif
-
- // for drivers with a slow regulator chip (eg, boost converter, delay before lighting up to prevent flashes
- #ifdef LED_ENABLE_DELAY
- if (LED_ENABLE_PORT != led_enable_port_save) // only delay if the pin status changed
- delay_4ms(LED_ENABLE_DELAY/4);
+
+ // for drivers with a slow regulator chip (eg, boost converter),
+ // delay before lighting up to prevent flashes
+ #ifdef LED_ON_DELAY
+ // only delay if the pin status changed
+ if (LED_ENABLE_PORT != led_enable_port_save)
+ delay_4ms(LED_ON_DELAY/4);
#endif
#endif
#ifdef LED2_ENABLE_PIN
- #ifdef LED2_ENABLE_DELAY
+ #ifdef LED2_ON_DELAY
uint8_t led2_enable_port_save = LED2_ENABLE_PORT;
#endif
-
+
LED2_ENABLE_PORT |= (1 << LED2_ENABLE_PIN);
-
- // for drivers with a slow regulator chip (eg, boost converter, delay before lighting up to prevent flashes
- #ifdef LED2_ENABLE_DELAY
- if (LED2_ENABLE_PORT != led2_enable_port_save) // only delay if the pin status changed
- delay_4ms(LED2_ENABLE_DELAY/4);
+
+ // for drivers with a slow regulator chip (eg, boost converter),
+ // delay before lighting up to prevent flashes
+ #ifdef LED2_ON_DELAY
+ // only delay if the pin status changed
+ if (LED2_ENABLE_PORT != led2_enable_port_save)
+ delay_4ms(LED2_ON_DELAY/4);
#endif
#endif
#endif // ifndef USE_TINT_RAMPING