|
|
@ -101,7 +101,7 @@ void EEPROMSettings::ignoreHardcodedLayers(bool value) {
|
|
|
|
void EEPROMSettings::seal(void) {
|
|
|
|
void EEPROMSettings::seal(void) {
|
|
|
|
sealed_ = true;
|
|
|
|
sealed_ = true;
|
|
|
|
|
|
|
|
|
|
|
|
CRC.finalize();
|
|
|
|
CRCCalculator.finalize();
|
|
|
|
|
|
|
|
|
|
|
|
if (settings_.version != VERSION_CURRENT) {
|
|
|
|
if (settings_.version != VERSION_CURRENT) {
|
|
|
|
is_valid_ = false;
|
|
|
|
is_valid_ = false;
|
|
|
@ -109,9 +109,9 @@ void EEPROMSettings::seal(void) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (settings_.crc == 0xffff) {
|
|
|
|
if (settings_.crc == 0xffff) {
|
|
|
|
settings_.crc = CRC.crc;
|
|
|
|
settings_.crc = CRCCalculator.crc;
|
|
|
|
update();
|
|
|
|
update();
|
|
|
|
} else if (settings_.crc != CRC.crc) {
|
|
|
|
} else if (settings_.crc != CRCCalculator.crc) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -134,7 +134,7 @@ uint16_t EEPROMSettings::requestSlice(uint16_t size) {
|
|
|
|
uint16_t start = next_start_;
|
|
|
|
uint16_t start = next_start_;
|
|
|
|
next_start_ += size;
|
|
|
|
next_start_ += size;
|
|
|
|
|
|
|
|
|
|
|
|
CRC.update((const void *)&size, sizeof(size));
|
|
|
|
CRCCalculator.update((const void *)&size, sizeof(size));
|
|
|
|
|
|
|
|
|
|
|
|
return start;
|
|
|
|
return start;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -159,7 +159,7 @@ EventHandlerResult FocusSettingsCommand::onFocusEvent(const char *command) {
|
|
|
|
DEFAULT_LAYER,
|
|
|
|
DEFAULT_LAYER,
|
|
|
|
IS_VALID,
|
|
|
|
IS_VALID,
|
|
|
|
GET_VERSION,
|
|
|
|
GET_VERSION,
|
|
|
|
CRC,
|
|
|
|
GET_CRC,
|
|
|
|
} sub_command;
|
|
|
|
} sub_command;
|
|
|
|
|
|
|
|
|
|
|
|
if (::Focus.handleHelp(command, PSTR("settings.defaultLayer\nsettings.valid?\nsettings.version\nsettings.crc")))
|
|
|
|
if (::Focus.handleHelp(command, PSTR("settings.defaultLayer\nsettings.valid?\nsettings.version\nsettings.crc")))
|
|
|
@ -175,7 +175,7 @@ EventHandlerResult FocusSettingsCommand::onFocusEvent(const char *command) {
|
|
|
|
else if (strcmp_P(command + 9, PSTR("version")) == 0)
|
|
|
|
else if (strcmp_P(command + 9, PSTR("version")) == 0)
|
|
|
|
sub_command = GET_VERSION;
|
|
|
|
sub_command = GET_VERSION;
|
|
|
|
else if (strcmp_P(command + 9, PSTR("crc")) == 0)
|
|
|
|
else if (strcmp_P(command + 9, PSTR("crc")) == 0)
|
|
|
|
sub_command = CRC;
|
|
|
|
sub_command = GET_CRC;
|
|
|
|
else
|
|
|
|
else
|
|
|
|
return EventHandlerResult::OK;
|
|
|
|
return EventHandlerResult::OK;
|
|
|
|
|
|
|
|
|
|
|
@ -196,8 +196,8 @@ EventHandlerResult FocusSettingsCommand::onFocusEvent(const char *command) {
|
|
|
|
case GET_VERSION:
|
|
|
|
case GET_VERSION:
|
|
|
|
::Focus.send(::EEPROMSettings.version());
|
|
|
|
::Focus.send(::EEPROMSettings.version());
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case CRC:
|
|
|
|
case GET_CRC:
|
|
|
|
::Focus.sendRaw(::CRC.crc, F("/"), ::EEPROMSettings.crc());
|
|
|
|
::Focus.sendRaw(::CRCCalculator.crc, F("/"), ::EEPROMSettings.crc());
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|