diff --git a/lib/obp60task/OBP60Extensions.cpp b/lib/obp60task/OBP60Extensions.cpp index de153db..c8729f9 100644 --- a/lib/obp60task/OBP60Extensions.cpp +++ b/lib/obp60task/OBP60Extensions.cpp @@ -1,9 +1,9 @@ #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #include -#include // Driver for PCF8574 output modul from Horter #include // I2C #include // Driver for DS1388 RTC +#include // PCF8574 modules from Horter #include "SunRise.h" // Lib for sunrise and sunset calculation #include "Pagedata.h" #include "OBP60Hardware.h" @@ -27,9 +27,7 @@ #include "fonts/IBM8x8px.h" // E-Ink Display -#define GxEPD_WIDTH 400 // Display width -#define GxEPD_HEIGHT 300 // Display height - +// Definition for e-paper width an height refer OBP60Hardware.h #ifdef DISPLAY_GDEW042T2 // Set display type and SPI pins for display GxEPD2_BW 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(); // 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 pcf8574_Out.write8(255); // Clear all outputs } + Wire.setClock(I2C_SPEED); // Set I2C clock on 100 kHz fram = Adafruit_FRAM_I2C(); if (esp_reset_reason() == ESP_RST_POWERON) { // 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){ pinMode(pin, OUTPUT); digitalWrite(pin, value); @@ -905,4 +913,30 @@ void doImageRequest(GwApi *api, int *pageno, const PageStruct pages[MAX_PAGE_NUM 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 diff --git a/lib/obp60task/OBP60Extensions.h b/lib/obp60task/OBP60Extensions.h index 33b9218..010bd35 100644 --- a/lib/obp60task/OBP60Extensions.h +++ b/lib/obp60task/OBP60Extensions.h @@ -7,6 +7,7 @@ #include "Graphics.h" #include // E-paper lib V2 #include // I2C FRAM +#include #ifdef BOARD_OBP40S3 #include "esp_vfs_fat.h" @@ -31,6 +32,7 @@ #define FRAM_BAROGRAPH_END 0x13FF #define PI 3.1415926535897932384626433832795 +#define EARTH_RADIUS 6371000.0 extern Adafruit_FRAM_I2C fram; extern bool hasFRAM; @@ -87,8 +89,8 @@ uint8_t getLastPage(); void hardwareInit(GwApi *api); 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 togglePortPin(uint pin); // Toggle extension port pin Color colorMapping(const String &colorString); // Color mapping string to CHSV colors diff --git a/lib/obp60task/OBP60Formatter.cpp b/lib/obp60task/OBP60Formatter.cpp index 06d3dc5..456eab0 100644 --- a/lib/obp60task/OBP60Formatter.cpp +++ b/lib/obp60task/OBP60Formatter.cpp @@ -79,9 +79,13 @@ FormattedData formatValue(GwApi::BoatValue *value, CommonData &commondata){ const char* fmt_dec_10; const char* fmt_dec_100; if (precision == "1") { - fmt_dec_1 = "%3.1f"; - fmt_dec_10 = "%3.0f"; - fmt_dec_100 = "%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. + //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 { fmt_dec_1 = "%3.2f"; fmt_dec_10 = "%3.1f"; diff --git a/lib/obp60task/OBP60Hardware.h b/lib/obp60task/OBP60Hardware.h index ac366c8..fa25e2d 100644 --- a/lib/obp60task/OBP60Hardware.h +++ b/lib/obp60task/OBP60Hardware.h @@ -5,7 +5,8 @@ // Direction pin for RS485 NMEA0183 #define OBP_DIRECTION_PIN 18 // 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_SCL 21 // DS1388 RTC @@ -42,6 +43,8 @@ #define OBP_SPI_DIN 48 #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 GxEPD_WIDTH 400 // Display width + #define GxEPD_HEIGHT 300 // Display height // GPS (NEO-6M, NEO-M8N, ATGM336H) #define OBP_GPS_RX 2 @@ -82,7 +85,8 @@ // Direction pin for RS485 NMEA0183 #define OBP_DIRECTION_PIN 8 // 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_SCL 38 // DS1388 RTC @@ -119,6 +123,8 @@ #define OBP_SPI_DIN 11 #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 GxEPD_WIDTH 400 // Display width + #define GxEPD_HEIGHT 300 // Display height // SPI SD-Card #define SD_SPI_CS GPIO_NUM_10 #define SD_SPI_MOSI GPIO_NUM_40 diff --git a/lib/obp60task/PageDigitalOut.cpp b/lib/obp60task/PageDigitalOut.cpp new file mode 100644 index 0000000..dfe0a76 --- /dev/null +++ b/lib/obp60task/PageDigitalOut.cpp @@ -0,0 +1,131 @@ +#if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 + +#include // 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 diff --git a/lib/obp60task/PageNavigation.cpp b/lib/obp60task/PageNavigation.cpp index 59dbc34..7531685 100644 --- a/lib/obp60task/PageNavigation.cpp +++ b/lib/obp60task/PageNavigation.cpp @@ -19,10 +19,18 @@ bool firstRun = true; // Detect the first page run int zoom = 15; // Default zoom level 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: PageNavigation(CommonData &common){ commonData = &common; 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){ @@ -31,7 +39,7 @@ public: commonData->keylock = !commonData->keylock; return 0; // Commit the key } - // Cood for zoom - + // Code for zoom - if(key == 1){ zoom --; // Zoom - if(zoom <7){ @@ -39,7 +47,7 @@ public: } return 0; // Commit the key } - // Cood for zoom - + // Code for zoom - if(key == 2){ zoom ++; // Zoom + if(zoom >17){ @@ -60,7 +68,7 @@ public: // Get config data String lengthformat = config->getString(config->lengthFormat); - // bool simulation = config->getBool(config->useSimuData); + bool simulation = config->getBool(config->useSimuData); bool holdvalues = config->getBool(config->holdvalues); String flashLED = config->getString(config->flashLED); String backlightMode = config->getString(config->backlight); @@ -72,10 +80,13 @@ public: bool grid = config->getBool(config->grid); String orientation = config->getString(config->orientation); int refreshDistance = config->getInt(config->refreshDistance); + bool showValuesMap = config->getBool(config->showvalues); + bool ownHeading = config->getBool(config->ownheading); if(firstRun == true){ - zoom = zoomLevel; // Over write zoom level with setup value - firstRun = false; // Restet variable + zoom = zoomLevel; // Over write zoom level with setup value + showValues = showValuesMap; // Over write showValues with setup value + firstRun = false; // Restet variable } // Local variables @@ -109,11 +120,16 @@ public: static String unit6old = ""; static double latitude = 0; + static double latitudeold = 0; static double longitude = 0; + static double longitudeold = 0; static double trueHeading = 0; static double magneticHeading = 0; static double speedOverGround = 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 GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue) @@ -185,6 +201,7 @@ public: // Latitude if(valid1){ latitude = value1; + latitudeold = value1; value3old = value1; } else{ @@ -193,6 +210,7 @@ public: // Longitude if(valid2){ longitude = value2; + longitudeold = value2; value2old = value2; } else{ @@ -353,8 +371,8 @@ public: auto& json = net.json(); // Extract JSON content int numPix = json["number_pixels"] | 0; // Read number of pixels - int imgWidth = json["width"] | 0; // Read width of image - int imgHeight = json["height"] | 0; // Read height og image + imgWidth = json["width"] | 0; // Read width of image + imgHeight = json["height"] | 0; // Read height og image const char* b64src = json["picture_base64"].as(); // Read picture as Base64 content size_t b64len = strlen(b64src); // Calculate length of Base64 content @@ -380,6 +398,17 @@ public: size_t decodedSize = 0; 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) getdisplay().drawBitmap(0, 25, imageData, imgWidth, imgHeight, commonData->fgcolor); @@ -387,6 +416,25 @@ public: free(b64); 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 ################ diff --git a/lib/obp60task/config.json b/lib/obp60task/config.json index 088001a..3c7d3fe 100644 --- a/lib/obp60task/config.json +++ b/lib/obp60task/config.json @@ -934,11 +934,14 @@ "type": "string", "default": "192.168.15.10", "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", "capabilities": { "obp60":"true" - } + }, + "condition": [ + { "mapsource": ["Local Service"] } + ] }, { "name": "localPort", @@ -947,10 +950,13 @@ "default": "8080", "check":"checkPort", "description": "TCP port for local map server", - "category": "TCP client", + "category": "OBP60 Navigation", "capabilities": { "obp60":"true" - } + }, + "condition": [ + { "mapsource": ["Local Service"] } + ] }, { "name": "maptype", @@ -971,28 +977,31 @@ } }, { - "name": "zoomlevel", - "label": "Default Zool Level", + "name": "refreshDistance", + "label": "Refresh Distance [m]", "type": "number", "default": "15", "check": "checkMinMax", - "min": 7, - "max": 17, - "description": "Zoom level for map [7..17]; 15 = default", + "min": 1, + "max": 50, + "description": "Refresh distance between updates [1..50 m], 15 m = default", "category": "OBP60 Navigation", "capabilities": { "obp60":"true" } }, { - "name": "grid", - "label": "Show Grid", - "type": "boolean", - "default": "false", - "description": "Show the grid for latutude and longitude", + "name": "zoomlevel", + "label": "Default Zoom Level", + "type": "number", + "default": "15", + "check": "checkMinMax", + "min": 7, + "max": 17, + "description": "Start zoom level for map [7..17]; 15 = default", "category": "OBP60 Navigation", "capabilities": { - "obp60": "true" + "obp60":"true" } }, { @@ -1011,17 +1020,36 @@ } }, { - "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", + "name": "grid", + "label": "Show Grid", + "type": "boolean", + "default": "false", + "description": "Show the grid for latutude and longitude", "category": "OBP60 Navigation", "capabilities": { - "obp60":"true" + "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", + "capabilities": { + "obp60": "true" } }, { @@ -1336,6 +1364,7 @@ "Battery2", "Clock", "Compass", + "DigitalOut", "DST810", "Fluid", "FourValues", @@ -1635,6 +1664,7 @@ "Battery2", "Clock", "Compass", + "DigitalOut", "DST810", "Fluid", "FourValues", @@ -1926,6 +1956,7 @@ "Battery2", "Clock", "Compass", + "DigitalOut", "DST810", "Fluid", "FourValues", @@ -2209,6 +2240,7 @@ "Battery2", "Clock", "Compass", + "DigitalOut", "DST810", "Fluid", "FourValues", @@ -2484,6 +2516,7 @@ "Battery2", "Clock", "Compass", + "DigitalOut", "DST810", "Fluid", "FourValues", @@ -2751,6 +2784,7 @@ "Battery2", "Clock", "Compass", + "DigitalOut", "DST810", "Fluid", "FourValues", @@ -3010,6 +3044,7 @@ "Battery2", "Clock", "Compass", + "DigitalOut", "DST810", "Fluid", "FourValues", @@ -3261,6 +3296,7 @@ "Battery2", "Clock", "Compass", + "DigitalOut", "DST810", "Fluid", "FourValues", @@ -3504,6 +3540,7 @@ "Battery2", "Clock", "Compass", + "DigitalOut", "DST810", "Fluid", "FourValues", @@ -3739,6 +3776,7 @@ "Battery2", "Clock", "Compass", + "DigitalOut", "DST810", "Fluid", "FourValues", diff --git a/lib/obp60task/config_obp40.json b/lib/obp60task/config_obp40.json index eaca892..c8553c0 100644 --- a/lib/obp60task/config_obp40.json +++ b/lib/obp60task/config_obp40.json @@ -934,7 +934,7 @@ "OBP Service", "Local Service" ], - "category": "OBP60 Navigation", + "category": "OBP40 Navigation", "capabilities": { "obp40":"true" } @@ -945,11 +945,14 @@ "type": "string", "default": "192.168.15.10", "check": "checkIpAddress", - "description": "IP address only for local map service e.g. 192.168.15.10\nor an MDNS name like Raspi.local", - "category": "OBP60 Navigation", + "description": "IP address for local map service e.g. 192.168.15.10\nor an MDNS name like Raspi.local", + "category": "OBP40 Navigation", "capabilities": { "obp40":"true" - } + }, + "condition": [ + { "mapsource": ["Local Service"] } + ] }, { "name": "localPort", @@ -958,10 +961,13 @@ "default": "8080", "check":"checkPort", "description": "TCP port for local map server", - "category": "TCP client", + "category": "OBP40 Navigation", "capabilities": { "obp40":"true" - } + }, + "condition": [ + { "mapsource": ["Local Service"] } + ] }, { "name": "maptype", @@ -976,47 +982,7 @@ "Stadimaps Toner", "Free Nautical Chart" ], - "category": "OBP60 Navigation", - "capabilities": { - "obp40":"true" - } - }, - { - "name": "zoomlevel", - "label": "Default Zool Level", - "type": "number", - "default": "15", - "check": "checkMinMax", - "min": 7, - "max": 17, - "description": "Zoom level for map [7..17]; 15 = default", - "category": "OBP60 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": { - "obp40": "true" - } - }, - { - "name": "orientation", - "label": "Map Orientation", - "type": "list", - "default": "North Dirirection", - "description": "Map orientation for navigation", - "list": [ - "North Direction", - "Travel Direction" - ], - "category": "OBP60 Navigation", + "category": "OBP40 Navigation", "capabilities": { "obp40":"true" } @@ -1030,11 +996,73 @@ "min": 1, "max": 50, "description": "Refresh distance between updates [1..50 m], 15 m = default", - "category": "OBP60 Navigation", + "category": "OBP40 Navigation", "capabilities": { "obp40":"true" } }, + { + "name": "zoomlevel", + "label": "Default Zoom Level", + "type": "number", + "default": "15", + "check": "checkMinMax", + "min": 7, + "max": 17, + "description": "Start zoom level for map [7..17]; 15 = default", + "category": "OBP40 Navigation", + "capabilities": { + "obp40":"true" + } + }, + { + "name": "orientation", + "label": "Map Orientation", + "type": "list", + "default": "North Dirirection", + "description": "Map orientation for navigation", + "list": [ + "North Direction", + "Travel Direction" + ], + "category": "OBP40 Navigation", + "capabilities": { + "obp40":"true" + } + }, + { + "name": "grid", + "label": "Show Grid", + "type": "boolean", + "default": "false", + "description": "Show the grid for latutude and longitude", + "category": "OBP40 Navigation", + "capabilities": { + "obp40": "true" + } + }, + { + "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": { + "obp40": "true" + } + }, { "name": "display", "label": "Display Mode", @@ -1359,6 +1387,7 @@ "Battery2", "Clock", "Compass", + "DigitalOut", "DST810", "Fluid", "FourValues", @@ -1688,6 +1717,7 @@ "Battery2", "Clock", "Compass", + "DigitalOut", "DST810", "Fluid", "FourValues", @@ -2008,6 +2038,7 @@ "Battery2", "Clock", "Compass", + "DigitalOut", "DST810", "Fluid", "FourValues", @@ -2319,6 +2350,7 @@ "Battery2", "Clock", "Compass", + "DigitalOut", "DST810", "Fluid", "FourValues", @@ -2621,6 +2653,7 @@ "Battery2", "Clock", "Compass", + "DigitalOut", "DST810", "Fluid", "FourValues", @@ -2914,6 +2947,7 @@ "Battery2", "Clock", "Compass", + "DigitalOut", "DST810", "Fluid", "FourValues", @@ -3198,6 +3232,7 @@ "Battery2", "Clock", "Compass", + "DigitalOut", "DST810", "Fluid", "FourValues", @@ -3473,6 +3508,7 @@ "Battery2", "Clock", "Compass", + "DigitalOut", "DST810", "Fluid", "FourValues", @@ -3739,6 +3775,7 @@ "Battery2", "Clock", "Compass", + "DigitalOut", "DST810", "Fluid", "FourValues", @@ -3996,6 +4033,7 @@ "Battery2", "Clock", "Compass", + "DigitalOut", "DST810", "Fluid", "FourValues", diff --git a/lib/obp60task/obp60task.cpp b/lib/obp60task/obp60task.cpp index 15d859e..1058ae0 100644 --- a/lib/obp60task/obp60task.cpp +++ b/lib/obp60task/obp60task.cpp @@ -262,6 +262,8 @@ void registerAllPages(PageList &list){ list.add(®isterPageSkyView); extern PageDescription registerPageNavigation; list.add(®isterPageNavigation); + extern PageDescription registerPageDigitalOut; + list.add(®isterPageDigitalOut); } // Undervoltage detection for shutdown display @@ -430,7 +432,7 @@ void OBP60Task(GwApi *api){ #endif 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 HstryBuffers hstryBufList(1920, &boatValues, logger); // Create empty list of boat data history buffers @@ -852,8 +854,10 @@ void OBP60Task(GwApi *api){ } else{ if (lastPage != pageNumber){ - 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 (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 + if (hasFRAM) fram.write(FRAM_PAGE_NO, pageNumber); // remember new page for device restart + } currentPage->setupKeys(); currentPage->displayNew(pages[pageNumber].parameters); lastPage = pageNumber;