1
0
mirror of https://github.com/thooge/esp32-nmea2000-obp60.git synced 2025-12-28 21:23:07 +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();
}
// 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

View File

@@ -7,6 +7,7 @@
#include "Graphics.h"
#include <GxEPD2_BW.h> // E-paper lib V2
#include <Adafruit_FRAM_I2C.h> // I2C FRAM
#include <math.h>
#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;

View File

@@ -72,10 +72,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,7 +112,9 @@ 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;
@@ -185,6 +190,7 @@ public:
// Latitude
if(valid1){
latitude = value1;
latitudeold = value1;
value3old = value1;
}
else{
@@ -193,6 +199,7 @@ public:
// Longitude
if(valid2){
longitude = value2;
longitudeold = value2;
value2old = value2;
}
else{

View File

@@ -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"
}
},
{

View File

@@ -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",