1
0
mirror of https://github.com/thooge/esp32-nmea2000-obp60.git synced 2025-12-29 05:33:05 +01:00

Change SOG to HDT

This commit is contained in:
norbert-walter
2025-12-06 17:25:34 +01:00
parent a392d88445
commit fc097b09fe

View File

@@ -17,7 +17,7 @@ class PageNavigation : public Page
// Values for buttons // Values for buttons
bool firstRun = true; // Detect the first page run 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 COG, SOG, DBT in navigation map bool showValues = false; // Show values HDT, SOG, DBT in navigation map
public: public:
PageNavigation(CommonData &common){ PageNavigation(CommonData &common){
@@ -107,7 +107,7 @@ public:
static double latitude = 0; static double latitude = 0;
static double longitude = 0; static double longitude = 0;
static double courseOverGround = 0; static double trueHeading = 0;
static double speedOverGround = 0; static double speedOverGround = 0;
static double depthBelowTransducer = 0; static double depthBelowTransducer = 0;
@@ -129,7 +129,7 @@ public:
String svalue2 = formatValue(bvalue2, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places String svalue2 = formatValue(bvalue2, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
String unit2 = formatValue(bvalue2, *commonData).unit; // Unit of value String unit2 = formatValue(bvalue2, *commonData).unit; // Unit of value
// Get boat values #3 COG // Get boat values #3 HDT
GwApi::BoatValue *bvalue3 = pageData.values[2]; // Second element in list (only one value by PageOneValue) GwApi::BoatValue *bvalue3 = pageData.values[2]; // Second element in list (only one value by PageOneValue)
String name3 = xdrDelete(bvalue3->getName()); // Value name String name3 = xdrDelete(bvalue3->getName()); // Value name
name3 = name3.substring(0, 6); // String length limit for value name name3 = name3.substring(0, 6); // String length limit for value name
@@ -185,13 +185,13 @@ public:
else{ else{
longitude = value2old; longitude = value2old;
} }
// COG value (Course Over Ground) // HDT value (Course Over Ground)
if(valid3){ if(valid3){
courseOverGround = (value3 * 360) / (2 * PI); trueHeading = (value3 * 360) / (2 * PI);
value3old = courseOverGround; value3old = trueHeading;
} }
else{ else{
courseOverGround = value3old; trueHeading = value3old;
} }
// SOG value (Speed Over Ground) // SOG value (Speed Over Ground)
if(valid4){ if(valid4){
@@ -264,15 +264,15 @@ public:
// Map orientation // Map orientation
if(orientation == "North Direction"){ if(orientation == "North Direction"){
mapRot = 0; mapRot = 0;
symbolRot = courseOverGround; symbolRot = trueHeading;
} }
else if(orientation == "Travel Direction"){ else if(orientation == "Travel Direction"){
mapRot = courseOverGround; mapRot = trueHeading;
symbolRot = courseOverGround; symbolRot = trueHeading;
} }
else{ else{
mapRot = 0; mapRot = 0;
symbolRot = courseOverGround; symbolRot = trueHeading;
} }
// Load navigation map // Load navigation map
@@ -362,7 +362,7 @@ public:
// Frame // Frame
getdisplay().fillRect(0, 25 , 130, 65, commonData->fgcolor); // Black rect getdisplay().fillRect(0, 25 , 130, 65, commonData->fgcolor); // Black rect
getdisplay().fillRect(2, 27 , 126, 61, commonData->bgcolor); // White rect getdisplay().fillRect(2, 27 , 126, 61, commonData->bgcolor); // White rect
// COG // HDT
getdisplay().setCursor(10, 45); getdisplay().setCursor(10, 45);
getdisplay().print(name3); getdisplay().print(name3);
getdisplay().setCursor(70, 45); getdisplay().setCursor(70, 45);
@@ -401,7 +401,7 @@ PageDescription registerPageNavigation(
"Navigation", // Page name "Navigation", // Page name
createPage, // Action createPage, // Action
0, // Number of bus values depends on selection in Web configuration 0, // Number of bus values depends on selection in Web configuration
{"LAT","LON","COG","SOG","DBT"}, // Bus values we need in the page {"LAT","LON","HDT","SOG","DBT"}, // Bus values we need in the page
true // Show display header on/off true // Show display header on/off
); );