aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Hart2022-01-05 09:09:50 -0600
committerGabriel Hart2022-01-05 09:09:50 -0600
commit3bfa5f1065bce68e637be0b09089921577e88ce7 (patch)
tree0d612045bd29355a63cc790a08fea583a568be2e
parentExperimental: add optional delay when using LED_ENABLE_PIN to avoid flashes o... (diff)
downloadanduril-3bfa5f1065bce68e637be0b09089921577e88ce7.tar.gz
anduril-3bfa5f1065bce68e637be0b09089921577e88ce7.tar.bz2
anduril-3bfa5f1065bce68e637be0b09089921577e88ce7.zip
Experimental: add optional delay when using LED_ENABLE_PIN to avoid flashes of light (this time for LED2_ENABLE pin)
-rw-r--r--hwdef-thefreeman-lin16dac.h3
-rw-r--r--spaghetti-monster/anduril/version.h2
-rw-r--r--spaghetti-monster/fsm-ramping.c12
3 files changed, 13 insertions, 4 deletions
diff --git a/hwdef-thefreeman-lin16dac.h b/hwdef-thefreeman-lin16dac.h
index 77b9ee0..adb7886 100644
--- a/hwdef-thefreeman-lin16dac.h
+++ b/hwdef-thefreeman-lin16dac.h
@@ -43,12 +43,11 @@ Read voltage from VCC pin, has PFET so no drop
#define LED_ENABLE_PORT PORTB_OUT
#define LED_ENABLE_PIN_LEVEL_MIN 35
#define LED_ENABLE_PIN_LEVEL_MAX 150
-#define LED_ENABLE_DELAY 80 // how many ms to delay turning on the lights after enabling the channel
// 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
// average drop across diode on this hardware
#ifndef VOLTAGE_FUDGE_FACTOR
diff --git a/spaghetti-monster/anduril/version.h b/spaghetti-monster/anduril/version.h
index ff0abc7..c67379c 100644
--- a/spaghetti-monster/anduril/version.h
+++ b/spaghetti-monster/anduril/version.h
@@ -1 +1 @@
-#define VERSION_NUMBER "20220104"
+#define VERSION_NUMBER "20220105"
diff --git a/spaghetti-monster/fsm-ramping.c b/spaghetti-monster/fsm-ramping.c
index 89e1f13..6bb2390 100644
--- a/spaghetti-monster/fsm-ramping.c
+++ b/spaghetti-monster/fsm-ramping.c
@@ -125,7 +125,17 @@ void set_level(uint8_t level) {
#endif
#endif
#ifdef LED2_ENABLE_PIN
- LED2_ENABLE_PORT |= (1 << LED2_ENABLE_PIN);
+ #ifdef LED2_ENABLE_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);
+ #endif
#endif
// PWM array index = level - 1