Fix for GPS LED
This commit is contained in:
parent
b1296061e3
commit
eaec09a29c
|
@ -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,81 +136,84 @@ 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->getString(commonData.config->displaycolor) == "Normal"){
|
if(commonData.config->getBool(commonData.config->statusLine) == true){
|
||||||
textcolor = GxEPD_BLACK;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
textcolor = GxEPD_WHITE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Show status info
|
if(commonData.config->getString(commonData.config->displaycolor) == "Normal"){
|
||||||
display.setTextColor(textcolor);
|
textcolor = GxEPD_BLACK;
|
||||||
display.setFont(&Ubuntu_Bold8pt7b);
|
|
||||||
display.setCursor(0, 15);
|
|
||||||
if(commonData.status.wifiApOn){
|
|
||||||
display.print(" AP ");
|
|
||||||
}
|
|
||||||
// If receive new telegram data then display bus name
|
|
||||||
if(commonData.status.tcpClRx != tcpClRxOld || commonData.status.tcpClTx != tcpClTxOld || commonData.status.tcpSerRx != tcpSerRxOld || commonData.status.tcpSerTx != tcpSerTxOld){
|
|
||||||
display.print("TCP ");
|
|
||||||
}
|
|
||||||
if(commonData.status.n2kRx != n2kRxOld || commonData.status.n2kTx != n2kTxOld){
|
|
||||||
display.print("N2K ");
|
|
||||||
}
|
|
||||||
if(commonData.status.serRx != serRxOld || commonData.status.serTx != serTxOld){
|
|
||||||
display.print("183 ");
|
|
||||||
}
|
|
||||||
if(commonData.status.usbRx != usbRxOld || commonData.status.usbTx != usbTxOld){
|
|
||||||
display.print("USB ");
|
|
||||||
}
|
|
||||||
if(commonData.config->getBool(commonData.config->useGPS) == true && hdop->valid == true && hdop->value <= 50){
|
|
||||||
display.print("GPS");
|
|
||||||
}
|
|
||||||
// Save old telegram counter
|
|
||||||
tcpClRxOld = commonData.status.tcpClRx;
|
|
||||||
tcpClTxOld = commonData.status.tcpClTx;
|
|
||||||
tcpSerRxOld = commonData.status.tcpSerRx;
|
|
||||||
tcpSerTxOld = commonData.status.tcpSerTx;
|
|
||||||
n2kRxOld = commonData.status.n2kRx;
|
|
||||||
n2kTxOld = commonData.status.n2kTx;
|
|
||||||
serRxOld = commonData.status.serRx;
|
|
||||||
serTxOld = commonData.status.serTx;
|
|
||||||
usbRxOld = commonData.status.usbRx;
|
|
||||||
usbTxOld = commonData.status.usbTx;
|
|
||||||
|
|
||||||
// Heartbeat as dot
|
|
||||||
display.setTextColor(textcolor);
|
|
||||||
display.setFont(&Ubuntu_Bold32pt7b);
|
|
||||||
display.setCursor(205, 14);
|
|
||||||
if(heartbeat == true){
|
|
||||||
display.print(".");
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
display.print(" ");
|
|
||||||
}
|
|
||||||
heartbeat = !heartbeat;
|
|
||||||
|
|
||||||
// Date and time
|
|
||||||
display.setTextColor(textcolor);
|
|
||||||
display.setFont(&Ubuntu_Bold8pt7b);
|
|
||||||
display.setCursor(230, 15);
|
|
||||||
if(hdop->valid == true && hdop->value <= 50){
|
|
||||||
String acttime = formatValue(time, commonData).svalue;
|
|
||||||
acttime = acttime.substring(0, 5);
|
|
||||||
String actdate = formatValue(date, commonData).svalue;
|
|
||||||
display.print(acttime);
|
|
||||||
display.print(" ");
|
|
||||||
display.print(actdate);
|
|
||||||
display.print(" ");
|
|
||||||
if(commonData.config->getInt(commonData.config->timeZone) == 0){
|
|
||||||
display.print("UTC");
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
display.print("LOT");
|
textcolor = GxEPD_WHITE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show status info
|
||||||
|
display.setTextColor(textcolor);
|
||||||
|
display.setFont(&Ubuntu_Bold8pt7b);
|
||||||
|
display.setCursor(0, 15);
|
||||||
|
if(commonData.status.wifiApOn){
|
||||||
|
display.print(" AP ");
|
||||||
|
}
|
||||||
|
// If receive new telegram data then display bus name
|
||||||
|
if(commonData.status.tcpClRx != tcpClRxOld || commonData.status.tcpClTx != tcpClTxOld || commonData.status.tcpSerRx != tcpSerRxOld || commonData.status.tcpSerTx != tcpSerTxOld){
|
||||||
|
display.print("TCP ");
|
||||||
|
}
|
||||||
|
if(commonData.status.n2kRx != n2kRxOld || commonData.status.n2kTx != n2kTxOld){
|
||||||
|
display.print("N2K ");
|
||||||
|
}
|
||||||
|
if(commonData.status.serRx != serRxOld || commonData.status.serTx != serTxOld){
|
||||||
|
display.print("183 ");
|
||||||
|
}
|
||||||
|
if(commonData.status.usbRx != usbRxOld || commonData.status.usbTx != usbTxOld){
|
||||||
|
display.print("USB ");
|
||||||
|
}
|
||||||
|
if(commonData.config->getBool(commonData.config->useGPS) == true && date->valid == true){
|
||||||
|
display.print("GPS");
|
||||||
|
}
|
||||||
|
// Save old telegram counter
|
||||||
|
tcpClRxOld = commonData.status.tcpClRx;
|
||||||
|
tcpClTxOld = commonData.status.tcpClTx;
|
||||||
|
tcpSerRxOld = commonData.status.tcpSerRx;
|
||||||
|
tcpSerTxOld = commonData.status.tcpSerTx;
|
||||||
|
n2kRxOld = commonData.status.n2kRx;
|
||||||
|
n2kTxOld = commonData.status.n2kTx;
|
||||||
|
serRxOld = commonData.status.serRx;
|
||||||
|
serTxOld = commonData.status.serTx;
|
||||||
|
usbRxOld = commonData.status.usbRx;
|
||||||
|
usbTxOld = commonData.status.usbTx;
|
||||||
|
|
||||||
|
// Heartbeat as dot
|
||||||
|
display.setTextColor(textcolor);
|
||||||
|
display.setFont(&Ubuntu_Bold32pt7b);
|
||||||
|
display.setCursor(205, 14);
|
||||||
|
if(heartbeat == true){
|
||||||
|
display.print(".");
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
display.print(" ");
|
||||||
|
}
|
||||||
|
heartbeat = !heartbeat;
|
||||||
|
|
||||||
|
// Date and time
|
||||||
|
display.setTextColor(textcolor);
|
||||||
|
display.setFont(&Ubuntu_Bold8pt7b);
|
||||||
|
display.setCursor(230, 15);
|
||||||
|
if(date->valid == true){
|
||||||
|
String acttime = formatValue(time, commonData).svalue;
|
||||||
|
acttime = acttime.substring(0, 5);
|
||||||
|
String actdate = formatValue(date, commonData).svalue;
|
||||||
|
display.print(acttime);
|
||||||
|
display.print(" ");
|
||||||
|
display.print(actdate);
|
||||||
|
display.print(" ");
|
||||||
|
if(commonData.config->getInt(commonData.config->timeZone) == 0){
|
||||||
|
display.print("UTC");
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
display.print("LOT");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
display.print("No GPS data");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else{
|
|
||||||
display.print("No GPS data");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue