Fix EEPROM save load

This commit is contained in:
Dejvino 2026-03-01 14:18:33 +01:00
parent 14ac4401ce
commit 8cc8898c01

View File

@ -109,7 +109,7 @@ void setupUI() {
display.display();
// Initialize EEPROM
EEPROM.begin(1024);
EEPROM.begin(2048);
// Check for safety clear (Button held on startup)
if (digitalRead(PIN_ENC_SW) == LOW) {
@ -320,13 +320,13 @@ void checkSerial() {
}
} else if (state == 1) { // Count
elementCount = b;
if (1 + elementCount * 5 > sizeof(buffer)) {
if (1 + elementCount * 5 + 1 > sizeof(buffer)) {
state = 0;
bufferIdx = 0;
Serial.println(F("ERROR: Grid too large"));
} else {
buffer[bufferIdx++] = b;
state = 2;
state = (elementCount == 0) ? 3 : 2;
}
} else if (state == 2) { // Data
buffer[bufferIdx++] = b;