diff --git a/lib/obp60task/OBP60Extensions.cpp b/lib/obp60task/OBP60Extensions.cpp index c589feb..246eb62 100644 --- a/lib/obp60task/OBP60Extensions.cpp +++ b/lib/obp60task/OBP60Extensions.cpp @@ -328,7 +328,7 @@ void displayTrendLow(int16_t x, int16_t y, uint16_t size, uint16_t color){ } // Show header informations -void displayHeader(CommonData &commonData, GwApi::BoatValue *date, GwApi::BoatValue *time, GwApi::BoatValue *hdop){ +void displayHeader(CommonData &commonData, bool symbolmode, GwApi::BoatValue *date, GwApi::BoatValue *time, GwApi::BoatValue *hdop){ static bool heartbeat = false; static unsigned long usbRxOld = 0; @@ -342,31 +342,70 @@ void displayHeader(CommonData &commonData, GwApi::BoatValue *date, GwApi::BoatVa static unsigned long n2kRxOld = 0; static unsigned long n2kTxOld = 0; + uint16_t symbol_x = 2; + static const uint16_t symbol_offset = 20; + if(commonData.config->getBool(commonData.config->statusLine) == true){ + if (symbolmode) { + commonData.logger->logDebug(GwLog::LOG,"Header: Symbolmode"); + } else { + commonData.logger->logDebug(GwLog::LOG,"Header: Textmode"); + } + // Show status info getdisplay().setTextColor(commonData.fgcolor); getdisplay().setFont(&Ubuntu_Bold8pt7b); getdisplay().setCursor(0, 15); - if(commonData.status.wifiApOn){ - getdisplay().print(" AP "); + if (commonData.status.wifiApOn) { + if (symbolmode) { + getdisplay().drawXBitmap(symbol_x, 1, iconmap["AP"], icon_width, icon_height, commonData.fgcolor); + symbol_x += symbol_offset; + } else { + getdisplay().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){ - getdisplay().print("TCP "); + if (symbolmode) { + getdisplay().drawXBitmap(symbol_x, 1, iconmap["TCP"], icon_width, icon_height, commonData.fgcolor); + symbol_x += symbol_offset; + } else { + getdisplay().print("TCP "); + } } if(commonData.status.n2kRx != n2kRxOld || commonData.status.n2kTx != n2kTxOld){ - getdisplay().print("N2K "); + if (symbolmode) { + getdisplay().drawXBitmap(symbol_x, 1, iconmap["N2K"], icon_width, icon_height, commonData.fgcolor); + symbol_x += symbol_offset; + } else { + getdisplay().print("N2K "); + } } if(commonData.status.serRx != serRxOld || commonData.status.serTx != serTxOld){ - getdisplay().print("183 "); + if (symbolmode) { + getdisplay().drawXBitmap(symbol_x, 1, iconmap["0183"], icon_width, icon_height, commonData.fgcolor); + symbol_x += symbol_offset; + } else { + getdisplay().print("183 "); + } } if(commonData.status.usbRx != usbRxOld || commonData.status.usbTx != usbTxOld){ - getdisplay().print("USB "); + if (symbolmode) { + getdisplay().drawXBitmap(symbol_x, 1, iconmap["USB"], icon_width, icon_height, commonData.fgcolor); + symbol_x += symbol_offset; + } else { + getdisplay().print("USB "); + } } double gpshdop = formatValue(hdop, commonData).value; if(commonData.config->getString(commonData.config->useGPS) != "off" && gpshdop <= commonData.config->getInt(commonData.config->hdopAccuracy) && hdop->valid == true){ - getdisplay().print("GPS"); + if (symbolmode) { + getdisplay().drawXBitmap(symbol_x, 1, iconmap["GPS"], icon_width, icon_height, commonData.fgcolor); + symbol_x += symbol_offset; + } else { + getdisplay().print("GPS"); + } } // Save old telegram counter tcpClRxOld = commonData.status.tcpClRx; diff --git a/lib/obp60task/OBP60Extensions.h b/lib/obp60task/OBP60Extensions.h index 4118623..0455723 100644 --- a/lib/obp60task/OBP60Extensions.h +++ b/lib/obp60task/OBP60Extensions.h @@ -94,7 +94,7 @@ void drawTextRalign(int16_t x, int16_t y, String text); 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 displayHeader(CommonData &commonData, GwApi::BoatValue *date, GwApi::BoatValue *time, GwApi::BoatValue *hdop); // Draw display header +void displayHeader(CommonData &commonData, bool symbolmode, GwApi::BoatValue *date, GwApi::BoatValue *time, GwApi::BoatValue *hdop); // Draw display header void displayFooter(CommonData &commonData); SunData calcSunsetSunrise(GwApi *api, double time, double date, double latitude, double longitude, double timezone); // Calulate sunset and sunrise @@ -140,24 +140,62 @@ static unsigned char fram_bits[] PROGMEM = { 0xff, 0xff, 0xf8, 0x1f, 0xf8, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x1f, 0xf8, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x1f }; +// Header symbols + static unsigned char ap_bits[] = { 0xe0, 0x03, 0x18, 0x0c, 0x04, 0x10, 0xc2, 0x21, 0x30, 0x06, 0x08, 0x08, 0xc0, 0x01, 0x20, 0x02, 0x00, 0x00, 0x80, 0x00, 0xc0, 0x01, 0xc0, 0x01, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00 }; -static unsigned char dish_bits[] PROGMEM= { +static unsigned char gps_bits[] = { 0x3c, 0x00, 0x42, 0x18, 0xfa, 0x1b, 0x02, 0x04, 0x02, 0x0a, 0x02, 0x09, 0x82, 0x08, 0x06, 0x0a, 0x0e, 0x1b, 0x9c, 0x2b, 0x38, 0x2b, 0x74, 0x20, 0xec, 0x1f, 0x1c, 0x00, 0xf4, 0x00, 0xfe, 0x03 }; +static unsigned char nmea_bits[] = { + 0x00, 0x00, 0x22, 0x21, 0x26, 0x33, 0x26, 0x33, 0x2a, 0x2d, 0x32, 0x2d, + 0x32, 0x21, 0x22, 0x21, 0x00, 0x00, 0x3c, 0x0c, 0x04, 0x0c, 0x04, 0x12, + 0x3c, 0x12, 0x04, 0x1e, 0x04, 0x21, 0x3c, 0x21 }; + +static unsigned char n2k_bits[] = { + 0xe0, 0x07, 0x18, 0x18, 0x04, 0x20, 0x02, 0x40, 0x32, 0x4c, 0x31, 0x8c, + 0x01, 0x80, 0x81, 0x81, 0x81, 0x81, 0x01, 0x80, 0x31, 0x8c, 0x32, 0x4c, + 0x02, 0x40, 0x04, 0x20, 0x98, 0x19, 0xe0, 0x07 }; + +static unsigned char tcp_bits[] = { + 0x00, 0x00, 0xe0, 0x03, 0x20, 0x02, 0x20, 0x02, 0x20, 0x02, 0xe0, 0x03, + 0x80, 0x00, 0x80, 0x00, 0xff, 0xff, 0x08, 0x10, 0x08, 0x10, 0x3e, 0x7c, + 0x22, 0x44, 0x22, 0x44, 0x22, 0x44, 0x3e, 0x7c }; + +static unsigned char usb_bits[] = { + 0x00, 0x00, 0x92, 0x39, 0x52, 0x4a, 0x52, 0x48, 0x92, 0x39, 0x12, 0x4a, + 0x52, 0x4a, 0x8c, 0x39, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x1f, 0x04, 0x20, + 0xf4, 0x2f, 0x04, 0x20, 0xf8, 0x1f, 0x00, 0x00 }; + +static unsigned char sdcard_bits[] = { + 0xf8, 0x07, 0x0c, 0x08, 0x04, 0x08, 0xc4, 0x09, 0x24, 0x1a, 0xe4, 0x13, + 0x04, 0x20, 0x24, 0x21, 0xa4, 0x12, 0x44, 0x12, 0x04, 0x20, 0x04, 0x20, + 0xc4, 0x23, 0x34, 0x2c, 0xd8, 0x1b, 0x00, 0x00 }; + +static unsigned char bluetooth_bits[] = { + 0x00, 0x00, 0x22, 0x21, 0x26, 0x33, 0x26, 0x33, 0x2a, 0x2d, 0x32, 0x2d, + 0x32, 0x21, 0x22, 0x21, 0x00, 0x00, 0x3c, 0x0c, 0x04, 0x0c, 0x04, 0x12, + 0x3c, 0x12, 0x04, 0x1e, 0x04, 0x21, 0x3c, 0x21 }; + static std::map iconmap = { {"LEFT", left_bits}, {"RIGHT", right_bits}, {"LOCK", lock_bits}, {"PLUS", plus_bits}, {"MINUS", minus_bits}, - {"DISH", dish_bits}, - {"AP", ap_bits} + {"GPS", gps_bits}, + {"AP", ap_bits}, + {"0183", nmea_bits}, + {"N2K", n2k_bits}, + {"TCP", tcp_bits}, + {"USB", usb_bits}, + {"SDCARD", sdcard_bits}, + {"BLUE", bluetooth_bits} }; // Battery diff --git a/lib/obp60task/config.json b/lib/obp60task/config.json index 14d313a..599711c 100644 --- a/lib/obp60task/config.json +++ b/lib/obp60task/config.json @@ -898,6 +898,21 @@ "obp60":"true" } }, + { + "name": "headerFormat", + "label": "Header Format", + "type": "list", + "default":"TEXT", + "description": "Header format: Text or Symbols", + "list": [ + {"l":"Text","v":"TEXT"}, + {"l":"Symbols","v":"ICON"} + ], + "category":"OBP60 Pages", + "capabilities": { + "obp60":"true" + } + }, { "name": "imageFormat", "label": "Screenshot Format", diff --git a/lib/obp60task/config_obp40.json b/lib/obp60task/config_obp40.json index 888c746..ec5ed06 100644 --- a/lib/obp60task/config_obp40.json +++ b/lib/obp60task/config_obp40.json @@ -924,6 +924,21 @@ "obp40": "true" } }, + { + "name": "headerFormat", + "label": "Header Format", + "type": "list", + "default":"TEXT", + "description": "Header format: Text or Symbols", + "list": [ + {"l":"Text","v":"TEXT"}, + {"l":"Symbols","v":"ICON"} + ], + "category":"OBP60 Pages", + "capabilities": { + "obp60":"true" + } + }, { "name": "imageFormat", "label": "Screenshot Format", diff --git a/lib/obp60task/obp60task.cpp b/lib/obp60task/obp60task.cpp index 1b4b936..7175fe1 100644 --- a/lib/obp60task/obp60task.cpp +++ b/lib/obp60task/obp60task.cpp @@ -410,6 +410,7 @@ void OBP60Task(GwApi *api){ String systemname = api->getConfig()->getConfigItem(api->getConfig()->systemName,true)->asString(); String wifipass = api->getConfig()->getConfigItem(api->getConfig()->apPassword,true)->asString(); bool refreshmode = api->getConfig()->getConfigItem(api->getConfig()->refresh,true)->asBoolean(); + bool symbolmode = (config->getString(config->headerFormat) == "ICON"); String fastrefresh = api->getConfig()->getConfigItem(api->getConfig()->fastRefresh,true)->asString(); uint fullrefreshtime = uint(api->getConfig()->getConfigItem(api->getConfig()->fullRefreshTime,true)->asInt()); #ifdef BOARD_OBP40S3 @@ -791,7 +792,7 @@ void OBP60Task(GwApi *api){ // Show header if enabled if (pages[pageNumber].description && pages[pageNumber].description->header or systemPage){ // build header using commonData - displayHeader(commonData, date, time, hdop); // Show page header + displayHeader(commonData, symbolmode, date, time, hdop); // Show page header } // Call the particular page