Don't send data if display is disconnected
Otherwise, we're waiting 1s on pretty much any call to the display. If the display gets disconnected at the start of the `update_display()` function, that can mean quite the delay. It's possible that this delay triggers a watchdog timer that blinks the LEDs, but there doesn't appear to be any watchdog timer configured.
This commit is contained in:
@ -26,10 +26,8 @@
|
||||
#define DEBUG false
|
||||
|
||||
|
||||
EDIPTFT::EDIPTFT(boolean smallprotocol, boolean displaybool) {
|
||||
_smallprotocol = smallprotocol;
|
||||
_displaybool = displaybool;
|
||||
}
|
||||
EDIPTFT::EDIPTFT(boolean smallprotocol, boolean disconnected)
|
||||
: _smallprotocol{smallprotocol}, disconnected{disconnected} {}
|
||||
|
||||
|
||||
void EDIPTFT::begin(long baud) {
|
||||
@ -108,6 +106,10 @@ void EDIPTFT::sendData(char* data, char len) {
|
||||
|
||||
|
||||
void EDIPTFT::sendSmall(char* data, char len) {
|
||||
if (disconnected) {
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned char i, bcc;
|
||||
char ok = 0;
|
||||
const uint32_t t_start = millis();
|
||||
@ -137,12 +139,10 @@ void EDIPTFT::sendSmall(char* data, char len) {
|
||||
delay(200);
|
||||
ok = 0;
|
||||
}
|
||||
if(t_start + 1000 < millis())
|
||||
{
|
||||
//Serial.println("Error: waited to long!");
|
||||
ok =1;
|
||||
_displaybool = true;
|
||||
}
|
||||
if (t_start + 1000 < millis()) {
|
||||
ok = 1;
|
||||
disconnected = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -72,8 +72,8 @@
|
||||
|
||||
class EDIPTFT {
|
||||
public:
|
||||
EDIPTFT(boolean smallprotocol=true, boolean displaybool=false);
|
||||
boolean _displaybool;
|
||||
EDIPTFT(boolean smallprotocol=true, boolean disconnected=false);
|
||||
boolean disconnected;
|
||||
|
||||
void begin(long baud=115200);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user