Close



Results 1 to 10 of 16

Threaded View

  1. #1
    Super Moderator Roxy's Avatar
    Join Date
    Apr 2014
    Location
    Lone Star State
    Posts
    2,182

    M499 - EEPROM Invalidate Command

    Some people are enabling Auto Bed Leveling but having bad values in their EEPROM that screw everything up. I wrote a small piece of firmware to invalidate the EEPROM so the setting are not taken from it unless you actually do an implicit store to the EEPROM. I think the original authors of Marlin were trying to save a little firmware space and did not include it. But if you are making changes to your Configuration.h file, it gets annoying having to load the default settings and save them each time. Its easier to just invalidate the EEPROM once (with a M499) and never mess with the EEPROM again until you want to use that feature:

    In Marlin_Main.cpp: (Probably it makes sense to put this right in front of the 'case 500:' with the other EEPROM commands)

    case 499: // Invalidate the M500 Store settings in EEPROM command
    {
    Invalidate_EEPROM_Settings(); // Roxy added function to guarintee we are using
    // the default values defined in the firmware!
    }
    break;

    In ConfigurationStore.cpp:

    void Invalidate_EEPROM_Settings()
    {
    char bogus_ver[4] = "xyz";
    char confirmation[4] = "???";
    int i=EEPROM_OFFSET;

    EEPROM_WRITE_VAR(i,bogus_ver); // Put a bogus version # into the EEPROM. Marlin will realize it can't trust the stored values and ignore them.

    i=EEPROM_OFFSET;
    EEPROM_READ_VAR(i,confirmation); //read stored version

    if (strncmp(bogus_ver, confirmation,3) == 0)
    SERIAL_PROTOCOLLNPGM("EEPROM Settings invalidated.");
    else {
    SERIAL_PROTOCOLLNPGM("EEPROM Settings not invalidated.");
    SERIAL_PROTOCOLPGM("Read Version: [");
    SERIAL_PROTOCOL(confirmation);
    SERIAL_PROTOCOLLNPGM("]\n");
    }
    }

    In ConfigurationStore.h: (Find this code block and add the Invalidate_EEPROM_Settings() declarations)
    #ifdef EEPROM_SETTINGS
    void Config_StoreSettings();
    void Config_RetrieveSettings();
    void Invalidate_EEPROM_Settings(); // Roxy routine to guarantee we are using default firmware values
    #else
    FORCE_INLINE void Config_StoreSettings() {}
    FORCE_INLINE void Config_RetrieveSettings() { Config_ResetDefault(); Config_PrintSettings(); }
    FORCE_INLINE void Invalidate_EEPROM_Settings() {}
    #endif
    Last edited by Roxy; 11-06-2014 at 03:27 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •