Ver código fonte

Optimise power_on and power_off

eeprom_update_byte only updates the EEPROM if the value is different

Saves 40 bytes of flash memory
Guðni Már Gilbert 2 anos atrás
pai
commit
bac3168ca4
1 arquivos alterados com 2 adições e 8 exclusões
  1. 2 8
      Firmware/mmu2_power.cpp

+ 2 - 8
Firmware/mmu2_power.cpp

@@ -12,18 +12,12 @@ namespace MMU2 {
 // so we just block the MMU via EEPROM var instead.
 // so we just block the MMU via EEPROM var instead.
 void power_on()
 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()
 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() {
 void reset() {