1
0
mirror of https://github.com/thooge/esp32-nmea2000-obp60.git synced 2026-02-12 15:43:06 +01:00

Add showValues as config parameter

This commit is contained in:
norbert-walter
2025-12-12 13:09:06 +01:00
parent 6edf847958
commit 69367b91d7
5 changed files with 165 additions and 74 deletions

View File

@@ -905,4 +905,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

View File

@@ -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;

View File

@@ -72,10 +72,13 @@ 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
firstRun = false; // Restet variable showValues = showValuesMap; // Over write showValues with setup value
firstRun = false; // Restet variable
} }
// Local variables // Local variables
@@ -109,7 +112,9 @@ 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;
@@ -185,6 +190,7 @@ public:
// Latitude // Latitude
if(valid1){ if(valid1){
latitude = value1; latitude = value1;
latitudeold = value1;
value3old = value1; value3old = value1;
} }
else{ else{
@@ -193,6 +199,7 @@ public:
// Longitude // Longitude
if(valid2){ if(valid2){
longitude = value2; longitude = value2;
longitudeold = value2;
value2old = value2; value2old = value2;
} }
else{ else{

View File

@@ -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,28 +977,31 @@
} }
}, },
{ {
"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,17 +1020,36 @@
} }
}, },
{ {
"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,
"max": 50,
"description": "Refresh distance between updates [1..50 m], 15 m = default",
"category": "OBP60 Navigation", "category": "OBP60 Navigation",
"capabilities": { "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"
} }
}, },
{ {

View File

@@ -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,47 +982,7 @@
"Stadimaps Toner", "Stadimaps Toner",
"Free Nautical Chart" "Free Nautical Chart"
], ],
"category": "OBP60 Navigation", "category": "OBP40 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",
"capabilities": { "capabilities": {
"obp40":"true" "obp40":"true"
} }
@@ -1030,11 +996,73 @@
"min": 1, "min": 1,
"max": 50, "max": 50,
"description": "Refresh distance between updates [1..50 m], 15 m = default", "description": "Refresh distance between updates [1..50 m], 15 m = default",
"category": "OBP60 Navigation", "category": "OBP40 Navigation",
"capabilities": { "capabilities": {
"obp40":"true" "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", "name": "display",
"label": "Display Mode", "label": "Display Mode",