Results 1 to 10 of 16
Thread: M499 - EEPROM Invalidate Command
-
11-05-2014, 04:56 PM #1
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() {}
#endifLast edited by Roxy; 11-06-2014 at 03:27 PM.
-
09-12-2015, 05:04 AM #2
- Join Date
- Jun 2014
- Posts
- 349
So to understand the EEPROM default functioning better, what it does normally is give priority to the EEPROM ?
-
09-12-2015, 10:36 AM #3
-
09-12-2015, 10:38 PM #4
- 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.
-
09-13-2015, 09:03 AM #5
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
-
09-15-2015, 07:54 AM #6
- Join Date
- Jun 2014
- Posts
- 349
But doesn't Marlin normally use C.h if eeprom is not enabled?
-
09-15-2015, 11:12 AM #7
If the EEPROM is disabled... The values will come from Configuration.h
-
08-09-2017, 02:27 PM #8
- 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.
-
08-09-2017, 06:00 PM #9
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/
-
08-10-2017, 03:23 PM #10
- 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.
Ender 3v2 poor printing quality
10-28-2024, 09:08 AM in Tips, Tricks and Tech Help