Ender 3 V2 BL24C16 EEPROM support (#18758)
This commit is contained in:
@ -58,11 +58,47 @@ void GcodeSuite::M502() {
|
||||
#endif // !DISABLE_M503
|
||||
|
||||
#if ENABLED(EEPROM_SETTINGS)
|
||||
|
||||
#if ENABLED(MARLIN_DEV_MODE)
|
||||
#include "../../libs/hex_print_routines.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* M504: Validate EEPROM Contents
|
||||
*/
|
||||
void GcodeSuite::M504() {
|
||||
#if ENABLED(MARLIN_DEV_MODE)
|
||||
const bool dowrite = parser.seenval('W');
|
||||
if (dowrite || parser.seenval('R')) {
|
||||
uint8_t val = 0;
|
||||
int addr = parser.value_ushort();
|
||||
if (dowrite) {
|
||||
val = parser.byteval('V');
|
||||
persistentStore.write_data(addr, &val);
|
||||
SERIAL_ECHOLNPAIR("Wrote address ", addr, " with ", int(val));
|
||||
}
|
||||
else {
|
||||
if (parser.seenval('T')) {
|
||||
const int endaddr = parser.value_ushort();
|
||||
while (addr <= endaddr) {
|
||||
persistentStore.read_data(addr, &val);
|
||||
SERIAL_ECHOLNPAIR("0x", hex_word(addr), ":", hex_byte(val));
|
||||
addr++;
|
||||
safe_delay(10);
|
||||
}
|
||||
SERIAL_EOL();
|
||||
}
|
||||
else {
|
||||
persistentStore.read_data(addr, &val);
|
||||
SERIAL_ECHOLNPAIR("Read address ", addr, " and got ", int(val));
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (settings.validate())
|
||||
SERIAL_ECHO_MSG("EEPROM OK");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user