Procházet zdrojové kódy

Move string to progmem

flash: -84B
RAM: -4B
Alex Voinea před 2 roky
rodič
revize
bba5385a61
1 změnil soubory, kde provedl 2 přidání a 2 odebrání
  1. 2 2
      Firmware/ConfigurationStore.cpp

+ 2 - 2
Firmware/ConfigurationStore.cpp

@@ -215,10 +215,10 @@ static bool is_uninitialized(void* addr, uint8_t len)
 bool Config_RetrieveSettings()
 {
   bool previous_settings_retrieved = true;
-    char ver[4]=EEPROM_VERSION;
+    static const char ver[4] PROGMEM = EEPROM_VERSION;
     eeprom_read_block(reinterpret_cast<uint8_t*>(cs.version), reinterpret_cast<uint8_t*>(EEPROM_M500_base->version), sizeof(cs.version));
     //  SERIAL_ECHOLN("Version: [" << ver << "] Stored version: [" << cs.version << "]");
-    if (strncmp(ver,cs.version,3) == 0)  // version number match
+    if (strncmp_P(ver, cs.version, sizeof(EEPROM_VERSION)) == 0)  // version number match
     {
         eeprom_read_block(reinterpret_cast<uint8_t*>(&cs), reinterpret_cast<uint8_t*>(EEPROM_M500_base), sizeof(cs));
         calculate_extruder_multipliers();