diff options
Diffstat (limited to 'fsm')
| -rw-r--r-- | fsm/eeprom.c | 8 | ||||
| -rw-r--r-- | fsm/eeprom.h | 8 |
2 files changed, 12 insertions, 4 deletions
diff --git a/fsm/eeprom.c b/fsm/eeprom.c index 8f8bd67..436a736 100644 --- a/fsm/eeprom.c +++ b/fsm/eeprom.c @@ -14,7 +14,7 @@ uint8_t eeprom[EEPROM_BYTES]; #endif uint8_t load_eeprom() { - #if defined(LED_ENABLE_PIN) || defined(LED2_ENABLE_PIN) + #ifdef USE_EEP_DELAY delay_4ms(2); // wait for power to stabilize #endif @@ -32,7 +32,7 @@ uint8_t load_eeprom() { } void save_eeprom() { - #if defined(LED_ENABLE_PIN) || defined(LED2_ENABLE_PIN) + #ifdef USE_EEP_DELAY delay_4ms(2); // wait for power to stabilize #endif @@ -54,7 +54,7 @@ uint8_t eeprom_wl[EEPROM_WL_BYTES]; uint8_t * eep_wl_prev_offset; uint8_t load_eeprom_wl() { - #if defined(LED_ENABLE_PIN) || defined(LED2_ENABLE_PIN) + #ifdef USE_EEP_DELAY delay_4ms(2); // wait for power to stabilize #endif @@ -83,7 +83,7 @@ uint8_t load_eeprom_wl() { } void save_eeprom_wl() { - #if defined(LED_ENABLE_PIN) || defined(LED2_ENABLE_PIN) + #ifdef USE_EEP_DELAY delay_4ms(2); // wait for power to stabilize #endif diff --git a/fsm/eeprom.h b/fsm/eeprom.h index 1e10fd2..d5f0363 100644 --- a/fsm/eeprom.h +++ b/fsm/eeprom.h @@ -55,3 +55,11 @@ // if this marker isn't found, the eeprom is assumed to be blank #define EEP_MARKER 0b10100101 +// wait a few ms before eeprom operations, to wait for power to stabilize +// (otherwise reads or writes can get corrupt data) +// (not necessary on some hardware, +// but enabled by default when there's space) +#if defined(LED_ENABLE_PIN) || defined(LED2_ENABLE_PIN) || (ROM_SIZE > 10000) + #define USE_EEP_DELAY +#endif + |
