mirror of
https://github.com/thooge/esp32-nmea2000-obp60.git
synced 2026-01-26 08:13:05 +01:00
Merge branch 'norbert-walter:master' into WindPlot-v3
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
#if defined BOARD_OBP60S3 || defined BOARD_OBP40S3
|
#if defined BOARD_OBP60S3 || defined BOARD_OBP40S3
|
||||||
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include <PCF8574.h> // Driver for PCF8574 output modul from Horter
|
|
||||||
#include <Wire.h> // I2C
|
#include <Wire.h> // I2C
|
||||||
#include <RTClib.h> // Driver for DS1388 RTC
|
#include <RTClib.h> // Driver for DS1388 RTC
|
||||||
|
#include <PCF8574.h> // PCF8574 modules from Horter
|
||||||
#include "SunRise.h" // Lib for sunrise and sunset calculation
|
#include "SunRise.h" // Lib for sunrise and sunset calculation
|
||||||
#include "Pagedata.h"
|
#include "Pagedata.h"
|
||||||
#include "OBP60Hardware.h"
|
#include "OBP60Hardware.h"
|
||||||
@@ -27,9 +27,7 @@
|
|||||||
#include "fonts/IBM8x8px.h"
|
#include "fonts/IBM8x8px.h"
|
||||||
|
|
||||||
// E-Ink Display
|
// E-Ink Display
|
||||||
#define GxEPD_WIDTH 400 // Display width
|
// Definition for e-paper width an height refer OBP60Hardware.h
|
||||||
#define GxEPD_HEIGHT 300 // Display height
|
|
||||||
|
|
||||||
#ifdef DISPLAY_GDEW042T2
|
#ifdef DISPLAY_GDEW042T2
|
||||||
// Set display type and SPI pins for display
|
// Set display type and SPI pins for display
|
||||||
GxEPD2_BW<GxEPD2_420, GxEPD2_420::HEIGHT> display(GxEPD2_420(OBP_SPI_CS, OBP_SPI_DC, OBP_SPI_RST, OBP_SPI_BUSY)); // GDEW042T2 400x300, UC8176 (IL0398)
|
GxEPD2_BW<GxEPD2_420, GxEPD2_420::HEIGHT> display(GxEPD2_420(OBP_SPI_CS, OBP_SPI_DC, OBP_SPI_RST, OBP_SPI_BUSY)); // GDEW042T2 400x300, UC8176 (IL0398)
|
||||||
@@ -90,10 +88,11 @@ void hardwareInit(GwApi *api)
|
|||||||
|
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
// Init PCF8574 digital outputs
|
// Init PCF8574 digital outputs
|
||||||
Wire.setClock(I2C_SPEED); // Set I2C clock on 10 kHz
|
Wire.setClock(I2C_SPEED_LOW); // Set I2C clock on 10 kHz
|
||||||
if(pcf8574_Out.begin()){ // Initialize PCF8574
|
if(pcf8574_Out.begin()){ // Initialize PCF8574
|
||||||
pcf8574_Out.write8(255); // Clear all outputs
|
pcf8574_Out.write8(255); // Clear all outputs
|
||||||
}
|
}
|
||||||
|
Wire.setClock(I2C_SPEED); // Set I2C clock on 100 kHz
|
||||||
fram = Adafruit_FRAM_I2C();
|
fram = Adafruit_FRAM_I2C();
|
||||||
if (esp_reset_reason() == ESP_RST_POWERON) {
|
if (esp_reset_reason() == ESP_RST_POWERON) {
|
||||||
// help initialize FRAM
|
// help initialize FRAM
|
||||||
@@ -194,6 +193,15 @@ void powerInit(String powermode) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setPCF8574PortPin(uint pin, uint8_t value){
|
||||||
|
Wire.setClock(I2C_SPEED_LOW); // Set I2C clock on 10 kHz
|
||||||
|
if(pcf8574_Out.begin()){ // Check available and initialize PCF8574
|
||||||
|
pcf8574_Out.write(pin, value); // Toggle pin
|
||||||
|
}
|
||||||
|
Wire.setClock(I2C_SPEED); // Set I2C clock on 100 kHz
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void setPortPin(uint pin, bool value){
|
void setPortPin(uint pin, bool value){
|
||||||
pinMode(pin, OUTPUT);
|
pinMode(pin, OUTPUT);
|
||||||
digitalWrite(pin, value);
|
digitalWrite(pin, value);
|
||||||
@@ -905,4 +913,30 @@ void doImageRequest(GwApi *api, int *pageno, const PageStruct pages[MAX_PAGE_NUM
|
|||||||
imageBuffer.clear();
|
imageBuffer.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Calculate the distance between two Geo coordinates
|
||||||
|
double distanceBetweenCoordinates(double lat1, double lon1, double lat2, double lon2) {
|
||||||
|
// Grad → Radiant
|
||||||
|
double lat1Rad = lat1 * DEG_TO_RAD;
|
||||||
|
double lon1Rad = lon1 * DEG_TO_RAD;
|
||||||
|
double lat2Rad = lat2 * DEG_TO_RAD;
|
||||||
|
double lon2Rad = lon2 * DEG_TO_RAD;
|
||||||
|
|
||||||
|
// Differenzen
|
||||||
|
double dLat = lat2Rad - lat1Rad;
|
||||||
|
double dLon = lon2Rad - lon1Rad;
|
||||||
|
|
||||||
|
// Haversine-Formel
|
||||||
|
double a = sin(dLat / 2.0) * sin(dLat / 2.0) +
|
||||||
|
cos(lat1Rad) * cos(lat2Rad) *
|
||||||
|
sin(dLon / 2.0) * sin(dLon / 2.0);
|
||||||
|
|
||||||
|
double c = 2.0 * atan2(sqrt(a), sqrt(1.0 - a));
|
||||||
|
|
||||||
|
// Abstand in Metern
|
||||||
|
return double(EARTH_RADIUS) * c;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include "Graphics.h"
|
#include "Graphics.h"
|
||||||
#include <GxEPD2_BW.h> // E-paper lib V2
|
#include <GxEPD2_BW.h> // E-paper lib V2
|
||||||
#include <Adafruit_FRAM_I2C.h> // I2C FRAM
|
#include <Adafruit_FRAM_I2C.h> // I2C FRAM
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
#ifdef BOARD_OBP40S3
|
#ifdef BOARD_OBP40S3
|
||||||
#include "esp_vfs_fat.h"
|
#include "esp_vfs_fat.h"
|
||||||
@@ -31,6 +32,7 @@
|
|||||||
#define FRAM_BAROGRAPH_END 0x13FF
|
#define FRAM_BAROGRAPH_END 0x13FF
|
||||||
|
|
||||||
#define PI 3.1415926535897932384626433832795
|
#define PI 3.1415926535897932384626433832795
|
||||||
|
#define EARTH_RADIUS 6371000.0
|
||||||
|
|
||||||
extern Adafruit_FRAM_I2C fram;
|
extern Adafruit_FRAM_I2C fram;
|
||||||
extern bool hasFRAM;
|
extern bool hasFRAM;
|
||||||
@@ -87,8 +89,8 @@ uint8_t getLastPage();
|
|||||||
void hardwareInit(GwApi *api);
|
void hardwareInit(GwApi *api);
|
||||||
void powerInit(String powermode);
|
void powerInit(String powermode);
|
||||||
|
|
||||||
|
void setPCF8574PortPin(uint pin, uint8_t value);// Set PCF8574 port pin
|
||||||
void setPortPin(uint pin, bool value); // Set port pin for extension port
|
void setPortPin(uint pin, bool value); // Set port pin for extension port
|
||||||
|
|
||||||
void togglePortPin(uint pin); // Toggle extension port pin
|
void togglePortPin(uint pin); // Toggle extension port pin
|
||||||
|
|
||||||
Color colorMapping(const String &colorString); // Color mapping string to CHSV colors
|
Color colorMapping(const String &colorString); // Color mapping string to CHSV colors
|
||||||
|
|||||||
@@ -79,9 +79,13 @@ FormattedData formatValue(GwApi::BoatValue *value, CommonData &commondata){
|
|||||||
const char* fmt_dec_10;
|
const char* fmt_dec_10;
|
||||||
const char* fmt_dec_100;
|
const char* fmt_dec_100;
|
||||||
if (precision == "1") {
|
if (precision == "1") {
|
||||||
fmt_dec_1 = "%3.1f";
|
//
|
||||||
fmt_dec_10 = "%3.0f";
|
//All values are displayed using a DSEG7* font. In this font, ' ' is a very short space, and '.' takes up no space at all.
|
||||||
fmt_dec_100 = "%3.0f";
|
//For a space that is as long as a number, '!' is used. For details see https://www.keshikan.net/fonts-e.html
|
||||||
|
//
|
||||||
|
fmt_dec_1 = "!%1.1f"; //insert a blank digit and then display a two-digit number
|
||||||
|
fmt_dec_10 = "!%2.0f"; //insert a blank digit and then display a two-digit number
|
||||||
|
fmt_dec_100 = "%3.0f"; //dispay a three digit number
|
||||||
} else {
|
} else {
|
||||||
fmt_dec_1 = "%3.2f";
|
fmt_dec_1 = "%3.2f";
|
||||||
fmt_dec_10 = "%3.1f";
|
fmt_dec_10 = "%3.1f";
|
||||||
|
|||||||
@@ -5,7 +5,8 @@
|
|||||||
// Direction pin for RS485 NMEA0183
|
// Direction pin for RS485 NMEA0183
|
||||||
#define OBP_DIRECTION_PIN 18
|
#define OBP_DIRECTION_PIN 18
|
||||||
// I2C
|
// I2C
|
||||||
#define I2C_SPEED 10000UL // 10kHz clock speed on I2C bus
|
#define I2C_SPEED 10000UL // 100kHz clock speed on I2C bus
|
||||||
|
#define I2C_SPEED_LOW 1000UL // 10kHz clock speed on I2C bus for external bus
|
||||||
#define OBP_I2C_SDA 47
|
#define OBP_I2C_SDA 47
|
||||||
#define OBP_I2C_SCL 21
|
#define OBP_I2C_SCL 21
|
||||||
// DS1388 RTC
|
// DS1388 RTC
|
||||||
@@ -42,6 +43,8 @@
|
|||||||
#define OBP_SPI_DIN 48
|
#define OBP_SPI_DIN 48
|
||||||
#define SHOW_TIME 6000 // Show time in [ms] for logo and WiFi QR code
|
#define SHOW_TIME 6000 // Show time in [ms] for logo and WiFi QR code
|
||||||
#define FULL_REFRESH_TIME 600 // Refresh cycle time in [s][600...3600] for full display update (very important healcy function)
|
#define FULL_REFRESH_TIME 600 // Refresh cycle time in [s][600...3600] for full display update (very important healcy function)
|
||||||
|
#define GxEPD_WIDTH 400 // Display width
|
||||||
|
#define GxEPD_HEIGHT 300 // Display height
|
||||||
|
|
||||||
// GPS (NEO-6M, NEO-M8N, ATGM336H)
|
// GPS (NEO-6M, NEO-M8N, ATGM336H)
|
||||||
#define OBP_GPS_RX 2
|
#define OBP_GPS_RX 2
|
||||||
@@ -83,6 +86,7 @@
|
|||||||
#define OBP_DIRECTION_PIN 8
|
#define OBP_DIRECTION_PIN 8
|
||||||
// I2C
|
// I2C
|
||||||
#define I2C_SPEED 100000UL // 100kHz clock speed on I2C bus
|
#define I2C_SPEED 100000UL // 100kHz clock speed on I2C bus
|
||||||
|
#define I2C_SPEED_LOW 1000UL // 10kHz clock speed on I2C bus for external bus
|
||||||
#define OBP_I2C_SDA 21
|
#define OBP_I2C_SDA 21
|
||||||
#define OBP_I2C_SCL 38
|
#define OBP_I2C_SCL 38
|
||||||
// DS1388 RTC
|
// DS1388 RTC
|
||||||
@@ -119,6 +123,8 @@
|
|||||||
#define OBP_SPI_DIN 11
|
#define OBP_SPI_DIN 11
|
||||||
#define SHOW_TIME 6000 // Show time in [ms] for logo and WiFi QR code
|
#define SHOW_TIME 6000 // Show time in [ms] for logo and WiFi QR code
|
||||||
#define FULL_REFRESH_TIME 600 // Refresh cycle time in [s][600...3600] for full display update (very important healcy function)
|
#define FULL_REFRESH_TIME 600 // Refresh cycle time in [s][600...3600] for full display update (very important healcy function)
|
||||||
|
#define GxEPD_WIDTH 400 // Display width
|
||||||
|
#define GxEPD_HEIGHT 300 // Display height
|
||||||
// SPI SD-Card
|
// SPI SD-Card
|
||||||
#define SD_SPI_CS GPIO_NUM_10
|
#define SD_SPI_CS GPIO_NUM_10
|
||||||
#define SD_SPI_MOSI GPIO_NUM_40
|
#define SD_SPI_MOSI GPIO_NUM_40
|
||||||
|
|||||||
131
lib/obp60task/PageDigitalOut.cpp
Normal file
131
lib/obp60task/PageDigitalOut.cpp
Normal file
@@ -0,0 +1,131 @@
|
|||||||
|
#if defined BOARD_OBP60S3 || defined BOARD_OBP40S3
|
||||||
|
|
||||||
|
#include <PCF8574.h> // PCF8574 modules from Horter
|
||||||
|
#include "Pagedata.h"
|
||||||
|
#include "OBP60Extensions.h"
|
||||||
|
|
||||||
|
#include "images/OBP_400x300.xbm" // OBP Logo
|
||||||
|
#ifdef BOARD_OBP60S3
|
||||||
|
#include "images/OBP60_400x300.xbm" // MFD with logo
|
||||||
|
#endif
|
||||||
|
#ifdef BOARD_OBP40S3
|
||||||
|
#include "images/OBP40_400x300.xbm" // MFD with logo
|
||||||
|
#endif
|
||||||
|
|
||||||
|
class PageDigitalOut : public Page
|
||||||
|
{
|
||||||
|
|
||||||
|
// Status values
|
||||||
|
bool button1 = false;
|
||||||
|
bool button2 = false;
|
||||||
|
bool button3 = false;
|
||||||
|
bool button4 = false;
|
||||||
|
bool button5 = false;
|
||||||
|
|
||||||
|
public:
|
||||||
|
PageDigitalOut(CommonData &common){
|
||||||
|
commonData = &common;
|
||||||
|
common.logger->logDebug(GwLog::LOG,"Instantiate PageDigitalOut");
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual int handleKey(int key){
|
||||||
|
// Code for keylock
|
||||||
|
if(key == 11){
|
||||||
|
commonData->keylock = !commonData->keylock;
|
||||||
|
return 0; // Commit the key
|
||||||
|
}
|
||||||
|
// Code for button 1
|
||||||
|
if(key == 1){
|
||||||
|
button1 = !button1;
|
||||||
|
setPCF8574PortPin(0, button1 ? 0 : 1); // Attention! Inverse logic for PCF8574
|
||||||
|
return 0; // Commit the key
|
||||||
|
}
|
||||||
|
// Code for button 2
|
||||||
|
if(key == 2){
|
||||||
|
button2 = !button2;
|
||||||
|
setPCF8574PortPin(1, button2 ? 0 : 1); // Attention! Inverse logic for PCF8574
|
||||||
|
return 0; // Commit the key
|
||||||
|
}
|
||||||
|
// Code for button 3
|
||||||
|
if(key == 3){
|
||||||
|
button3 = !button3;
|
||||||
|
setPCF8574PortPin(2, button3 ? 0 : 1); // Attention! Inverse logic for PCF8574
|
||||||
|
return 0; // Commit the key
|
||||||
|
}
|
||||||
|
// Code for button 4
|
||||||
|
if(key == 4){
|
||||||
|
button4 = !button4;
|
||||||
|
setPCF8574PortPin(3, button4 ? 0 : 1); // Attention! Inverse logic for PCF8574
|
||||||
|
return 0; // Commit the key
|
||||||
|
}
|
||||||
|
// Code for button 5
|
||||||
|
if(key == 5){
|
||||||
|
button5 = !button5;
|
||||||
|
setPCF8574PortPin(4, button5 ? 0 : 1); // Attention! Inverse logic for PCF8574
|
||||||
|
return 0; // Commit the key
|
||||||
|
}
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
int displayPage(PageData &pageData){
|
||||||
|
GwConfigHandler *config = commonData->config;
|
||||||
|
GwLog *logger = commonData->logger;
|
||||||
|
|
||||||
|
// Get config data
|
||||||
|
String lengthformat = config->getString(config->lengthFormat);
|
||||||
|
bool simulation = config->getBool(config->useSimuData);
|
||||||
|
bool holdvalues = config->getBool(config->holdvalues);
|
||||||
|
String flashLED = config->getString(config->flashLED);
|
||||||
|
String backlightMode = config->getString(config->backlight);
|
||||||
|
|
||||||
|
// Optical warning by limit violation (unused)
|
||||||
|
if(String(flashLED) == "Limit Violation"){
|
||||||
|
setBlinkingLED(false);
|
||||||
|
setFlashLED(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Logging boat values
|
||||||
|
LOG_DEBUG(GwLog::LOG,"Drawing at PageDigitalOut");
|
||||||
|
|
||||||
|
// Draw page
|
||||||
|
//***********************************************************
|
||||||
|
|
||||||
|
// Set display in partial refresh mode
|
||||||
|
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||||
|
getdisplay().setTextColor(commonData->fgcolor);
|
||||||
|
getdisplay().setFont(&Ubuntu_Bold12pt8b);
|
||||||
|
getdisplay().fillRoundRect(200, 250 , 200, 25, 5, commonData->fgcolor); // Black rect
|
||||||
|
getdisplay().fillRoundRect(202, 252 , 196, 21, 5, commonData->bgcolor); // White rect
|
||||||
|
getdisplay().setCursor(210, 270);
|
||||||
|
getdisplay().print("Map server lost");
|
||||||
|
|
||||||
|
// Set botton labels
|
||||||
|
commonData->keydata[0].label = "BTN 1";
|
||||||
|
commonData->keydata[1].label = "BTN 2";
|
||||||
|
commonData->keydata[2].label = "BTN 3";
|
||||||
|
commonData->keydata[3].label = "BTN 4";
|
||||||
|
commonData->keydata[4].label = "BTN 5";
|
||||||
|
|
||||||
|
return PAGE_UPDATE;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
static Page* createPage(CommonData &common){
|
||||||
|
return new PageDigitalOut(common);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* with the code below we make this page known to the PageTask
|
||||||
|
* we give it a type (name) that can be selected in the config
|
||||||
|
* we define which function is to be called
|
||||||
|
* and we provide the number of user parameters we expect
|
||||||
|
* this will be number of BoatValue pointers in pageData.values
|
||||||
|
*/
|
||||||
|
PageDescription registerPageDigitalOut(
|
||||||
|
"DigitalOut", // Page name
|
||||||
|
createPage, // Action
|
||||||
|
0, // Number of bus values depends on selection in Web configuration
|
||||||
|
true // Show display header on/off
|
||||||
|
);
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -19,10 +19,18 @@ bool firstRun = true; // Detect the first page run
|
|||||||
int zoom = 15; // Default zoom level
|
int zoom = 15; // Default zoom level
|
||||||
bool showValues = false; // Show values HDT, SOG, DBT in navigation map
|
bool showValues = false; // Show values HDT, SOG, DBT in navigation map
|
||||||
|
|
||||||
|
private:
|
||||||
|
uint8_t* imageBackupData = nullptr;
|
||||||
|
int imageBackupWidth = 0;
|
||||||
|
int imageBackupHeight = 0;
|
||||||
|
size_t imageBackupSize = 0;
|
||||||
|
bool hasImageBackup = false;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageNavigation(CommonData &common){
|
PageNavigation(CommonData &common){
|
||||||
commonData = &common;
|
commonData = &common;
|
||||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageNavigation");
|
common.logger->logDebug(GwLog::LOG,"Instantiate PageNavigation");
|
||||||
|
imageBackupData = (uint8_t*)heap_caps_malloc((GxEPD_WIDTH * GxEPD_HEIGHT), MALLOC_CAP_SPIRAM);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int handleKey(int key){
|
virtual int handleKey(int key){
|
||||||
@@ -31,7 +39,7 @@ public:
|
|||||||
commonData->keylock = !commonData->keylock;
|
commonData->keylock = !commonData->keylock;
|
||||||
return 0; // Commit the key
|
return 0; // Commit the key
|
||||||
}
|
}
|
||||||
// Cood for zoom -
|
// Code for zoom -
|
||||||
if(key == 1){
|
if(key == 1){
|
||||||
zoom --; // Zoom -
|
zoom --; // Zoom -
|
||||||
if(zoom <7){
|
if(zoom <7){
|
||||||
@@ -39,7 +47,7 @@ public:
|
|||||||
}
|
}
|
||||||
return 0; // Commit the key
|
return 0; // Commit the key
|
||||||
}
|
}
|
||||||
// Cood for zoom -
|
// Code for zoom -
|
||||||
if(key == 2){
|
if(key == 2){
|
||||||
zoom ++; // Zoom +
|
zoom ++; // Zoom +
|
||||||
if(zoom >17){
|
if(zoom >17){
|
||||||
@@ -60,7 +68,7 @@ public:
|
|||||||
|
|
||||||
// Get config data
|
// Get config data
|
||||||
String lengthformat = config->getString(config->lengthFormat);
|
String lengthformat = config->getString(config->lengthFormat);
|
||||||
// bool simulation = config->getBool(config->useSimuData);
|
bool simulation = config->getBool(config->useSimuData);
|
||||||
bool holdvalues = config->getBool(config->holdvalues);
|
bool holdvalues = config->getBool(config->holdvalues);
|
||||||
String flashLED = config->getString(config->flashLED);
|
String flashLED = config->getString(config->flashLED);
|
||||||
String backlightMode = config->getString(config->backlight);
|
String backlightMode = config->getString(config->backlight);
|
||||||
@@ -72,9 +80,12 @@ public:
|
|||||||
bool grid = config->getBool(config->grid);
|
bool grid = config->getBool(config->grid);
|
||||||
String orientation = config->getString(config->orientation);
|
String orientation = config->getString(config->orientation);
|
||||||
int refreshDistance = config->getInt(config->refreshDistance);
|
int refreshDistance = config->getInt(config->refreshDistance);
|
||||||
|
bool showValuesMap = config->getBool(config->showvalues);
|
||||||
|
bool ownHeading = config->getBool(config->ownheading);
|
||||||
|
|
||||||
if(firstRun == true){
|
if(firstRun == true){
|
||||||
zoom = zoomLevel; // Over write zoom level with setup value
|
zoom = zoomLevel; // Over write zoom level with setup value
|
||||||
|
showValues = showValuesMap; // Over write showValues with setup value
|
||||||
firstRun = false; // Restet variable
|
firstRun = false; // Restet variable
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,11 +120,16 @@ public:
|
|||||||
static String unit6old = "";
|
static String unit6old = "";
|
||||||
|
|
||||||
static double latitude = 0;
|
static double latitude = 0;
|
||||||
|
static double latitudeold = 0;
|
||||||
static double longitude = 0;
|
static double longitude = 0;
|
||||||
|
static double longitudeold = 0;
|
||||||
static double trueHeading = 0;
|
static double trueHeading = 0;
|
||||||
static double magneticHeading = 0;
|
static double magneticHeading = 0;
|
||||||
static double speedOverGround = 0;
|
static double speedOverGround = 0;
|
||||||
static double depthBelowTransducer = 0;
|
static double depthBelowTransducer = 0;
|
||||||
|
static int lostCounter = 0; // Counter for connection lost to the map server (increment by each page refresh)
|
||||||
|
int imgWidth = 0;
|
||||||
|
int imgHeight = 0;
|
||||||
|
|
||||||
// Get boat values #1 Latitude
|
// Get boat values #1 Latitude
|
||||||
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue)
|
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue)
|
||||||
@@ -185,6 +201,7 @@ public:
|
|||||||
// Latitude
|
// Latitude
|
||||||
if(valid1){
|
if(valid1){
|
||||||
latitude = value1;
|
latitude = value1;
|
||||||
|
latitudeold = value1;
|
||||||
value3old = value1;
|
value3old = value1;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
@@ -193,6 +210,7 @@ public:
|
|||||||
// Longitude
|
// Longitude
|
||||||
if(valid2){
|
if(valid2){
|
||||||
longitude = value2;
|
longitude = value2;
|
||||||
|
longitudeold = value2;
|
||||||
value2old = value2;
|
value2old = value2;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
@@ -353,8 +371,8 @@ public:
|
|||||||
|
|
||||||
auto& json = net.json(); // Extract JSON content
|
auto& json = net.json(); // Extract JSON content
|
||||||
int numPix = json["number_pixels"] | 0; // Read number of pixels
|
int numPix = json["number_pixels"] | 0; // Read number of pixels
|
||||||
int imgWidth = json["width"] | 0; // Read width of image
|
imgWidth = json["width"] | 0; // Read width of image
|
||||||
int imgHeight = json["height"] | 0; // Read height og image
|
imgHeight = json["height"] | 0; // Read height og image
|
||||||
|
|
||||||
const char* b64src = json["picture_base64"].as<const char*>(); // Read picture as Base64 content
|
const char* b64src = json["picture_base64"].as<const char*>(); // Read picture as Base64 content
|
||||||
size_t b64len = strlen(b64src); // Calculate length of Base64 content
|
size_t b64len = strlen(b64src); // Calculate length of Base64 content
|
||||||
@@ -380,6 +398,17 @@ public:
|
|||||||
size_t decodedSize = 0;
|
size_t decodedSize = 0;
|
||||||
decoder.decodeBase64(b64, imageData, imgSize, decodedSize);
|
decoder.decodeBase64(b64, imageData, imgSize, decodedSize);
|
||||||
|
|
||||||
|
// Copy actual navigation man to ackup map
|
||||||
|
imageBackupWidth = imgWidth;
|
||||||
|
imageBackupHeight = imgHeight;
|
||||||
|
imageBackupSize = imgSize;
|
||||||
|
if (decodedSize > 0) {
|
||||||
|
memcpy(imageBackupData, imageData, decodedSize);
|
||||||
|
imageBackupSize = decodedSize;
|
||||||
|
}
|
||||||
|
hasImageBackup = true;
|
||||||
|
lostCounter = 0;
|
||||||
|
|
||||||
// Show image (navigation map)
|
// Show image (navigation map)
|
||||||
getdisplay().drawBitmap(0, 25, imageData, imgWidth, imgHeight, commonData->fgcolor);
|
getdisplay().drawBitmap(0, 25, imageData, imgWidth, imgHeight, commonData->fgcolor);
|
||||||
|
|
||||||
@@ -387,6 +416,25 @@ public:
|
|||||||
free(b64);
|
free(b64);
|
||||||
free(imageData);
|
free(imageData);
|
||||||
}
|
}
|
||||||
|
// If no network connection then use backup navigation map
|
||||||
|
else{
|
||||||
|
// Show backup image (backup navigation map)
|
||||||
|
if (hasImageBackup) {
|
||||||
|
getdisplay().drawBitmap(0, 25, imageBackupData, imageBackupWidth, imageBackupHeight, commonData->fgcolor);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show info: Connection lost when 5 page refreshes has a connection lost to the map server
|
||||||
|
// Short connection losts are uncritical
|
||||||
|
if(lostCounter >= 5){
|
||||||
|
getdisplay().setFont(&Ubuntu_Bold12pt8b);
|
||||||
|
getdisplay().fillRect(200, 250 , 200, 25, commonData->fgcolor); // Black rect
|
||||||
|
getdisplay().fillRect(202, 252 , 196, 21, commonData->bgcolor); // White rect
|
||||||
|
getdisplay().setCursor(210, 270);
|
||||||
|
getdisplay().print("Map server lost");
|
||||||
|
}
|
||||||
|
|
||||||
|
lostCounter++; // Increment lost counter
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ############### Draw Values ################
|
// ############### Draw Values ################
|
||||||
|
|||||||
@@ -934,11 +934,14 @@
|
|||||||
"type": "string",
|
"type": "string",
|
||||||
"default": "192.168.15.10",
|
"default": "192.168.15.10",
|
||||||
"check": "checkIpAddress",
|
"check": "checkIpAddress",
|
||||||
"description": "IP address only for local map service e.g. 192.168.15.10\nor an MDNS name like Raspi.local",
|
"description": "IP address for local map service e.g. 192.168.15.10\nor an MDNS name like Raspi.local",
|
||||||
"category": "OBP60 Navigation",
|
"category": "OBP60 Navigation",
|
||||||
"capabilities": {
|
"capabilities": {
|
||||||
"obp60":"true"
|
"obp60":"true"
|
||||||
}
|
},
|
||||||
|
"condition": [
|
||||||
|
{ "mapsource": ["Local Service"] }
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "localPort",
|
"name": "localPort",
|
||||||
@@ -947,10 +950,13 @@
|
|||||||
"default": "8080",
|
"default": "8080",
|
||||||
"check":"checkPort",
|
"check":"checkPort",
|
||||||
"description": "TCP port for local map server",
|
"description": "TCP port for local map server",
|
||||||
"category": "TCP client",
|
"category": "OBP60 Navigation",
|
||||||
"capabilities": {
|
"capabilities": {
|
||||||
"obp60":"true"
|
"obp60":"true"
|
||||||
}
|
},
|
||||||
|
"condition": [
|
||||||
|
{ "mapsource": ["Local Service"] }
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "maptype",
|
"name": "maptype",
|
||||||
@@ -971,25 +977,28 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "zoomlevel",
|
"name": "refreshDistance",
|
||||||
"label": "Default Zool Level",
|
"label": "Refresh Distance [m]",
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"default": "15",
|
"default": "15",
|
||||||
"check": "checkMinMax",
|
"check": "checkMinMax",
|
||||||
"min": 7,
|
"min": 1,
|
||||||
"max": 17,
|
"max": 50,
|
||||||
"description": "Zoom level for map [7..17]; 15 = default",
|
"description": "Refresh distance between updates [1..50 m], 15 m = default",
|
||||||
"category": "OBP60 Navigation",
|
"category": "OBP60 Navigation",
|
||||||
"capabilities": {
|
"capabilities": {
|
||||||
"obp60":"true"
|
"obp60":"true"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "grid",
|
"name": "zoomlevel",
|
||||||
"label": "Show Grid",
|
"label": "Default Zoom Level",
|
||||||
"type": "boolean",
|
"type": "number",
|
||||||
"default": "false",
|
"default": "15",
|
||||||
"description": "Show the grid for latutude and longitude",
|
"check": "checkMinMax",
|
||||||
|
"min": 7,
|
||||||
|
"max": 17,
|
||||||
|
"description": "Start zoom level for map [7..17]; 15 = default",
|
||||||
"category": "OBP60 Navigation",
|
"category": "OBP60 Navigation",
|
||||||
"capabilities": {
|
"capabilities": {
|
||||||
"obp60":"true"
|
"obp60":"true"
|
||||||
@@ -1011,14 +1020,33 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "refreshDistance",
|
"name": "grid",
|
||||||
"label": "Refresh Distance [m]",
|
"label": "Show Grid",
|
||||||
"type": "number",
|
"type": "boolean",
|
||||||
"default": "15",
|
"default": "false",
|
||||||
"check": "checkMinMax",
|
"description": "Show the grid for latutude and longitude",
|
||||||
"min": 1,
|
"category": "OBP60 Navigation",
|
||||||
"max": 50,
|
"capabilities": {
|
||||||
"description": "Refresh distance between updates [1..50 m], 15 m = default",
|
"obp60": "true"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "showvalues",
|
||||||
|
"label": "Show Values",
|
||||||
|
"type": "boolean",
|
||||||
|
"default": "false",
|
||||||
|
"description": "Show boat data values in the left upper map corner",
|
||||||
|
"category": "OBP60 Navigation",
|
||||||
|
"capabilities": {
|
||||||
|
"obp60": "true"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ownheading",
|
||||||
|
"label": "Alternativ Heading",
|
||||||
|
"type": "boolean",
|
||||||
|
"default": "false",
|
||||||
|
"description": "Calculating an alternative travel direction for\na better and calmer map orientation",
|
||||||
"category": "OBP60 Navigation",
|
"category": "OBP60 Navigation",
|
||||||
"capabilities": {
|
"capabilities": {
|
||||||
"obp60": "true"
|
"obp60": "true"
|
||||||
@@ -1336,6 +1364,7 @@
|
|||||||
"Battery2",
|
"Battery2",
|
||||||
"Clock",
|
"Clock",
|
||||||
"Compass",
|
"Compass",
|
||||||
|
"DigitalOut",
|
||||||
"DST810",
|
"DST810",
|
||||||
"Fluid",
|
"Fluid",
|
||||||
"FourValues",
|
"FourValues",
|
||||||
@@ -1635,6 +1664,7 @@
|
|||||||
"Battery2",
|
"Battery2",
|
||||||
"Clock",
|
"Clock",
|
||||||
"Compass",
|
"Compass",
|
||||||
|
"DigitalOut",
|
||||||
"DST810",
|
"DST810",
|
||||||
"Fluid",
|
"Fluid",
|
||||||
"FourValues",
|
"FourValues",
|
||||||
@@ -1926,6 +1956,7 @@
|
|||||||
"Battery2",
|
"Battery2",
|
||||||
"Clock",
|
"Clock",
|
||||||
"Compass",
|
"Compass",
|
||||||
|
"DigitalOut",
|
||||||
"DST810",
|
"DST810",
|
||||||
"Fluid",
|
"Fluid",
|
||||||
"FourValues",
|
"FourValues",
|
||||||
@@ -2209,6 +2240,7 @@
|
|||||||
"Battery2",
|
"Battery2",
|
||||||
"Clock",
|
"Clock",
|
||||||
"Compass",
|
"Compass",
|
||||||
|
"DigitalOut",
|
||||||
"DST810",
|
"DST810",
|
||||||
"Fluid",
|
"Fluid",
|
||||||
"FourValues",
|
"FourValues",
|
||||||
@@ -2484,6 +2516,7 @@
|
|||||||
"Battery2",
|
"Battery2",
|
||||||
"Clock",
|
"Clock",
|
||||||
"Compass",
|
"Compass",
|
||||||
|
"DigitalOut",
|
||||||
"DST810",
|
"DST810",
|
||||||
"Fluid",
|
"Fluid",
|
||||||
"FourValues",
|
"FourValues",
|
||||||
@@ -2751,6 +2784,7 @@
|
|||||||
"Battery2",
|
"Battery2",
|
||||||
"Clock",
|
"Clock",
|
||||||
"Compass",
|
"Compass",
|
||||||
|
"DigitalOut",
|
||||||
"DST810",
|
"DST810",
|
||||||
"Fluid",
|
"Fluid",
|
||||||
"FourValues",
|
"FourValues",
|
||||||
@@ -3010,6 +3044,7 @@
|
|||||||
"Battery2",
|
"Battery2",
|
||||||
"Clock",
|
"Clock",
|
||||||
"Compass",
|
"Compass",
|
||||||
|
"DigitalOut",
|
||||||
"DST810",
|
"DST810",
|
||||||
"Fluid",
|
"Fluid",
|
||||||
"FourValues",
|
"FourValues",
|
||||||
@@ -3261,6 +3296,7 @@
|
|||||||
"Battery2",
|
"Battery2",
|
||||||
"Clock",
|
"Clock",
|
||||||
"Compass",
|
"Compass",
|
||||||
|
"DigitalOut",
|
||||||
"DST810",
|
"DST810",
|
||||||
"Fluid",
|
"Fluid",
|
||||||
"FourValues",
|
"FourValues",
|
||||||
@@ -3504,6 +3540,7 @@
|
|||||||
"Battery2",
|
"Battery2",
|
||||||
"Clock",
|
"Clock",
|
||||||
"Compass",
|
"Compass",
|
||||||
|
"DigitalOut",
|
||||||
"DST810",
|
"DST810",
|
||||||
"Fluid",
|
"Fluid",
|
||||||
"FourValues",
|
"FourValues",
|
||||||
@@ -3739,6 +3776,7 @@
|
|||||||
"Battery2",
|
"Battery2",
|
||||||
"Clock",
|
"Clock",
|
||||||
"Compass",
|
"Compass",
|
||||||
|
"DigitalOut",
|
||||||
"DST810",
|
"DST810",
|
||||||
"Fluid",
|
"Fluid",
|
||||||
"FourValues",
|
"FourValues",
|
||||||
|
|||||||
@@ -934,7 +934,7 @@
|
|||||||
"OBP Service",
|
"OBP Service",
|
||||||
"Local Service"
|
"Local Service"
|
||||||
],
|
],
|
||||||
"category": "OBP60 Navigation",
|
"category": "OBP40 Navigation",
|
||||||
"capabilities": {
|
"capabilities": {
|
||||||
"obp40":"true"
|
"obp40":"true"
|
||||||
}
|
}
|
||||||
@@ -945,11 +945,14 @@
|
|||||||
"type": "string",
|
"type": "string",
|
||||||
"default": "192.168.15.10",
|
"default": "192.168.15.10",
|
||||||
"check": "checkIpAddress",
|
"check": "checkIpAddress",
|
||||||
"description": "IP address only for local map service e.g. 192.168.15.10\nor an MDNS name like Raspi.local",
|
"description": "IP address for local map service e.g. 192.168.15.10\nor an MDNS name like Raspi.local",
|
||||||
"category": "OBP60 Navigation",
|
"category": "OBP40 Navigation",
|
||||||
"capabilities": {
|
"capabilities": {
|
||||||
"obp40":"true"
|
"obp40":"true"
|
||||||
}
|
},
|
||||||
|
"condition": [
|
||||||
|
{ "mapsource": ["Local Service"] }
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "localPort",
|
"name": "localPort",
|
||||||
@@ -958,10 +961,13 @@
|
|||||||
"default": "8080",
|
"default": "8080",
|
||||||
"check":"checkPort",
|
"check":"checkPort",
|
||||||
"description": "TCP port for local map server",
|
"description": "TCP port for local map server",
|
||||||
"category": "TCP client",
|
"category": "OBP40 Navigation",
|
||||||
"capabilities": {
|
"capabilities": {
|
||||||
"obp40":"true"
|
"obp40":"true"
|
||||||
}
|
},
|
||||||
|
"condition": [
|
||||||
|
{ "mapsource": ["Local Service"] }
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "maptype",
|
"name": "maptype",
|
||||||
@@ -976,32 +982,35 @@
|
|||||||
"Stadimaps Toner",
|
"Stadimaps Toner",
|
||||||
"Free Nautical Chart"
|
"Free Nautical Chart"
|
||||||
],
|
],
|
||||||
"category": "OBP60 Navigation",
|
"category": "OBP40 Navigation",
|
||||||
|
"capabilities": {
|
||||||
|
"obp40":"true"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "refreshDistance",
|
||||||
|
"label": "Refresh Distance [m]",
|
||||||
|
"type": "number",
|
||||||
|
"default": "15",
|
||||||
|
"check": "checkMinMax",
|
||||||
|
"min": 1,
|
||||||
|
"max": 50,
|
||||||
|
"description": "Refresh distance between updates [1..50 m], 15 m = default",
|
||||||
|
"category": "OBP40 Navigation",
|
||||||
"capabilities": {
|
"capabilities": {
|
||||||
"obp40":"true"
|
"obp40":"true"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "zoomlevel",
|
"name": "zoomlevel",
|
||||||
"label": "Default Zool Level",
|
"label": "Default Zoom Level",
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"default": "15",
|
"default": "15",
|
||||||
"check": "checkMinMax",
|
"check": "checkMinMax",
|
||||||
"min": 7,
|
"min": 7,
|
||||||
"max": 17,
|
"max": 17,
|
||||||
"description": "Zoom level for map [7..17]; 15 = default",
|
"description": "Start zoom level for map [7..17]; 15 = default",
|
||||||
"category": "OBP60 Navigation",
|
"category": "OBP40 Navigation",
|
||||||
"capabilities": {
|
|
||||||
"obp40":"true"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "grid",
|
|
||||||
"label": "Show Grid",
|
|
||||||
"type": "boolean",
|
|
||||||
"default": "false",
|
|
||||||
"description": "Show the grid for latutude and longitude",
|
|
||||||
"category": "OBP60 Navigation",
|
|
||||||
"capabilities": {
|
"capabilities": {
|
||||||
"obp40":"true"
|
"obp40":"true"
|
||||||
}
|
}
|
||||||
@@ -1016,21 +1025,40 @@
|
|||||||
"North Direction",
|
"North Direction",
|
||||||
"Travel Direction"
|
"Travel Direction"
|
||||||
],
|
],
|
||||||
"category": "OBP60 Navigation",
|
"category": "OBP40 Navigation",
|
||||||
"capabilities": {
|
"capabilities": {
|
||||||
"obp40":"true"
|
"obp40":"true"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "refreshDistance",
|
"name": "grid",
|
||||||
"label": "Refresh Distance [m]",
|
"label": "Show Grid",
|
||||||
"type": "number",
|
"type": "boolean",
|
||||||
"default": "15",
|
"default": "false",
|
||||||
"check": "checkMinMax",
|
"description": "Show the grid for latutude and longitude",
|
||||||
"min": 1,
|
"category": "OBP40 Navigation",
|
||||||
"max": 50,
|
"capabilities": {
|
||||||
"description": "Refresh distance between updates [1..50 m], 15 m = default",
|
"obp40": "true"
|
||||||
"category": "OBP60 Navigation",
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "showvalues",
|
||||||
|
"label": "Show Values",
|
||||||
|
"type": "boolean",
|
||||||
|
"default": "false",
|
||||||
|
"description": "Show boat data values in the left upper map corner",
|
||||||
|
"category": "OBP40 Navigation",
|
||||||
|
"capabilities": {
|
||||||
|
"obp40": "true"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ownheading",
|
||||||
|
"label": "Alternativ Heading",
|
||||||
|
"type": "boolean",
|
||||||
|
"default": "false",
|
||||||
|
"description": "Calculating an alternative travel direction for\na better and calmer map orientation",
|
||||||
|
"category": "OBP40 Navigation",
|
||||||
"capabilities": {
|
"capabilities": {
|
||||||
"obp40": "true"
|
"obp40": "true"
|
||||||
}
|
}
|
||||||
@@ -1359,6 +1387,7 @@
|
|||||||
"Battery2",
|
"Battery2",
|
||||||
"Clock",
|
"Clock",
|
||||||
"Compass",
|
"Compass",
|
||||||
|
"DigitalOut",
|
||||||
"DST810",
|
"DST810",
|
||||||
"Fluid",
|
"Fluid",
|
||||||
"FourValues",
|
"FourValues",
|
||||||
@@ -1688,6 +1717,7 @@
|
|||||||
"Battery2",
|
"Battery2",
|
||||||
"Clock",
|
"Clock",
|
||||||
"Compass",
|
"Compass",
|
||||||
|
"DigitalOut",
|
||||||
"DST810",
|
"DST810",
|
||||||
"Fluid",
|
"Fluid",
|
||||||
"FourValues",
|
"FourValues",
|
||||||
@@ -2008,6 +2038,7 @@
|
|||||||
"Battery2",
|
"Battery2",
|
||||||
"Clock",
|
"Clock",
|
||||||
"Compass",
|
"Compass",
|
||||||
|
"DigitalOut",
|
||||||
"DST810",
|
"DST810",
|
||||||
"Fluid",
|
"Fluid",
|
||||||
"FourValues",
|
"FourValues",
|
||||||
@@ -2319,6 +2350,7 @@
|
|||||||
"Battery2",
|
"Battery2",
|
||||||
"Clock",
|
"Clock",
|
||||||
"Compass",
|
"Compass",
|
||||||
|
"DigitalOut",
|
||||||
"DST810",
|
"DST810",
|
||||||
"Fluid",
|
"Fluid",
|
||||||
"FourValues",
|
"FourValues",
|
||||||
@@ -2621,6 +2653,7 @@
|
|||||||
"Battery2",
|
"Battery2",
|
||||||
"Clock",
|
"Clock",
|
||||||
"Compass",
|
"Compass",
|
||||||
|
"DigitalOut",
|
||||||
"DST810",
|
"DST810",
|
||||||
"Fluid",
|
"Fluid",
|
||||||
"FourValues",
|
"FourValues",
|
||||||
@@ -2914,6 +2947,7 @@
|
|||||||
"Battery2",
|
"Battery2",
|
||||||
"Clock",
|
"Clock",
|
||||||
"Compass",
|
"Compass",
|
||||||
|
"DigitalOut",
|
||||||
"DST810",
|
"DST810",
|
||||||
"Fluid",
|
"Fluid",
|
||||||
"FourValues",
|
"FourValues",
|
||||||
@@ -3198,6 +3232,7 @@
|
|||||||
"Battery2",
|
"Battery2",
|
||||||
"Clock",
|
"Clock",
|
||||||
"Compass",
|
"Compass",
|
||||||
|
"DigitalOut",
|
||||||
"DST810",
|
"DST810",
|
||||||
"Fluid",
|
"Fluid",
|
||||||
"FourValues",
|
"FourValues",
|
||||||
@@ -3473,6 +3508,7 @@
|
|||||||
"Battery2",
|
"Battery2",
|
||||||
"Clock",
|
"Clock",
|
||||||
"Compass",
|
"Compass",
|
||||||
|
"DigitalOut",
|
||||||
"DST810",
|
"DST810",
|
||||||
"Fluid",
|
"Fluid",
|
||||||
"FourValues",
|
"FourValues",
|
||||||
@@ -3739,6 +3775,7 @@
|
|||||||
"Battery2",
|
"Battery2",
|
||||||
"Clock",
|
"Clock",
|
||||||
"Compass",
|
"Compass",
|
||||||
|
"DigitalOut",
|
||||||
"DST810",
|
"DST810",
|
||||||
"Fluid",
|
"Fluid",
|
||||||
"FourValues",
|
"FourValues",
|
||||||
@@ -3996,6 +4033,7 @@
|
|||||||
"Battery2",
|
"Battery2",
|
||||||
"Clock",
|
"Clock",
|
||||||
"Compass",
|
"Compass",
|
||||||
|
"DigitalOut",
|
||||||
"DST810",
|
"DST810",
|
||||||
"Fluid",
|
"Fluid",
|
||||||
"FourValues",
|
"FourValues",
|
||||||
|
|||||||
@@ -262,6 +262,8 @@ void registerAllPages(PageList &list){
|
|||||||
list.add(®isterPageSkyView);
|
list.add(®isterPageSkyView);
|
||||||
extern PageDescription registerPageNavigation;
|
extern PageDescription registerPageNavigation;
|
||||||
list.add(®isterPageNavigation);
|
list.add(®isterPageNavigation);
|
||||||
|
extern PageDescription registerPageDigitalOut;
|
||||||
|
list.add(®isterPageDigitalOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Undervoltage detection for shutdown display
|
// Undervoltage detection for shutdown display
|
||||||
@@ -430,7 +432,7 @@ void OBP60Task(GwApi *api){
|
|||||||
#endif
|
#endif
|
||||||
LOG_DEBUG(GwLog::LOG,"...done");
|
LOG_DEBUG(GwLog::LOG,"...done");
|
||||||
|
|
||||||
int lastPage=pageNumber;
|
int lastPage=-1; // initialize with an impiossible value, so we can detect wether we are during startup and no page has been displayed yet
|
||||||
|
|
||||||
BoatValueList boatValues; //all the boat values for the api query
|
BoatValueList boatValues; //all the boat values for the api query
|
||||||
HstryBuffers hstryBufList(1920, &boatValues, logger); // Create empty list of boat data history buffers
|
HstryBuffers hstryBufList(1920, &boatValues, logger); // Create empty list of boat data history buffers
|
||||||
@@ -852,8 +854,10 @@ void OBP60Task(GwApi *api){
|
|||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if (lastPage != pageNumber){
|
if (lastPage != pageNumber){
|
||||||
|
if (lastPage != -1){ // skip cleanup if we are during startup, and no page has been displayed yet.
|
||||||
pages[lastPage].page->leavePage(pages[lastPage].parameters); // call page cleanup code
|
pages[lastPage].page->leavePage(pages[lastPage].parameters); // call page cleanup code
|
||||||
if (hasFRAM) fram.write(FRAM_PAGE_NO, pageNumber); // remember new page for device restart
|
if (hasFRAM) fram.write(FRAM_PAGE_NO, pageNumber); // remember new page for device restart
|
||||||
|
}
|
||||||
currentPage->setupKeys();
|
currentPage->setupKeys();
|
||||||
currentPage->displayNew(pages[pageNumber].parameters);
|
currentPage->displayNew(pages[pageNumber].parameters);
|
||||||
lastPage = pageNumber;
|
lastPage = pageNumber;
|
||||||
|
|||||||
Reference in New Issue
Block a user