|
|
|
@ -218,6 +218,7 @@ void setup() |
|
|
|
|
Serial.println(F("<setup end>")); |
|
|
|
|
|
|
|
|
|
#if defined (DEBUG) && defined (SHOW_CPU_LOAD_MSEC) |
|
|
|
|
Serial.println(); |
|
|
|
|
show_cpu_and_mem_usage(); |
|
|
|
|
cpu_mem_millis = 0; |
|
|
|
|
#endif |
|
|
|
@ -456,6 +457,37 @@ void set_master_volume(uint8_t value) |
|
|
|
|
EEPROM HELPER |
|
|
|
|
******************************************************************************/ |
|
|
|
|
|
|
|
|
|
void config_from_eeprom(void) |
|
|
|
|
{ |
|
|
|
|
uint32_t checksum; |
|
|
|
|
config_t tmp_conf; |
|
|
|
|
|
|
|
|
|
EEPROM_readAnything(EEPROM_CONFIGURATIONS + sizeof(config_t) * (sound - 1), tmp_conf); |
|
|
|
|
checksum = crc32((byte*)&tmp_conf + 4, sizeof(tmp_conf) - 4); |
|
|
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.print(F("EEPROM checksum: 0x")); |
|
|
|
|
Serial.print(tmp_conf.checksum, HEX); |
|
|
|
|
Serial.print(F(" / 0x")); |
|
|
|
|
Serial.print(checksum, HEX); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
if (checksum == tmp_conf.checksum) |
|
|
|
|
{ |
|
|
|
|
EEPROM_readAnything(EEPROM_CONFIGURATIONS + sizeof(config_t) * (sound - 1), configuration); |
|
|
|
|
Serial.print(F(" - OK, loading config ")); |
|
|
|
|
Serial.print(sound,DEC); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.println(F(" - mismatch (or force) -> nothing done!")); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.println(); |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void initial_values_from_eeprom(void) |
|
|
|
|
{ |
|
|
|
|
uint32_t checksum; |
|
|
|
@ -488,6 +520,8 @@ void initial_values_from_eeprom(void) |
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.print(F(" - Master volume: ")); |
|
|
|
|
Serial.println(master_volume, DEC); |
|
|
|
|
Serial.print(F("Max configs in EEPROM: ")); |
|
|
|
|
Serial.println(MAX_SOUNDS); |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|