diff options
| author | Gabriel Hart | 2022-01-04 16:56:37 -0600 |
|---|---|---|
| committer | Gabriel Hart | 2022-01-04 16:56:37 -0600 |
| commit | a01a27d8d2562e08baf7a58a76fc90670cdc2c4e (patch) | |
| tree | 8540c84dc361037bbb62c3a0f7a317f575af5f2f | |
| parent | Merge TKs changes through her commit 628 (diff) | |
| download | anduril-a01a27d8d2562e08baf7a58a76fc90670cdc2c4e.tar.gz anduril-a01a27d8d2562e08baf7a58a76fc90670cdc2c4e.tar.bz2 anduril-a01a27d8d2562e08baf7a58a76fc90670cdc2c4e.zip | |
Experimental: add optional delay when using LED_ENABLE_PIN to avoid flashes of light
| -rw-r--r-- | hwdef-thefreeman-lin16dac.h | 1 | ||||
| -rw-r--r-- | spaghetti-monster/anduril/version.h | 2 | ||||
| -rw-r--r-- | spaghetti-monster/fsm-ramping.c | 10 |
3 files changed, 12 insertions, 1 deletions
diff --git a/hwdef-thefreeman-lin16dac.h b/hwdef-thefreeman-lin16dac.h index 0999c4c..77b9ee0 100644 --- a/hwdef-thefreeman-lin16dac.h +++ b/hwdef-thefreeman-lin16dac.h @@ -43,6 +43,7 @@ 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 diff --git a/spaghetti-monster/anduril/version.h b/spaghetti-monster/anduril/version.h index 7560ef2..ff0abc7 100644 --- a/spaghetti-monster/anduril/version.h +++ b/spaghetti-monster/anduril/version.h @@ -1 +1 @@ -#define VERSION_NUMBER "20211029" +#define VERSION_NUMBER "20220104" diff --git a/spaghetti-monster/fsm-ramping.c b/spaghetti-monster/fsm-ramping.c index 05c2e0e..89e1f13 100644 --- a/spaghetti-monster/fsm-ramping.c +++ b/spaghetti-monster/fsm-ramping.c @@ -103,6 +103,10 @@ void set_level(uint8_t level) { } else { // enable the power channel, if relevant #ifdef LED_ENABLE_PIN + #ifdef LED_ENABLE_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 @@ -113,6 +117,12 @@ 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); + #endif #endif #ifdef LED2_ENABLE_PIN LED2_ENABLE_PORT |= (1 << LED2_ENABLE_PIN); |
