Skip to content

Commit df785e4

Browse files
committed
Add conditional check for epd mode
1 parent 07ad6ad commit df785e4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/components/display/hardware.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,18 +216,22 @@ bool DisplayHardware::beginEPD(
216216
// For MagTag "Generic" display component, attempt to auto-detect SSD1680 EPD
217217
if (strncmp(_name, "eink-magtag", 13) == 0) {
218218
if (detect_ssd1680(cs, dc, rst)) {
219-
WS_DEBUG_PRINTLN("[display] Detected SSD1680 EPD driver");
220219
*driver =
221220
wippersnapper_display_v1_DisplayDriver_DISPLAY_DRIVER_EPD_SSD1680;
222221
config->mode = wippersnapper_display_v1_EPDMode_EPD_MODE_MONO;
223222
} else {
224-
WS_DEBUG_PRINTLN("[display] Detected ILI0373 EPD driver");
225223
*driver =
226224
wippersnapper_display_v1_DisplayDriver_DISPLAY_DRIVER_EPD_ILI0373;
227225
config->mode = wippersnapper_display_v1_EPDMode_EPD_MODE_GRAYSCALE4;
228226
}
229227
}
230228

229+
// Validate mode
230+
if (config->mode == wippersnapper_display_v1_EPDMode_EPD_MODE_UNSPECIFIED) {
231+
WS_DEBUG_PRINTLN("[display] ERROR: EPD mode is unspecified!");
232+
return false;
233+
}
234+
231235
// Create display driver object using the factory function
232236
_drvDisp = CreateDrvDispEpd(*driver, dc, rst, cs, srcs, busy);
233237
if (!_drvDisp) {

0 commit comments

Comments
 (0)