Close



Page 1 of 2 12 LastLast
Results 1 to 10 of 16
  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.

  2. #2
    Engineer-in-Training
    Join Date
    Jun 2014
    Posts
    349
    So to understand the EEPROM default functioning better, what it does normally is give priority to the EEPROM ?

  3. #3
    Super Moderator Roxy's Avatar
    Join Date
    Apr 2014
    Location
    Lone Star State
    Posts
    2,182
    Quote Originally Posted by 3DPBuser View Post
    So to understand the EEPROM default functioning better, what it does normally is give priority to the EEPROM ?
    Your question does not make sense. But if this code is added to the firmware and used, it will invalidate the EEPROM contents. When Marlin initializes, it will use the default values defined in the Configuration.h file instead of using the stored values in the EEPROM.

  4. #4
    Engineer-in-Training
    Join Date
    Jun 2014
    Posts
    349
    So the default is for Marlin to boot to the EEPROM, and your code makes it not do this and use the C.h instead.

  5. #5
    Super Moderator Roxy's Avatar
    Join Date
    Apr 2014
    Location
    Lone Star State
    Posts
    2,182
    If the EEPROM is enabled, Marlin always attempts to read its settings from the EEPROM. This code invalidates the settings stored in EEPROM. So even though Marlin is checking the EEPROM for the information, Marlin decides the information is invalid and does not use it. Marlin then falls back to using the values defined in Configuration.h

  6. #6
    Engineer-in-Training
    Join Date
    Jun 2014
    Posts
    349
    But doesn't Marlin normally use C.h if eeprom is not enabled?

  7. #7
    Super Moderator Roxy's Avatar
    Join Date
    Apr 2014
    Location
    Lone Star State
    Posts
    2,182
    If the EEPROM is disabled... The values will come from Configuration.h

  8. #8
    Student
    Join Date
    Aug 2017
    Location
    Yorkshire, UK
    Posts
    9
    Hi, first post from a new member. I realise this thread is old but I'm using Marlin 1.1.4 and I was wondering if this EEprom Invalidator is still valid and/or even necessary. It could explain why I am having trouble changing my Z-steps. I have one of those cheap Chinese printers from Amazon, a great introducer to 3D printing as you have to learn fast in order to get anything printed.

  9. #9
    Staff Engineer Roberts_Clif's Avatar
    Join Date
    Jun 2017
    Location
    Washington State, USA
    Posts
    1,141
    Add Roberts_Clif on Thingiverse
    Hello

    I look in the
    G-Code and M-Code Grand Master List

    M499 is not on the list.

    https://softsolder.com/2013/03/14/g-...d-master-list/

  10. #10
    Student
    Join Date
    Aug 2017
    Location
    Yorkshire, UK
    Posts
    9
    Ah well, keep soldiering on😋. I'll sort it eventually no doubt. Thanks for the master list link, that will be very useful. I'll just keep practicing my G's and M's until I get more fluent.

Page 1 of 2 12 LastLast

Posting Permissions

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