gcode_D EEPROM size, cleanup
Fixes #19920 Co-Authored-By: Orel <37673727+0r31@users.noreply.github.com>
This commit is contained in:
parent
3dbe4ac593
commit
2774b70fbf
@ -54,9 +54,7 @@
|
||||
size_t total = persistentStore.capacity();
|
||||
int pos = 0;
|
||||
const uint8_t value = 0x0;
|
||||
while(total--) {
|
||||
persistentStore.write_data(pos, &value, 1);
|
||||
}
|
||||
while (total--) persistentStore.write_data(pos, &value, 1);
|
||||
persistentStore.access_finish();
|
||||
#else
|
||||
settings.reset();
|
||||
@ -70,7 +68,7 @@
|
||||
uint8_t *pointer = parser.hex_adr_val('A');
|
||||
uint16_t len = parser.ushortval('C', 1);
|
||||
uintptr_t addr = (uintptr_t)pointer;
|
||||
NOMORE(addr, (size_t)(SRAM_SIZE - 1));
|
||||
NOMORE(addr, size_t(SRAM_SIZE - 1));
|
||||
NOMORE(len, SRAM_SIZE - addr);
|
||||
if (parser.seenval('X')) {
|
||||
// Write the hex bytes after the X
|
||||
@ -91,11 +89,8 @@
|
||||
uint8_t *pointer = parser.hex_adr_val('A');
|
||||
uint16_t len = parser.ushortval('C', 1);
|
||||
uintptr_t addr = (uintptr_t)pointer;
|
||||
#ifndef MARLIN_EEPROM_SIZE
|
||||
#define MARLIN_EEPROM_SIZE size_t(E2END + 1)
|
||||
#endif
|
||||
NOMORE(addr, (size_t)(MARLIN_EEPROM_SIZE - 1));
|
||||
NOMORE(len, MARLIN_EEPROM_SIZE - addr);
|
||||
NOMORE(addr, size_t(persistentStore.capacity() - 1));
|
||||
NOMORE(len, persistentStore.capacity() - addr);
|
||||
if (parser.seenval('X')) {
|
||||
uint16_t val = parser.hex_val('X');
|
||||
#if ENABLED(EEPROM_SETTINGS)
|
||||
@ -111,23 +106,18 @@
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
while (len--) {
|
||||
// Read bytes from EEPROM
|
||||
#if ENABLED(EEPROM_SETTINGS)
|
||||
persistentStore.access_start();
|
||||
uint8_t val;
|
||||
while(len--) {
|
||||
int pos = 0;
|
||||
if (!persistentStore.read_data(pos, (uint8_t *)&val, sizeof(val))) {
|
||||
print_hex_byte(val);
|
||||
}
|
||||
}
|
||||
uint8_t val;
|
||||
while (len--) if (!persistentStore.read_data(pos, &val, 1)) print_hex_byte(val);
|
||||
SERIAL_EOL();
|
||||
persistentStore.access_finish();
|
||||
#else
|
||||
SERIAL_ECHOLNPGM("NO EEPROM");
|
||||
len = 0;
|
||||
#endif
|
||||
}
|
||||
SERIAL_EOL();
|
||||
}
|
||||
} break;
|
||||
@ -156,7 +146,7 @@
|
||||
uint8_t *pointer = parser.hex_adr_val('A');
|
||||
uint16_t len = parser.ushortval('C', 1);
|
||||
uintptr_t addr = (uintptr_t)pointer;
|
||||
NOMORE(addr, (size_t)(FLASH_SIZE - 1));
|
||||
NOMORE(addr, size_t(FLASH_SIZE - 1));
|
||||
NOMORE(len, FLASH_SIZE - addr);
|
||||
if (parser.seenval('X')) {
|
||||
// TODO: Write the hex bytes after the X
|
||||
|
Loading…
Reference in New Issue
Block a user