aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSelene ToyKeeper2020-03-21 21:03:42 -0600
committerSelene ToyKeeper2020-03-21 21:03:42 -0600
commit52c58c46f7c9c7aced3a5eb174c88d444a6d8a57 (patch)
tree9d8662ce2f5243b0c78676e95c3debc0ca965f6a
parentenabled soft factory reset on KR4, raised default floor to the lowest reliabl... (diff)
downloadanduril-52c58c46f7c9c7aced3a5eb174c88d444a6d8a57.tar.gz
anduril-52c58c46f7c9c7aced3a5eb174c88d444a6d8a57.tar.bz2
anduril-52c58c46f7c9c7aced3a5eb174c88d444a6d8a57.zip
fixed potential eeprom corruption after turning boost/opamp chip on/off
(some boost chips can make power unstable for a few ms, so we have to wait before accessing eeprom)
-rw-r--r--spaghetti-monster/fsm-eeprom.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/spaghetti-monster/fsm-eeprom.c b/spaghetti-monster/fsm-eeprom.c
index 277e2b2..77352cf 100644
--- a/spaghetti-monster/fsm-eeprom.c
+++ b/spaghetti-monster/fsm-eeprom.c
@@ -30,6 +30,10 @@ uint8_t eeprom[EEPROM_BYTES];
#endif
uint8_t load_eeprom() {
+ #ifdef LED_ENABLE_PIN
+ delay_4ms(2); // wait for power to stabilize
+ #endif
+
cli();
// check if eeprom has been initialized; abort if it hasn't
uint8_t marker = eeprom_read_byte((uint8_t *)EEP_START);
@@ -44,6 +48,10 @@ uint8_t load_eeprom() {
}
void save_eeprom() {
+ #ifdef LED_ENABLE_PIN
+ delay_4ms(2); // wait for power to stabilize
+ #endif
+
cli();
// save the actual data
@@ -62,6 +70,10 @@ uint8_t eeprom_wl[EEPROM_WL_BYTES];
EEP_OFFSET_T eep_wl_prev_offset;
uint8_t load_eeprom_wl() {
+ #ifdef LED_ENABLE_PIN
+ delay_4ms(2); // wait for power to stabilize
+ #endif
+
cli();
// check if eeprom has been initialized; abort if it hasn't
uint8_t found = 0;
@@ -87,6 +99,10 @@ uint8_t load_eeprom_wl() {
}
void save_eeprom_wl() {
+ #ifdef LED_ENABLE_PIN
+ delay_4ms(2); // wait for power to stabilize
+ #endif
+
cli();
// erase old state
EEP_OFFSET_T offset = eep_wl_prev_offset;
If you find this content useful please consider a small donation via bitcoin: bitcoin:1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2?amount=0.001&message=Donation Scraping git contents via cgit is very resource intensive. The continued hosting of these git repositories is entirely financed by your bitcoin contributions. For donations of a least 1 mBTC you include your IP address in the message of your bitcoin donation. This will remove this message in the future for requests from your IP, which will significantly reduce token usage. In any case, any contributions to bitcoin address 1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2 are very welcome. Thanks in advance for you contribution to a self-sustaining ecosystem.