1
0
mirror of https://github.com/thooge/esp32-nmea2000-obp60.git synced 2025-12-29 05:33:05 +01:00

Add delay for connection lost warning

This commit is contained in:
norbert-walter
2025-12-13 22:11:57 +01:00
parent 213812ed14
commit c6276cdcff

View File

@@ -127,6 +127,7 @@ public:
static double magneticHeading = 0;
static double speedOverGround = 0;
static double depthBelowTransducer = 0;
static int lostCounter = 0; // Counter for connection lost to the map server (increment by each page refresh)
int imgWidth = 0;
int imgHeight = 0;
@@ -406,6 +407,7 @@ public:
imageBackupSize = decodedSize;
}
hasImageBackup = true;
lostCounter = 0;
// Show image (navigation map)
getdisplay().drawBitmap(0, 25, imageData, imgWidth, imgHeight, commonData->fgcolor);
@@ -421,12 +423,17 @@ public:
getdisplay().drawBitmap(0, 25, imageBackupData, imageBackupWidth, imageBackupHeight, commonData->fgcolor);
}
// Show info: Connection lost
getdisplay().setFont(&Ubuntu_Bold12pt8b);
getdisplay().fillRect(200, 250 , 200, 25, commonData->fgcolor); // Black rect
getdisplay().fillRect(202, 252 , 196, 21, commonData->bgcolor); // White rect
getdisplay().setCursor(205, 270);
getdisplay().print("Connection lost");
// Show info: Connection lost when 5 page refreshes has a connection lost to the map server
// Short connection losts are uncritical
if(lostCounter >= 5){
getdisplay().setFont(&Ubuntu_Bold12pt8b);
getdisplay().fillRect(200, 250 , 200, 25, commonData->fgcolor); // Black rect
getdisplay().fillRect(202, 252 , 196, 21, commonData->bgcolor); // White rect
getdisplay().setCursor(210, 270);
getdisplay().print("Map server lost");
}
lostCounter++; // Increment lost counter
}