Skip to content

Commit a039081

Browse files
committed
🧑‍💻 Fix ONBOARD_FLASH_SIZE
1 parent 3334582 commit a039081

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Marlin/src/gcode/gcode_d.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,16 @@ void GcodeSuite::D(const int16_t dcode) {
156156
} break;
157157

158158
case 5: { // D5 Read / Write onboard Flash
159-
#define FLASH_SIZE 1024
159+
#ifdef MARLIN_EEPROM_SIZE
160+
#define ONBOARD_FLASH_SIZE MARLIN_EEPROM_SIZE
161+
#else
162+
#define ONBOARD_FLASH_SIZE 1024 // 0x400
163+
#endif
160164
uint8_t *pointer = parser.hex_adr_val('A');
161165
uint16_t len = parser.ushortval('C', 1);
162166
uintptr_t addr = (uintptr_t)pointer;
163-
NOMORE(addr, size_t(FLASH_SIZE - 1));
164-
NOMORE(len, FLASH_SIZE - addr);
167+
NOMORE(addr, size_t(ONBOARD_FLASH_SIZE - 1));
168+
NOMORE(len, ONBOARD_FLASH_SIZE - addr);
165169
if (parser.seenval('X')) {
166170
// TODO: Write the hex bytes after the X
167171
//while (len--) {}

0 commit comments

Comments
 (0)