@@ -119,11 +119,15 @@ bool DisplayHardware::beginEPD(
119
119
// Validate mode is a correct EPD mode
120
120
if (config->mode == wippersnapper_display_v1_EPDMode_EPD_MODE_UNSPECIFIED) {
121
121
WS_DEBUG_PRINTLN (" [display] Unsupported EPD mode!" );
122
- return false ; // Unsupported mode
122
+ return false ;
123
123
}
124
124
125
- // TODO: If we already have a display driver assigned to this hardware
126
- // instance, clean it up!
125
+ // If we already have a display driver assigned to this hardware instance,
126
+ // clean it up!
127
+ if (_drvDisp) {
128
+ delete _drvDisp;
129
+ _drvDisp = nullptr ;
130
+ }
127
131
128
132
// Parse all SPI bus pins
129
133
// Check length
@@ -154,16 +158,21 @@ bool DisplayHardware::beginEPD(
154
158
busy = (int16_t )atoi (spi_config->pin_busy + 1 );
155
159
}
156
160
157
- // TODO: Configure SPI bus selection (UNUSED AS OF RIGHT NOW)
161
+ // Configure SPI bus
162
+ if (spi_config->bus != 0 ) {
163
+ WS_DEBUG_PRINTLN (
164
+ " [display] ERROR: Non-default SPI buses are currently not supported!" );
165
+ return false ;
166
+ }
158
167
159
- // For "magtag" component name, attempt to autodetect the driver
168
+ // For "magtag" component name, attempt to autodetect the driver type
160
169
if (strncmp (_name, " magtag" , 6 ) == 0 ) {
161
170
if (detect_ssd1680 (cs, dc, rst)) {
162
171
// Detected SSD1680, use EAAMFGN driver
163
172
strncpy (_name, " thinkink-gs4-eaamfgn" , sizeof (_name) - 1 );
164
173
_name[sizeof (_name) - 1 ] = ' \0 ' ;
165
174
} else {
166
- // Did not detect SSD1680, use T5 driver
175
+ // Did not detect SSD1680, use IL0373 driver
167
176
strncpy (_name, " thinkink-gs4-t5" , sizeof (_name) - 1 );
168
177
_name[sizeof (_name) - 1 ] = ' \0 ' ;
169
178
}
@@ -205,11 +214,9 @@ const char *DisplayHardware::getName() { return _name; }
205
214
The message to display.
206
215
*/
207
216
void DisplayHardware::writeMessage (const char *message) {
208
- if (_drvDisp) {
209
- _drvDisp->writeMessage (message);
210
- } else {
211
- WS_DEBUG_PRINTLN (" [display] No display driver initialized!" );
212
- }
217
+ if (!_drvDisp)
218
+ return ;
219
+ _drvDisp->writeMessage (message);
213
220
}
214
221
215
222
/* !
0 commit comments