Optimise power_on and power_off

eeprom_update_byte only updates the EEPROM if the value is different

Saves 40 bytes of flash memory
This commit is contained in:
Guðni Már Gilbert 2022-08-19 23:01:02 +00:00 committed by D.R.racer
parent 0d64cfa2e5
commit bac3168ca4
1 changed files with 2 additions and 8 deletions

View File

@ -12,18 +12,12 @@ namespace MMU2 {
// so we just block the MMU via EEPROM var instead.
void power_on()
{
if (!eeprom_read_byte((uint8_t *)EEPROM_MMU_ENABLED))
{
eeprom_update_byte((uint8_t *)EEPROM_MMU_ENABLED, true);
}
eeprom_update_byte((uint8_t *)EEPROM_MMU_ENABLED, true);
}
void power_off()
{
if (eeprom_read_byte((uint8_t *)EEPROM_MMU_ENABLED))
{
eeprom_update_byte((uint8_t *)EEPROM_MMU_ENABLED, false);
}
eeprom_update_byte((uint8_t *)EEPROM_MMU_ENABLED, false);
}
void reset() {