Different date styles, extend boat data, config save problem
This commit is contained in:
parent
ff71fa855e
commit
3efba049f6
|
@ -227,6 +227,8 @@ void OBP60Task(void *param){
|
||||||
busInfo.simulation = api->getConfig()->getConfigItem(api->getConfig()->useSimuData,true)->asBoolean();
|
busInfo.simulation = api->getConfig()->getConfigItem(api->getConfig()->useSimuData,true)->asBoolean();
|
||||||
String powerMode=api->getConfig()->getConfigItem(api->getConfig()->powerMode,true)->asString();
|
String powerMode=api->getConfig()->getConfigItem(api->getConfig()->powerMode,true)->asString();
|
||||||
String displayMode=api->getConfig()->getConfigItem(api->getConfig()->display,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();
|
String backlightMode=api->getConfig()->getConfigItem(api->getConfig()->backlight,true)->asString();
|
||||||
|
|
||||||
// Initializing all necessary boat data
|
// Initializing all necessary boat data
|
||||||
|
|
|
@ -12,7 +12,7 @@ typedef struct{
|
||||||
|
|
||||||
typedef struct{
|
typedef struct{
|
||||||
bool simulation = false; // Simulate boat data
|
bool simulation = false; // Simulate boat data
|
||||||
bool headline = true;
|
bool statusline = true;
|
||||||
char dateformat[3] = "GB";
|
char dateformat[3] = "GB";
|
||||||
int timezone = 0;
|
int timezone = 0;
|
||||||
bool refresh = false;
|
bool refresh = false;
|
||||||
|
|
|
@ -12,12 +12,17 @@ void showPage(busData values){
|
||||||
// Clear display
|
// Clear display
|
||||||
display.fillRect(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, GxEPD_WHITE); // Draw white sreen
|
display.fillRect(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, GxEPD_WHITE); // Draw white sreen
|
||||||
|
|
||||||
// Draw status heder
|
if(values.statusline == true){
|
||||||
// display.fillRect(0, 0, GxEPD_WIDTH, 20, GxEPD_BLACK); // Draw black box
|
// Print status info
|
||||||
display.setFont(&Ubuntu_Bold8pt7b);
|
display.setFont(&Ubuntu_Bold8pt7b);
|
||||||
display.setTextColor(GxEPD_BLACK);
|
display.setTextColor(GxEPD_BLACK);
|
||||||
display.setCursor(0, 15);
|
display.setCursor(0, 15);
|
||||||
display.print(" WiFi AP TCP N2K 183 GPS");
|
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.setFont(&Ubuntu_Bold32pt7b);
|
||||||
display.setCursor(205, 14);
|
display.setCursor(205, 14);
|
||||||
if(heartbeat == true){
|
if(heartbeat == true){
|
||||||
|
@ -27,10 +32,31 @@ void showPage(busData values){
|
||||||
display.print(" ");
|
display.print(" ");
|
||||||
}
|
}
|
||||||
heartbeat = !heartbeat;
|
heartbeat = !heartbeat;
|
||||||
|
|
||||||
|
// Date and time
|
||||||
display.setFont(&Ubuntu_Bold8pt7b);
|
display.setFont(&Ubuntu_Bold8pt7b);
|
||||||
display.setCursor(230, 15);
|
display.setCursor(230, 15);
|
||||||
|
char newdate[16] = "";
|
||||||
if(values.PDOP.valid == true && values.PDOP.fvalue <= 50){
|
if(values.PDOP.valid == true && values.PDOP.fvalue <= 50){
|
||||||
|
if(String(values.dateformat) == "DE"){
|
||||||
display.print(values.Date.svalue);
|
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(" ");
|
||||||
display.print(values.Time.svalue);
|
display.print(values.Time.svalue);
|
||||||
display.print(" ");
|
display.print(" ");
|
||||||
|
@ -39,6 +65,7 @@ void showPage(busData values){
|
||||||
else{
|
else{
|
||||||
display.print("No GPS data");
|
display.print("No GPS data");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Read page number
|
// Read page number
|
||||||
switch (pageNumber) {
|
switch (pageNumber) {
|
||||||
|
@ -65,8 +92,13 @@ void showPage(busData values){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Partial update display
|
// Update display
|
||||||
|
if(values.refresh == true){
|
||||||
|
display.update(); // Full update
|
||||||
|
}
|
||||||
|
else{
|
||||||
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Partial update (fast)
|
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Partial update (fast)
|
||||||
|
}
|
||||||
|
|
||||||
first_view = false;
|
first_view = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "draft",
|
"name": "draft",
|
||||||
"label": "Boat Draft",
|
"label": "Boat Draft [m]",
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"default": "0",
|
"default": "0",
|
||||||
"check": "checkMinMax",
|
"check": "checkMinMax",
|
||||||
|
@ -56,7 +56,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "fuelTank",
|
"name": "fuelTank",
|
||||||
"label": "Fuel Tank",
|
"label": "Fuel Tank [l]",
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"default": "0",
|
"default": "0",
|
||||||
"check": "checkMinMax",
|
"check": "checkMinMax",
|
||||||
|
@ -70,7 +70,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "fuelConsumption",
|
"name": "fuelConsumption",
|
||||||
"label": "Fuel Consuption",
|
"label": "Fuel Consuption [l/h]",
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"default": "0",
|
"default": "0",
|
||||||
"check": "checkMinMax",
|
"check": "checkMinMax",
|
||||||
|
@ -84,7 +84,21 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "waterTank",
|
"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",
|
"type": "number",
|
||||||
"default": "0",
|
"default": "0",
|
||||||
"check": "checkMinMax",
|
"check": "checkMinMax",
|
||||||
|
@ -98,7 +112,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "batteryVoltage",
|
"name": "batteryVoltage",
|
||||||
"label": "Battery Voltage",
|
"label": "Battery Voltage [V]",
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"default": "12",
|
"default": "12",
|
||||||
"check": "checkMinMax",
|
"check": "checkMinMax",
|
||||||
|
@ -129,13 +143,13 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "batteryCapacity",
|
"name": "batteryCapacity",
|
||||||
"label": "Battery Capacity",
|
"label": "Battery Capacity [Ah]",
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"default": "0",
|
"default": "0",
|
||||||
"check": "checkMinMax",
|
"check": "checkMinMax",
|
||||||
"min": 0,
|
"min": 0,
|
||||||
"max": 5000,
|
"max": 10000,
|
||||||
"description": "Fuel tank capacity [0...5000Ah]",
|
"description": "Fuel tank capacity [0...10000Ah]",
|
||||||
"category": "OBP60 Settings",
|
"category": "OBP60 Settings",
|
||||||
"capabilities": {
|
"capabilities": {
|
||||||
"obp60":"true"
|
"obp60":"true"
|
||||||
|
@ -329,7 +343,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "buzzerPower",
|
"name": "buzzerPower",
|
||||||
"label": "Buzzer Power",
|
"label": "Buzzer Power [%]",
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"default": "50",
|
"default": "50",
|
||||||
"check": "checkMinMax",
|
"check": "checkMinMax",
|
||||||
|
@ -354,19 +368,5 @@
|
||||||
"capabilities": {
|
"capabilities": {
|
||||||
"obp60":"true"
|
"obp60":"true"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "lastSettings",
|
|
||||||
"label": "Dummy",
|
|
||||||
"type": "number",
|
|
||||||
"default": "50",
|
|
||||||
"check": "checkMinMax",
|
|
||||||
"min": 0,
|
|
||||||
"max": 100,
|
|
||||||
"description": "Dummy",
|
|
||||||
"category": "OBP60 End",
|
|
||||||
"capabilities": {
|
|
||||||
"obp60":"true"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue