diff --git a/lib/obp60task/GwOBP60Task.cpp b/lib/obp60task/GwOBP60Task.cpp index 9497ceb..287432d 100644 --- a/lib/obp60task/GwOBP60Task.cpp +++ b/lib/obp60task/GwOBP60Task.cpp @@ -227,6 +227,8 @@ void OBP60Task(void *param){ busInfo.simulation = api->getConfig()->getConfigItem(api->getConfig()->useSimuData,true)->asBoolean(); String powerMode=api->getConfig()->getConfigItem(api->getConfig()->powerMode,true)->asString(); String displayMode=api->getConfig()->getConfigItem(api->getConfig()->display,true)->asString(); + busInfo.statusline = api->getConfig()->getConfigItem(api->getConfig()->statusLine,true)->asBoolean(); + bool refreshOn = api->getConfig()->getConfigItem(api->getConfig()->refresh,true)->asBoolean(); String backlightMode=api->getConfig()->getConfigItem(api->getConfig()->backlight,true)->asString(); // Initializing all necessary boat data diff --git a/lib/obp60task/OBP60Data.h b/lib/obp60task/OBP60Data.h index f776b20..c3f6417 100644 --- a/lib/obp60task/OBP60Data.h +++ b/lib/obp60task/OBP60Data.h @@ -12,7 +12,7 @@ typedef struct{ typedef struct{ bool simulation = false; // Simulate boat data - bool headline = true; + bool statusline = true; char dateformat[3] = "GB"; int timezone = 0; bool refresh = false; diff --git a/lib/obp60task/OBP60Pages.h b/lib/obp60task/OBP60Pages.h index 86df68b..0935368 100644 --- a/lib/obp60task/OBP60Pages.h +++ b/lib/obp60task/OBP60Pages.h @@ -12,32 +12,59 @@ void showPage(busData values){ // Clear display display.fillRect(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, GxEPD_WHITE); // Draw white sreen - // Draw status heder - // display.fillRect(0, 0, GxEPD_WIDTH, 20, GxEPD_BLACK); // Draw black box - display.setFont(&Ubuntu_Bold8pt7b); - display.setTextColor(GxEPD_BLACK); - display.setCursor(0, 15); - display.print(" WiFi AP TCP N2K 183 GPS"); - display.setFont(&Ubuntu_Bold32pt7b); - display.setCursor(205, 14); - if(heartbeat == true){ - display.print("."); - } - else{ - display.print(" "); - } - heartbeat = !heartbeat; - display.setFont(&Ubuntu_Bold8pt7b); - display.setCursor(230, 15); - if(values.PDOP.valid == true && values.PDOP.fvalue <= 50){ - display.print(values.Date.svalue); - display.print(" "); - display.print(values.Time.svalue); - display.print(" "); - display.print("UTC"); - } - else{ - display.print("No GPS data"); + if(values.statusline == true){ + // Print status info + display.setFont(&Ubuntu_Bold8pt7b); + display.setTextColor(GxEPD_BLACK); + display.setCursor(0, 15); + display.print(" WiFi AP TCP N2K 183 "); + if(values.PDOP.valid == true && values.PDOP.fvalue <= 50){ + display.print("GPS"); + } + + // Heartbeat as dot + display.setFont(&Ubuntu_Bold32pt7b); + display.setCursor(205, 14); + if(heartbeat == true){ + display.print("."); + } + else{ + display.print(" "); + } + heartbeat = !heartbeat; + + // Date and time + display.setFont(&Ubuntu_Bold8pt7b); + display.setCursor(230, 15); + char newdate[16] = ""; + if(values.PDOP.valid == true && values.PDOP.fvalue <= 50){ + if(String(values.dateformat) == "DE"){ + display.print(values.Date.svalue); + } + if(String(values.dateformat) == "GB"){ + values.Date.svalue[2] = '/'; + values.Date.svalue[5] = '/'; + display.print(values.Date.svalue); + } + if(String(values.dateformat) == "US"){ + char newdate[16] = ""; + strcpy(newdate, values.Date.svalue); + newdate[0] = values.Date.svalue[3]; + newdate[1] = values.Date.svalue[4]; + newdate[2] = '/'; + newdate[3] = values.Date.svalue[0]; + newdate[4] = values.Date.svalue[1]; + newdate[5] = '/'; + display.print(newdate); + } + display.print(" "); + display.print(values.Time.svalue); + display.print(" "); + display.print("UTC"); + } + else{ + display.print("No GPS data"); + } } // Read page number @@ -65,8 +92,13 @@ void showPage(busData values){ break; } - // Partial update display - display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Partial update (fast) + // Update display + if(values.refresh == true){ + display.update(); // Full update + } + else{ + display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Partial update (fast) + } first_view = false; } diff --git a/lib/obp60task/config.json b/lib/obp60task/config.json index bcef5a2..8349c33 100644 --- a/lib/obp60task/config.json +++ b/lib/obp60task/config.json @@ -42,7 +42,7 @@ }, { "name": "draft", - "label": "Boat Draft", + "label": "Boat Draft [m]", "type": "number", "default": "0", "check": "checkMinMax", @@ -56,7 +56,7 @@ }, { "name": "fuelTank", - "label": "Fuel Tank", + "label": "Fuel Tank [l]", "type": "number", "default": "0", "check": "checkMinMax", @@ -70,7 +70,7 @@ }, { "name": "fuelConsumption", - "label": "Fuel Consuption", + "label": "Fuel Consuption [l/h]", "type": "number", "default": "0", "check": "checkMinMax", @@ -84,7 +84,21 @@ }, { "name": "waterTank", - "label": "Water Tank", + "label": "Water Tank [l]", + "type": "number", + "default": "0", + "check": "checkMinMax", + "min": 0, + "max": 5000, + "description": "Water tank capacity [0...5000l]", + "category": "OBP60 Settings", + "capabilities": { + "obp60":"true" + } + }, + { + "name": "wasteTank", + "label": "Waste Tank [l]", "type": "number", "default": "0", "check": "checkMinMax", @@ -98,7 +112,7 @@ }, { "name": "batteryVoltage", - "label": "Battery Voltage", + "label": "Battery Voltage [V]", "type": "number", "default": "12", "check": "checkMinMax", @@ -129,13 +143,13 @@ }, { "name": "batteryCapacity", - "label": "Battery Capacity", + "label": "Battery Capacity [Ah]", "type": "number", "default": "0", "check": "checkMinMax", "min": 0, - "max": 5000, - "description": "Fuel tank capacity [0...5000Ah]", + "max": 10000, + "description": "Fuel tank capacity [0...10000Ah]", "category": "OBP60 Settings", "capabilities": { "obp60":"true" @@ -329,7 +343,7 @@ }, { "name": "buzzerPower", - "label": "Buzzer Power", + "label": "Buzzer Power [%]", "type": "number", "default": "50", "check": "checkMinMax", @@ -354,19 +368,5 @@ "capabilities": { "obp60":"true" } - }, - { - "name": "lastSettings", - "label": "Dummy", - "type": "number", - "default": "50", - "check": "checkMinMax", - "min": 0, - "max": 100, - "description": "Dummy", - "category": "OBP60 End", - "capabilities": { - "obp60":"true" - } } ]