aboutsummaryrefslogtreecommitdiff
path: root/spaghetti-monster/fsm-eeprom.c
diff options
context:
space:
mode:
authorSelene ToyKeeper2020-04-27 18:44:49 -0600
committerSelene ToyKeeper2020-04-27 18:44:49 -0600
commit1b28816bd972d3de733c581fa2243add24b73779 (patch)
treee967c0b02760f0afdeba1f0f2e0840149f434da3 /spaghetti-monster/fsm-eeprom.c
parentadded a noFET build for D4v2, by request (diff)
parentcalibrated K1 and K1-12V thermal response (smaller, slower) and candle mode (... (diff)
downloadanduril-1b28816bd972d3de733c581fa2243add24b73779.tar.gz
anduril-1b28816bd972d3de733c581fa2243add24b73779.tar.bz2
anduril-1b28816bd972d3de733c581fa2243add24b73779.zip
merged Noctigon KR4 and K1-12V (XHP35) branches
(also includes some minor thermal updates to make it faster, more stable, and easier to tweak per host) (and some code to prevent eeprom corruption while turning power chips on/off) (and enables reboot function on tiny1634) (and makes rainbow aux RGB mode speed configurable per host) (and calibrates the original K1 a bit better)
Diffstat (limited to 'spaghetti-monster/fsm-eeprom.c')
-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;