Skip to content

Commit bab91ed

Browse files
committed
Fix missing EEPROM waveform read
1 parent 46f092d commit bab91ed

2 files changed

Lines changed: 17 additions & 5 deletions

File tree

examples/Inkplate10/Diagnostics/Inkplate10_Factory_Programming_VCOM/Inkplate10_Factory_Programming_VCOM.ino

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,11 @@
6464
// Create object on Inkplate library and set library to work in monochrome mode
6565
Inkplate display(INKPLATE_1BIT);
6666

67-
// We only store: provision marker + waveform number for UI / reselection.
68-
// Driver stores the actual VCOM and waveform data internally.
69-
int EEPROM_PROVISION_MARKER_ADDR = 0; // 170 => provisioned
70-
int EEPROM_WAVEFORM_NUM_ADDR = 1; // 1..5
67+
// Provision marker and waveform number for factory flow.
68+
// Addresses 0-75 are occupied by the waveformData struct written by setWaveform();
69+
// the marker and waveform number must live beyond that range to avoid collisions.
70+
int EEPROM_PROVISION_MARKER_ADDR = 76; // 170 => provisioned
71+
int EEPROM_WAVEFORM_NUM_ADDR = 77; // 1..5
7172

7273
// Peripheral mode variables and arrays (kept from original)
7374
#define BUFFER_SIZE 1000

src/boards/Inkplate10/Inkplate10Driver.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,21 @@ int EPDDriver::initDriver(Inkplate *_inkplatePtr)
9999
return 0;
100100
}
101101

102+
// Load the 3-bit waveform stored in EEPROM during factory programming before
103+
// calculating LUTs, so the LUTs are built from the correct waveform.
104+
// Falls back to the compiled-in default if EEPROM data is absent or corrupt.
105+
EEPROM.begin(512);
106+
struct waveformData waveformEEPROM;
107+
if (getWaveformFromEEPROM(&waveformEEPROM) &&
108+
waveformEEPROM.waveformId >= INKPLATE10_WAVEFORM1 &&
109+
waveformEEPROM.waveformId <= INKPLATE10_WAVEFORM5)
110+
{
111+
memcpy(waveform3Bit, waveformEEPROM.waveform, sizeof(waveform3Bit));
112+
}
113+
102114
// Calculate color LUTs to optimize drawing to the screen
103115
calculateLUTs();
104116

105-
106117
_beginDone = 1;
107118
return 1;
108119
}

0 commit comments

Comments
 (0)