소스 검색

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 년 전
부모
커밋
bac3168ca4
1개의 변경된 파일2개의 추가작업 그리고 8개의 파일을 삭제
  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.
 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() {