@@ -208,6 +208,7 @@ static int getRotation() {return 2;}
208
208
static const int WIDTH = SSD1306_LCDWIDTH ;
209
209
static const int HEIGHT = SSD1306_LCDHEIGHT ;
210
210
static int8_t _i2caddr , _vccstate ;
211
+ static bool display_responding = true;
211
212
212
213
// the most basic function, set a single pixel
213
214
void SSD1306_drawPixel (int16_t x , int16_t y , uint16_t color ) {
@@ -340,6 +341,11 @@ void SSD1306_invertDisplay(uint8_t i) {
340
341
#include "nrf_log_ctrl.h"
341
342
void SSD1306_command (uint8_t c )
342
343
{
344
+ if (!display_responding )
345
+ {
346
+ // Do not attempt to communicate with the display
347
+ return ;
348
+ }
343
349
ret_code_t ret ;
344
350
static uint8_t data [2 ] = {0 };
345
351
data [1 ] = c ;
@@ -348,8 +354,8 @@ void SSD1306_command(uint8_t c)
348
354
{
349
355
NRF_LOG_INFO ("SSD1306_command twi failed with: %d" , ret );
350
356
NRF_LOG_FLUSH ();
357
+ display_responding = false;
351
358
}
352
- APP_ERROR_CHECK (ret );
353
359
}
354
360
355
361
// startscrollright
@@ -442,6 +448,11 @@ void SSD1306_dim(bool dim) {
442
448
}
443
449
444
450
void SSD1306_display (void ) {
451
+ if (!display_responding )
452
+ {
453
+ // Do not attempt to communicate with the display
454
+ return ;
455
+ }
445
456
SSD1306_command (SSD1306_COLUMNADDR );
446
457
SSD1306_command (0 ); // Column start address (0 = reset)
447
458
SSD1306_command (SSD1306_LCDWIDTH - 1 ); // Column end address (127 = reset)
0 commit comments