Fix for GPS LED

This commit is contained in:
norbert-walter 2022-04-01 13:11:48 +02:00
parent b1296061e3
commit eaec09a29c
3 changed files with 79 additions and 76 deletions

View File

@ -121,7 +121,7 @@ void displayTrendLow(int16_t x, int16_t y, uint16_t size, uint16_t color){
display.fillTriangle(x, y, x+size*2, y, x+size, y+size*2, color); display.fillTriangle(x, y, x+size*2, y, x+size, y+size*2, color);
} }
void displayHeader(CommonData &commonData, GwApi::BoatValue *hdop, GwApi::BoatValue *date, GwApi::BoatValue *time){ void displayHeader(CommonData &commonData, GwApi::BoatValue *date, GwApi::BoatValue *time){
static bool heartbeat = false; static bool heartbeat = false;
static unsigned long usbRxOld = 0; static unsigned long usbRxOld = 0;
@ -136,6 +136,8 @@ void displayHeader(CommonData &commonData, GwApi::BoatValue *hdop, GwApi::BoatVa
static unsigned long n2kTxOld = 0; static unsigned long n2kTxOld = 0;
int textcolor = GxEPD_BLACK; int textcolor = GxEPD_BLACK;
if(commonData.config->getBool(commonData.config->statusLine) == true){
if(commonData.config->getString(commonData.config->displaycolor) == "Normal"){ if(commonData.config->getString(commonData.config->displaycolor) == "Normal"){
textcolor = GxEPD_BLACK; textcolor = GxEPD_BLACK;
} }
@ -163,7 +165,7 @@ void displayHeader(CommonData &commonData, GwApi::BoatValue *hdop, GwApi::BoatVa
if(commonData.status.usbRx != usbRxOld || commonData.status.usbTx != usbTxOld){ if(commonData.status.usbRx != usbRxOld || commonData.status.usbTx != usbTxOld){
display.print("USB "); display.print("USB ");
} }
if(commonData.config->getBool(commonData.config->useGPS) == true && hdop->valid == true && hdop->value <= 50){ if(commonData.config->getBool(commonData.config->useGPS) == true && date->valid == true){
display.print("GPS"); display.print("GPS");
} }
// Save old telegram counter // Save old telegram counter
@ -194,7 +196,7 @@ void displayHeader(CommonData &commonData, GwApi::BoatValue *hdop, GwApi::BoatVa
display.setTextColor(textcolor); display.setTextColor(textcolor);
display.setFont(&Ubuntu_Bold8pt7b); display.setFont(&Ubuntu_Bold8pt7b);
display.setCursor(230, 15); display.setCursor(230, 15);
if(hdop->valid == true && hdop->value <= 50){ if(date->valid == true){
String acttime = formatValue(time, commonData).svalue; String acttime = formatValue(time, commonData).svalue;
acttime = acttime.substring(0, 5); acttime = acttime.substring(0, 5);
String actdate = formatValue(date, commonData).svalue; String actdate = formatValue(date, commonData).svalue;
@ -213,5 +215,6 @@ void displayHeader(CommonData &commonData, GwApi::BoatValue *hdop, GwApi::BoatVa
display.print("No GPS data"); display.print("No GPS data");
} }
} }
}
#endif #endif

View File

@ -40,6 +40,6 @@ void setBuzzerPower(uint power); // Set buzzer power
void displayTrendHigh(int16_t x, int16_t y, uint16_t size, uint16_t color); void displayTrendHigh(int16_t x, int16_t y, uint16_t size, uint16_t color);
void displayTrendLow(int16_t x, int16_t y, uint16_t size, uint16_t color); void displayTrendLow(int16_t x, int16_t y, uint16_t size, uint16_t color);
void displayHeader(CommonData &commonData, GwApi::BoatValue *hdop, GwApi::BoatValue *date, GwApi::BoatValue *time); // Draw display header void displayHeader(CommonData &commonData, GwApi::BoatValue *date, GwApi::BoatValue *time); // Draw display header
#endif #endif

View File

@ -378,11 +378,11 @@ void OBP60Task(GwApi *api){
commonData.data.maxpage = numPages; commonData.data.maxpage = numPages;
// If GPS fix then LED off (HDOP) // If GPS fix then LED off (HDOP)
if(String(gpsFix) == "GPS Fix Lost" && hdop->valid == true && int(hdop->value) <= 50){ if(String(gpsFix) == "GPS Fix Lost" && date->valid == true){
setPortPin(OBP_FLASH_LED, false); setPortPin(OBP_FLASH_LED, false);
} }
// Ifmissing GPS fix then LED on // Ifmissing GPS fix then LED on
if(String(gpsFix) == "GPS Fix Lost" && ((hdop->valid == true && int(hdop->value) > 50) || hdop->valid == false)){ if(String(gpsFix) == "GPS Fix Lost" && date->valid == false){
setPortPin(OBP_FLASH_LED, true); setPortPin(OBP_FLASH_LED, true);
} }
@ -469,7 +469,7 @@ void OBP60Task(GwApi *api){
display.fillRect(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, bgcolor); // Clear display display.fillRect(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, bgcolor); // Clear display
if (pages[pageNumber].description && pages[pageNumber].description->header){ if (pages[pageNumber].description && pages[pageNumber].description->header){
//build some header and footer using commonData //build some header and footer using commonData
displayHeader(commonData, hdop, date, time); displayHeader(commonData, date, time);
} }
// Call the particular page // Call the particular page