Improved auto-reconnect
This commit is contained in:
parent
10089fce6d
commit
116178e6b7
|
@ -17,9 +17,7 @@ void setupLoRaWAN() {
|
|||
connected = false;
|
||||
LoRaWAN.Init(&Serial2, 13, 14);
|
||||
delay(100);
|
||||
M5.Lcd.clear();
|
||||
Serial.println("Connecting...");
|
||||
M5.Lcd.drawString("Connecting...", 0, 0);
|
||||
while (!LoRaWAN.checkDeviceConnect());
|
||||
LoRaWAN.writeCMD("AT?\r\n");
|
||||
delay(100);
|
||||
|
@ -61,8 +59,6 @@ void setupLoRaWAN() {
|
|||
recvMsg.trim();
|
||||
if(recvMsg == "+CJOIN:OK") {
|
||||
Serial.println("Connected!");
|
||||
M5.Lcd.drawString("Connected!", 0, 30);
|
||||
delay(500);
|
||||
connected = true;
|
||||
lastMessage = time(NULL);
|
||||
break;
|
||||
|
@ -79,7 +75,10 @@ void setup() {
|
|||
M5.Lcd.setFreeFont(&Ubuntu_24px);
|
||||
M5.Lcd.setTextPadding(0);
|
||||
|
||||
M5.Lcd.drawString("Connecting...", 0, 0);
|
||||
setupLoRaWAN();
|
||||
M5.Lcd.drawString("Connected!", 0, 30);
|
||||
delay(500);
|
||||
|
||||
xTaskCreatePinnedToCore(task1, "task1", 4096, NULL, 1, NULL, 1);
|
||||
|
||||
|
@ -300,6 +299,16 @@ void clearLine(int y) {
|
|||
M5.Lcd.fillRect(0, y*30, 320, 30, BLACK);
|
||||
}
|
||||
|
||||
void clearDisplayCache() {
|
||||
for(int y=0; y<7; y++) {
|
||||
displayedLines[y] = "";
|
||||
displayedLastStops[y] = "";
|
||||
displayedDepartureTimes[y] = "";
|
||||
}
|
||||
displayedTime = "";
|
||||
displayedDate = "";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue