Skip to content

Commit 19bcb77

Browse files
committed
πŸ§‘β€πŸ’» Fix D5 warning
1 parent fb5a595 commit 19bcb77

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

β€ŽMarlin/src/gcode/gcode_d.cpp

+6-5
Original file line numberDiff line numberDiff line change
@@ -156,20 +156,21 @@ void GcodeSuite::D(const int16_t dcode) {
156156
} break;
157157

158158
case 5: { // D5 Read / Write onboard Flash
159-
#define FLASH_SIZE 1024
159+
// This will overwrite program and data, so don't use it.
160+
#define ONBOARD_FLASH_SIZE 1024 // 0x400
160161
uint8_t *pointer = parser.hex_adr_val('A');
161162
uint16_t len = parser.ushortval('C', 1);
162163
uintptr_t addr = (uintptr_t)pointer;
163-
NOMORE(addr, size_t(FLASH_SIZE - 1));
164-
NOMORE(len, FLASH_SIZE - addr);
164+
NOMORE(addr, size_t(ONBOARD_FLASH_SIZE - 1));
165+
NOMORE(len, ONBOARD_FLASH_SIZE - addr);
165166
if (parser.seenval('X')) {
166167
// TODO: Write the hex bytes after the X
167168
//while (len--) {}
168169
}
169170
else {
170171
//while (len--) {
171-
//// TODO: Read bytes from EEPROM
172-
// print_hex_byte(eeprom_read_byte(adr++));
172+
//// TODO: Read bytes from FLASH
173+
// print_hex_byte(flash_read_byte(adr++));
173174
//}
174175
SERIAL_EOL();
175176
}

0 commit comments

Comments
Β (0)