Compare commits
14 Commits
2e797644db
...
8373d49c4f
Author | SHA1 | Date |
---|---|---|
|
8373d49c4f | |
|
c6608bf669 | |
|
5cac293431 | |
|
e7a55bd374 | |
|
4b4d8c2531 | |
|
b9086148e2 | |
![]() |
fb3af0bf83 | |
![]() |
539500e088 | |
![]() |
229106b04c | |
![]() |
eefa59a7c2 | |
|
588008e370 | |
|
caf5572459 | |
![]() |
05f8b3ec65 | |
![]() |
351ef5d9fe |
|
@ -49,9 +49,9 @@ String formatLongitude(double lon) {
|
||||||
return String(degree, 0) + "\x90 " + String(minute, 4) + "' " + ((lon > 0) ? "E" : "W");
|
return String(degree, 0) + "\x90 " + String(minute, 4) + "' " + ((lon > 0) ? "E" : "W");
|
||||||
}
|
}
|
||||||
|
|
||||||
FormatedData formatValue(GwApi::BoatValue *value, CommonData &commondata){
|
FormattedData formatValue(GwApi::BoatValue *value, CommonData &commondata){
|
||||||
GwLog *logger = commondata.logger;
|
GwLog *logger = commondata.logger;
|
||||||
FormatedData result;
|
FormattedData result;
|
||||||
static int dayoffset = 0;
|
static int dayoffset = 0;
|
||||||
double rawvalue = 0;
|
double rawvalue = 0;
|
||||||
|
|
|
@ -94,7 +94,7 @@ bool WindUtils::calcTrueWind(const double* awaVal, const double* awsVal,
|
||||||
} else if (*cogVal != DBL_MIN) {
|
} else if (*cogVal != DBL_MIN) {
|
||||||
hdt = *cogVal; // Use COG as fallback if HDT and HDM are not available
|
hdt = *cogVal; // Use COG as fallback if HDT and HDM are not available
|
||||||
} else {
|
} else {
|
||||||
return false; // Cannot calculate without valid HDT or HDM
|
return false; // Cannot calculate without valid HDT or HDM+VAR or COG
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,8 +102,7 @@ bool WindUtils::calcTrueWind(const double* awaVal, const double* awsVal,
|
||||||
ctw = *cogVal; // Use COG as CTW if available
|
ctw = *cogVal; // Use COG as CTW if available
|
||||||
// ctw = *cogVal + ((*cogVal - hdt) / 2); // Estimate CTW from COG
|
// ctw = *cogVal + ((*cogVal - hdt) / 2); // Estimate CTW from COG
|
||||||
} else {
|
} else {
|
||||||
ctw = hdt; // 2nd approximation for CTW;
|
ctw = hdt; // 2nd approximation for CTW; hdt must exist if we reach this part of the code
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*stwVal != DBL_MIN) {
|
if (*stwVal != DBL_MIN) {
|
||||||
|
@ -115,11 +114,11 @@ bool WindUtils::calcTrueWind(const double* awaVal, const double* awsVal,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((*awaVal == DBL_MIN) || (*awsVal == DBL_MIN) || (*cogVal == DBL_MIN) || (*stwVal == DBL_MIN)) {
|
if ((*awaVal == DBL_MIN) || (*awsVal == DBL_MIN)) {
|
||||||
// Cannot calculate true wind without valid AWA, AWS, COG, or STW
|
// Cannot calculate true wind without valid AWA, AWS; other checks are done earlier
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
calcTwdSA(awaVal, awsVal, &ctw, stwVal, &hdt, &twd, &tws, &twa);
|
calcTwdSA(awaVal, awsVal, &ctw, &stw, &hdt, &twd, &tws, &twa);
|
||||||
*twdVal = twd;
|
*twdVal = twd;
|
||||||
*twsVal = tws;
|
*twsVal = tws;
|
||||||
*twaVal = twa;
|
*twaVal = twa;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
class PageBattery : public Page
|
class PageBattery : public Page
|
||||||
{
|
{
|
||||||
int average = 0; // Average type [0...3], 0=off, 1=10s, 2=60s, 3=300s
|
int average = 0; // Average type [0...3], 0=off, 1=10s, 2=60s, 3=300s
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageBattery(CommonData &common){
|
PageBattery(CommonData &common){
|
||||||
|
|
|
@ -120,7 +120,7 @@ bool homevalid = false; // homelat and homelon are valid
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
value1 = simtime++; // Simulation data for time value 11:36 in seconds
|
value1 = simtime++; // Simulation data for time value 11:36 in seconds
|
||||||
} // Other simulation data see OBP60Formater.cpp
|
} // Other simulation data see OBP60Formatter.cpp
|
||||||
bool valid1 = bvalue1->valid; // Valid information
|
bool valid1 = bvalue1->valid; // Valid information
|
||||||
String svalue1 = formatValue(bvalue1, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
String svalue1 = formatValue(bvalue1, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
||||||
String unit1 = formatValue(bvalue1, *commonData).unit; // Unit of value
|
String unit1 = formatValue(bvalue1, *commonData).unit; // Unit of value
|
||||||
|
|
|
@ -83,7 +83,7 @@ class PageCompass : public Page
|
||||||
String DataText[HowManyValues];
|
String DataText[HowManyValues];
|
||||||
String DataUnits[HowManyValues];
|
String DataUnits[HowManyValues];
|
||||||
String DataFormat[HowManyValues];
|
String DataFormat[HowManyValues];
|
||||||
FormatedData TheFormattedData;
|
FormattedData TheFormattedData;
|
||||||
|
|
||||||
for (int i = 0; i < HowManyValues; i++){
|
for (int i = 0; i < HowManyValues; i++){
|
||||||
bvalue = pageData.values[i];
|
bvalue = pageData.values[i];
|
||||||
|
|
|
@ -53,7 +53,7 @@ class PageFourValues : public Page
|
||||||
String unit1 = formatValue(bvalue1, *commonData).unit; // Unit of value
|
String unit1 = formatValue(bvalue1, *commonData).unit; // Unit of value
|
||||||
|
|
||||||
// Get boat values #2
|
// Get boat values #2
|
||||||
GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list (only one value by PageOneValue)
|
GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list
|
||||||
String name2 = xdrDelete(bvalue2->getName()); // Value name
|
String name2 = xdrDelete(bvalue2->getName()); // Value name
|
||||||
name2 = name2.substring(0, 6); // String length limit for value name
|
name2 = name2.substring(0, 6); // String length limit for value name
|
||||||
calibrationData.calibrateInstance(bvalue2, logger); // Check if boat data value is to be calibrated
|
calibrationData.calibrateInstance(bvalue2, logger); // Check if boat data value is to be calibrated
|
||||||
|
@ -63,7 +63,7 @@ class PageFourValues : public Page
|
||||||
String unit2 = formatValue(bvalue2, *commonData).unit; // Unit of value
|
String unit2 = formatValue(bvalue2, *commonData).unit; // Unit of value
|
||||||
|
|
||||||
// Get boat values #3
|
// Get boat values #3
|
||||||
GwApi::BoatValue *bvalue3 = pageData.values[2]; // Second element in list (only one value by PageOneValue)
|
GwApi::BoatValue *bvalue3 = pageData.values[2]; // Third element in list
|
||||||
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
|
||||||
calibrationData.calibrateInstance(bvalue3, logger); // Check if boat data value is to be calibrated
|
calibrationData.calibrateInstance(bvalue3, logger); // Check if boat data value is to be calibrated
|
||||||
|
@ -73,7 +73,7 @@ class PageFourValues : public Page
|
||||||
String unit3 = formatValue(bvalue3, *commonData).unit; // Unit of value
|
String unit3 = formatValue(bvalue3, *commonData).unit; // Unit of value
|
||||||
|
|
||||||
// Get boat values #4
|
// Get boat values #4
|
||||||
GwApi::BoatValue *bvalue4 = pageData.values[3]; // Second element in list (only one value by PageOneValue)
|
GwApi::BoatValue *bvalue4 = pageData.values[3]; // Fourth element in list
|
||||||
String name4 = xdrDelete(bvalue4->getName()); // Value name
|
String name4 = xdrDelete(bvalue4->getName()); // Value name
|
||||||
name4 = name4.substring(0, 6); // String length limit for value name
|
name4 = name4.substring(0, 6); // String length limit for value name
|
||||||
calibrationData.calibrateInstance(bvalue4, logger); // Check if boat data value is to be calibrated
|
calibrationData.calibrateInstance(bvalue4, logger); // Check if boat data value is to be calibrated
|
||||||
|
@ -301,7 +301,7 @@ static Page *createPage(CommonData &common){
|
||||||
* this will be number of BoatValue pointers in pageData.values
|
* this will be number of BoatValue pointers in pageData.values
|
||||||
*/
|
*/
|
||||||
PageDescription registerPageFourValues(
|
PageDescription registerPageFourValues(
|
||||||
"FourValues", // Page name
|
"FourValues", // Page name
|
||||||
createPage, // Action
|
createPage, // Action
|
||||||
4, // Number of bus values depends on selection in Web configuration
|
4, // Number of bus values depends on selection in Web configuration
|
||||||
true // Show display header on/off
|
true // Show display header on/off
|
||||||
|
|
|
@ -86,21 +86,20 @@ public:
|
||||||
float x = 200 + (rInstrument-30)*sin(i/180.0*pi); // x-coordinate dots
|
float x = 200 + (rInstrument-30)*sin(i/180.0*pi); // x-coordinate dots
|
||||||
float y = 150 - (rInstrument-30)*cos(i/180.0*pi); // y-coordinate cots
|
float y = 150 - (rInstrument-30)*cos(i/180.0*pi); // y-coordinate cots
|
||||||
const char *ii = " ";
|
const char *ii = " ";
|
||||||
switch (i)
|
switch (i) {
|
||||||
{
|
case 0: ii=" "; break; // Use a blank for a empty scale value
|
||||||
case 0: ii=" "; break; // Use a blank for a empty scale value
|
case 30 : ii=" "; break;
|
||||||
case 30 : ii=" "; break;
|
case 60 : ii=" "; break;
|
||||||
case 60 : ii=" "; break;
|
case 90 : ii="45"; break;
|
||||||
case 90 : ii="45"; break;
|
case 120 : ii="30"; break;
|
||||||
case 120 : ii="30"; break;
|
case 150 : ii="15"; break;
|
||||||
case 150 : ii="15"; break;
|
case 180 : ii="0"; break;
|
||||||
case 180 : ii="0"; break;
|
case 210 : ii="15"; break;
|
||||||
case 210 : ii="15"; break;
|
case 240 : ii="30"; break;
|
||||||
case 240 : ii="30"; break;
|
case 270 : ii="45"; break;
|
||||||
case 270 : ii="45"; break;
|
case 300 : ii=" "; break;
|
||||||
case 300 : ii=" "; break;
|
case 330 : ii=" "; break;
|
||||||
case 330 : ii=" "; break;
|
default: break;
|
||||||
default: break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print text centered on position x, y
|
// Print text centered on position x, y
|
||||||
|
|
|
@ -41,9 +41,9 @@ public:
|
||||||
String backlightMode = config->getString(config->backlight);
|
String backlightMode = config->getString(config->backlight);
|
||||||
int rolllimit = config->getInt(config->rollLimit);
|
int rolllimit = config->getInt(config->rollLimit);
|
||||||
String roffset = config->getString(config->rollOffset);
|
String roffset = config->getString(config->rollOffset);
|
||||||
double rolloffset = roffset.toFloat()/360*(2*PI);
|
double rolloffset = roffset.toFloat()/360*(2*M_PI);
|
||||||
String poffset = config->getString(config->pitchOffset);
|
String poffset = config->getString(config->pitchOffset);
|
||||||
double pitchoffset = poffset.toFloat()/360*(2*PI);
|
double pitchoffset = poffset.toFloat()/360*(2*M_PI);
|
||||||
|
|
||||||
// Get boat values for roll
|
// Get boat values for roll
|
||||||
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (xdrRoll)
|
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (xdrRoll)
|
||||||
|
@ -55,17 +55,17 @@ public:
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if(simulation == true){
|
if(simulation == true){
|
||||||
value1 = (20 + float(random(0, 50)) / 10.0)/360*2*PI;
|
value1 = (20 + float(random(0, 50)) / 10.0)/360*2*M_PI;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
value1 = 0;
|
value1 = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(value1/(2*PI)*360 > -10 && value1/(2*PI)*360 < 10){
|
if(value1/(2*M_PI)*360 > -10 && value1/(2*M_PI)*360 < 10){
|
||||||
svalue1 = String(value1/(2*PI)*360,1); // Convert raw value to string
|
svalue1 = String(value1/(2*M_PI)*360,1); // Convert raw value to string
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
svalue1 = String(value1/(2*PI)*360,0);
|
svalue1 = String(value1/(2*M_PI)*360,0);
|
||||||
}
|
}
|
||||||
if(valid1 == true){
|
if(valid1 == true){
|
||||||
svalue1old = svalue1; // Save the old value
|
svalue1old = svalue1; // Save the old value
|
||||||
|
@ -80,17 +80,17 @@ public:
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if(simulation == true){
|
if(simulation == true){
|
||||||
value2 = (float(random(-5, 5)))/360*2*PI;
|
value2 = (float(random(-5, 5)))/360*2*M_PI;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
value2 = 0;
|
value2 = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(value2/(2*PI)*360 > -10 && value2/(2*PI)*360 < 10){
|
if(value2/(2*PI)*360 > -10 && value2/(2*M_PI)*360 < 10){
|
||||||
svalue2 = String(value2/(2*PI)*360,1); // Convert raw value to string
|
svalue2 = String(value2/(2*M_PI)*360,1); // Convert raw value to string
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
svalue2 = String(value2/(2*PI)*360,0);
|
svalue2 = String(value2/(2*M_PI)*360,0);
|
||||||
}
|
}
|
||||||
if(valid2 == true){
|
if(valid2 == true){
|
||||||
svalue2old = svalue2; // Save the old value
|
svalue2old = svalue2; // Save the old value
|
||||||
|
@ -99,7 +99,7 @@ public:
|
||||||
// Optical warning by limit violation
|
// Optical warning by limit violation
|
||||||
if(String(flashLED) == "Limit Violation"){
|
if(String(flashLED) == "Limit Violation"){
|
||||||
// Limits for roll
|
// Limits for roll
|
||||||
if(value1*360/(2*PI) >= -1*rolllimit && value1*360/(2*PI) <= rolllimit){
|
if(value1*360/(2*M_PI) >= -1*rolllimit && value1*360/(2*M_PI) <= rolllimit){
|
||||||
setBlinkingLED(false);
|
setBlinkingLED(false);
|
||||||
setFlashLED(false);
|
setFlashLED(false);
|
||||||
}
|
}
|
||||||
|
@ -132,7 +132,7 @@ public:
|
||||||
getdisplay().setFont(&Ubuntu_Bold8pt8b);
|
getdisplay().setFont(&Ubuntu_Bold8pt8b);
|
||||||
getdisplay().setCursor(10, 115);
|
getdisplay().setCursor(10, 115);
|
||||||
getdisplay().print("DEG");
|
getdisplay().print("DEG");
|
||||||
|
|
||||||
// Horizintal separator left
|
// Horizintal separator left
|
||||||
getdisplay().fillRect(0, 149, 60, 3, commonData->fgcolor);
|
getdisplay().fillRect(0, 149, 60, 3, commonData->fgcolor);
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ public:
|
||||||
getdisplay().print("Deg");
|
getdisplay().print("Deg");
|
||||||
|
|
||||||
//*******************************************************************************************
|
//*******************************************************************************************
|
||||||
|
|
||||||
// Draw instrument
|
// Draw instrument
|
||||||
int rInstrument = 100; // Radius of instrument
|
int rInstrument = 100; // Radius of instrument
|
||||||
float pi = 3.141592;
|
float pi = 3.141592;
|
||||||
|
@ -177,19 +177,18 @@ public:
|
||||||
// Only scaling +/- 60 degrees
|
// Only scaling +/- 60 degrees
|
||||||
if((i >= 0 && i <= 60) || (i >= 300 && i <= 360)){
|
if((i >= 0 && i <= 60) || (i >= 300 && i <= 360)){
|
||||||
// Scaling values
|
// Scaling values
|
||||||
float x = 200 + (rInstrument+25)*sin(i/180.0*pi); // x-coordinate dots
|
float x = 200 + (rInstrument+25)*sin(i/180.0*M_PI); // x-coordinate dots
|
||||||
float y = 150 - (rInstrument+25)*cos(i/180.0*pi); // y-coordinate cots
|
float y = 150 - (rInstrument+25)*cos(i/180.0*M_PI); // y-coordinate cots
|
||||||
const char *ii = "";
|
const char *ii = "";
|
||||||
switch (i)
|
switch (i) {
|
||||||
{
|
case 0: ii="0"; break;
|
||||||
case 0: ii="0"; break;
|
case 20 : ii="20"; break;
|
||||||
case 20 : ii="20"; break;
|
case 40 : ii="40"; break;
|
||||||
case 40 : ii="40"; break;
|
case 60 : ii="60"; break;
|
||||||
case 60 : ii="60"; break;
|
case 300 : ii="60"; break;
|
||||||
case 300 : ii="60"; break;
|
case 320 : ii="40"; break;
|
||||||
case 320 : ii="40"; break;
|
case 340 : ii="20"; break;
|
||||||
case 340 : ii="20"; break;
|
default: break;
|
||||||
default: break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print text centered on position x, y
|
// Print text centered on position x, y
|
||||||
|
@ -203,11 +202,11 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw sub scale with dots
|
// Draw sub scale with dots
|
||||||
float x1c = 200 + rInstrument*sin(i/180.0*pi);
|
float x1c = 200 + rInstrument*sin(i/180.0*M_PI);
|
||||||
float y1c = 150 - rInstrument*cos(i/180.0*pi);
|
float y1c = 150 - rInstrument*cos(i/180.0*M_PI);
|
||||||
getdisplay().fillCircle((int)x1c, (int)y1c, 2, commonData->fgcolor);
|
getdisplay().fillCircle((int)x1c, (int)y1c, 2, commonData->fgcolor);
|
||||||
float sinx=sin(i/180.0*pi);
|
float sinx=sin(i/180.0*M_PI);
|
||||||
float cosx=cos(i/180.0*pi);
|
float cosx=cos(i/180.0*M_PI);
|
||||||
|
|
||||||
// Draw sub scale with lines (two triangles)
|
// Draw sub scale with lines (two triangles)
|
||||||
if(i % 20 == 0){
|
if(i % 20 == 0){
|
||||||
|
@ -229,17 +228,17 @@ public:
|
||||||
// Draw mast position pointer
|
// Draw mast position pointer
|
||||||
float startwidth = 8; // Start width of pointer
|
float startwidth = 8; // Start width of pointer
|
||||||
|
|
||||||
// value1 = (2 * pi ) - value1; // Mirror coordiante system for pointer, keel and boat
|
// value1 = (2 * M_PI ) - value1; // Mirror coordiante system for pointer, keel and boat
|
||||||
|
|
||||||
if(valid1 == true || holdvalues == true || simulation == true){
|
if(valid1 == true || holdvalues == true || simulation == true){
|
||||||
float sinx=sin(value1 + pi);
|
float sinx=sin(value1 + M_PI);
|
||||||
float cosx=cos(value1 + pi);
|
float cosx=cos(value1 + M_PI);
|
||||||
// Normal pointer
|
// Normal pointer
|
||||||
// Pointer as triangle with center base 2*width
|
// Pointer as triangle with center base 2*width
|
||||||
float xx1 = -startwidth;
|
float xx1 = -startwidth;
|
||||||
float xx2 = startwidth;
|
float xx2 = startwidth;
|
||||||
float yy1 = -startwidth;
|
float yy1 = -startwidth;
|
||||||
float yy2 = -(rInstrument * 0.7);
|
float yy2 = -(rInstrument * 0.7);
|
||||||
getdisplay().fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1),
|
getdisplay().fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1),
|
||||||
200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
||||||
200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData->fgcolor);
|
200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData->fgcolor);
|
||||||
|
@ -283,7 +282,7 @@ public:
|
||||||
float xx1 = -startwidth;
|
float xx1 = -startwidth;
|
||||||
float xx2 = startwidth;
|
float xx2 = startwidth;
|
||||||
float yy1 = -startwidth;
|
float yy1 = -startwidth;
|
||||||
float yy2 = -(rInstrument - 15);
|
float yy2 = -(rInstrument - 15);
|
||||||
getdisplay().fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1),
|
getdisplay().fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1),
|
||||||
200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
||||||
200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData->fgcolor);
|
200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData->fgcolor);
|
||||||
|
|
|
@ -51,7 +51,7 @@ class PageThreeValues : public Page
|
||||||
String unit1 = formatValue(bvalue1, *commonData).unit; // Unit of value
|
String unit1 = formatValue(bvalue1, *commonData).unit; // Unit of value
|
||||||
|
|
||||||
// Get boat values #2
|
// Get boat values #2
|
||||||
GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list (only one value by PageOneValue)
|
GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list
|
||||||
String name2 = xdrDelete(bvalue2->getName()); // Value name
|
String name2 = xdrDelete(bvalue2->getName()); // Value name
|
||||||
name2 = name2.substring(0, 6); // String length limit for value name
|
name2 = name2.substring(0, 6); // String length limit for value name
|
||||||
calibrationData.calibrateInstance(bvalue2, logger); // Check if boat data value is to be calibrated
|
calibrationData.calibrateInstance(bvalue2, logger); // Check if boat data value is to be calibrated
|
||||||
|
@ -61,7 +61,7 @@ class PageThreeValues : public Page
|
||||||
String unit2 = formatValue(bvalue2, *commonData).unit; // Unit of value
|
String unit2 = formatValue(bvalue2, *commonData).unit; // Unit of value
|
||||||
|
|
||||||
// Get boat values #3
|
// Get boat values #3
|
||||||
GwApi::BoatValue *bvalue3 = pageData.values[2]; // Second element in list (only one value by PageOneValue)
|
GwApi::BoatValue *bvalue3 = pageData.values[2]; // Third element in list
|
||||||
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
|
||||||
calibrationData.calibrateInstance(bvalue3, logger); // Check if boat data value is to be calibrated
|
calibrationData.calibrateInstance(bvalue3, logger); // Check if boat data value is to be calibrated
|
||||||
|
|
|
@ -49,7 +49,7 @@ class PageTwoValues : public Page
|
||||||
String unit1 = formatValue(bvalue1, *commonData).unit; // Unit of value
|
String unit1 = formatValue(bvalue1, *commonData).unit; // Unit of value
|
||||||
|
|
||||||
// Get boat values #2
|
// Get boat values #2
|
||||||
GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list (only one value by PageOneValue)
|
GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list
|
||||||
String name2 = xdrDelete(bvalue2->getName()); // Value name
|
String name2 = xdrDelete(bvalue2->getName()); // Value name
|
||||||
name2 = name2.substring(0, 6); // String length limit for value name
|
name2 = name2.substring(0, 6); // String length limit for value name
|
||||||
calibrationData.calibrateInstance(bvalue2, logger); // Check if boat data value is to be calibrated
|
calibrationData.calibrateInstance(bvalue2, logger); // Check if boat data value is to be calibrated
|
||||||
|
|
|
@ -398,11 +398,11 @@ static Page *createPage(CommonData &common){
|
||||||
* and will will provide the names of the fixed values we need
|
* and will will provide the names of the fixed values we need
|
||||||
*/
|
*/
|
||||||
PageDescription registerPageVoltage(
|
PageDescription registerPageVoltage(
|
||||||
"Voltage", // Name of page
|
"Voltage", // Name of page
|
||||||
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
|
||||||
{}, // Names of bus values undepends on selection in Web configuration (refer GwBoatData.h)
|
{}, // Names of bus values undepends on selection in Web configuration (refer GwBoatData.h)
|
||||||
true // Show display header on/off
|
true // Show display header on/off
|
||||||
);
|
);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -633,11 +633,11 @@ static Page *createPage(CommonData &common){
|
||||||
* and will will provide the names of the fixed values we need
|
* and will will provide the names of the fixed values we need
|
||||||
*/
|
*/
|
||||||
PageDescription registerPageWind(
|
PageDescription registerPageWind(
|
||||||
"Wind", // Page name
|
"Wind", // 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
|
||||||
{"AWS","AWA", "TWS", "TWA"}, // Bus values we need in the page
|
{"AWS","AWA", "TWS", "TWA"}, // Bus values we need in the page
|
||||||
true // Show display header on/off
|
true // Show display header on/off
|
||||||
);
|
);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -206,7 +206,7 @@ public:
|
||||||
// read boat data values; TWD only for validation test, TWS for display of current value
|
// read boat data values; TWD only for validation test, TWS for display of current value
|
||||||
for (int i = 0; i < numBoatData; i++) {
|
for (int i = 0; i < numBoatData; i++) {
|
||||||
bvalue = pageData.values[i];
|
bvalue = pageData.values[i];
|
||||||
// BDataName[i] = xdrDelete(bvalue->getName());
|
BDataName[i] = xdrDelete(bvalue->getName());
|
||||||
BDataName[i] = BDataName[i].substring(0, 6); // String length limit for value name
|
BDataName[i] = BDataName[i].substring(0, 6); // String length limit for value name
|
||||||
calibrationData.calibrateInstance(bvalue, logger); // Check if boat data value is to be calibrated
|
calibrationData.calibrateInstance(bvalue, logger); // Check if boat data value is to be calibrated
|
||||||
BDataValue[i] = bvalue->value; // Value as double in SI unit
|
BDataValue[i] = bvalue->value; // Value as double in SI unit
|
||||||
|
@ -326,24 +326,13 @@ public:
|
||||||
chrtVal = static_cast<int>(pageData.boatHstry.twdHstry->get(bufStart + (i * dataIntv))); // show the latest wind values in buffer; keep 1st value constant in a rolling buffer
|
chrtVal = static_cast<int>(pageData.boatHstry.twdHstry->get(bufStart + (i * dataIntv))); // show the latest wind values in buffer; keep 1st value constant in a rolling buffer
|
||||||
if (chrtVal == INT16_MIN) {
|
if (chrtVal == INT16_MIN) {
|
||||||
chrtPrevVal = INT16_MIN;
|
chrtPrevVal = INT16_MIN;
|
||||||
/* if (i == linesToShow - 1) {
|
|
||||||
numNoData++;
|
|
||||||
// If more than 4 invalid values in a row, reset chart
|
|
||||||
} else {
|
|
||||||
numNoData = 0; // Reset invalid value counter
|
|
||||||
}
|
|
||||||
if (numNoData > 4) {
|
|
||||||
// If more than 4 invalid values in a row, send message
|
|
||||||
getdisplay().setFont(&Ubuntu_Bold10pt8b);
|
|
||||||
getdisplay().fillRect(xCenter - 66, height / 2 - 20, 146, 24, commonData->bgcolor); // Clear area for TWS value
|
|
||||||
drawTextCenter(xCenter, height / 2 - 10, "No sensor data");
|
|
||||||
} */
|
|
||||||
} else {
|
} else {
|
||||||
chrtVal = static_cast<int>((chrtVal / 1000.0 * radToDeg) + 0.5); // Convert to degrees and round
|
chrtVal = static_cast<int>((chrtVal / 1000.0 * radToDeg) + 0.5); // Convert to degrees and round
|
||||||
x = ((chrtVal - wndLeft + 360) % 360) * chrtScl;
|
x = ((chrtVal - wndLeft + 360) % 360) * chrtScl;
|
||||||
y = yOffset + cHeight - i; // Position in chart area
|
y = yOffset + cHeight - i; // Position in chart area
|
||||||
|
|
||||||
if (i >= (numWndVals / dataIntv) - 10)
|
// if (i >= (numWndVals / dataIntv) - 10)
|
||||||
|
if (i >= (numWndVals / dataIntv) - 1)
|
||||||
LOG_DEBUG(GwLog::DEBUG, "PageWindPlot Chart: i: %d, chrtVal: %d, bufStart: %d, count: %d, linesToShow: %d", i, chrtVal, bufStart, count, (numWndVals / dataIntv));
|
LOG_DEBUG(GwLog::DEBUG, "PageWindPlot Chart: i: %d, chrtVal: %d, bufStart: %d, count: %d, linesToShow: %d", i, chrtVal, bufStart, count, (numWndVals / dataIntv));
|
||||||
|
|
||||||
if ((i == 0) || (chrtPrevVal == INT16_MIN)) {
|
if ((i == 0) || (chrtPrevVal == INT16_MIN)) {
|
||||||
|
@ -378,7 +367,8 @@ public:
|
||||||
int minWndDir = pageData.boatHstry.twdHstry->getMin(numWndVals) / 1000.0 * radToDeg;
|
int minWndDir = pageData.boatHstry.twdHstry->getMin(numWndVals) / 1000.0 * radToDeg;
|
||||||
int maxWndDir = pageData.boatHstry.twdHstry->getMax(numWndVals) / 1000.0 * radToDeg;
|
int maxWndDir = pageData.boatHstry.twdHstry->getMax(numWndVals) / 1000.0 * radToDeg;
|
||||||
LOG_DEBUG(GwLog::DEBUG, "PageWindPlot FreeTop: Minimum: %d, Maximum: %d, OldwndCenter: %d", minWndDir, maxWndDir, wndCenter);
|
LOG_DEBUG(GwLog::DEBUG, "PageWindPlot FreeTop: Minimum: %d, Maximum: %d, OldwndCenter: %d", minWndDir, maxWndDir, wndCenter);
|
||||||
if ((minWndDir + 540 >= wndCenter + 540) || (maxWndDir + 540 <= wndCenter + 540)) {
|
// if ((minWndDir + 540 >= wndCenter + 540) || (maxWndDir + 540 <= wndCenter + 540)) {
|
||||||
|
if (((minWndDir - wndCenter >= 0) && (minWndDir - wndCenter < 180)) || ((maxWndDir - wndCenter <= 0) && (maxWndDir - wndCenter >=180))) {
|
||||||
// Check if all wind value are left or right of center value -> optimize chart range
|
// Check if all wind value are left or right of center value -> optimize chart range
|
||||||
midWndDir = pageData.boatHstry.twdHstry->getMid(numWndVals) / 1000.0 * radToDeg;
|
midWndDir = pageData.boatHstry.twdHstry->getMid(numWndVals) / 1000.0 * radToDeg;
|
||||||
if (midWndDir != INT16_MIN) {
|
if (midWndDir != INT16_MIN) {
|
||||||
|
|
|
@ -48,7 +48,7 @@ public:
|
||||||
String flashLED = config->getString(config->flashLED);
|
String flashLED = config->getString(config->flashLED);
|
||||||
String backlightMode = config->getString(config->backlight);
|
String backlightMode = config->getString(config->backlight);
|
||||||
|
|
||||||
// Get boat values for AWA
|
// Get boat value for AWA
|
||||||
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)
|
||||||
String name1 = xdrDelete(bvalue1->getName()); // Value name
|
String name1 = xdrDelete(bvalue1->getName()); // Value name
|
||||||
name1 = name1.substring(0, 6); // String length limit for value name
|
name1 = name1.substring(0, 6); // String length limit for value name
|
||||||
|
@ -63,8 +63,8 @@ public:
|
||||||
unit1old = unit1; // Save old unit
|
unit1old = unit1; // Save old unit
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get boat values for AWS
|
// Get boat value for AWS
|
||||||
GwApi::BoatValue *bvalue2 = pageData.values[1]; // First element in list (only one value by PageOneValue)
|
GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list
|
||||||
String name2 = xdrDelete(bvalue2->getName()); // Value name
|
String name2 = xdrDelete(bvalue2->getName()); // Value name
|
||||||
name2 = name2.substring(0, 6); // String length limit for value name
|
name2 = name2.substring(0, 6); // String length limit for value name
|
||||||
calibrationData.calibrateInstance(bvalue2, logger); // Check if boat data value is to be calibrated
|
calibrationData.calibrateInstance(bvalue2, logger); // Check if boat data value is to be calibrated
|
||||||
|
@ -77,8 +77,8 @@ public:
|
||||||
unit2old = unit2; // Save old unit
|
unit2old = unit2; // Save old unit
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get boat values TWD
|
// Get boat value for TWD
|
||||||
GwApi::BoatValue *bvalue3 = pageData.values[2]; // Second element in list (only one value by PageOneValue)
|
GwApi::BoatValue *bvalue3 = pageData.values[2]; // Third element in list
|
||||||
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
|
||||||
calibrationData.calibrateInstance(bvalue3, logger); // Check if boat data value is to be calibrated
|
calibrationData.calibrateInstance(bvalue3, logger); // Check if boat data value is to be calibrated
|
||||||
|
@ -91,9 +91,9 @@ public:
|
||||||
unit3old = unit3; // Save old unit
|
unit3old = unit3; // Save old unit
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get boat values TWS
|
// Get boat value for TWS
|
||||||
GwApi::BoatValue *bvalue4 = pageData.values[3]; // Second element in list (only one value by PageOneValue)
|
GwApi::BoatValue *bvalue4 = pageData.values[3]; // Fourth element in list
|
||||||
String name4 = xdrDelete(bvalue4->getName()); // Value name
|
String name4 = xdrDelete(bvalue4->getName()); // Value name
|
||||||
name4 = name4.substring(0, 6); // String length limit for value name
|
name4 = name4.substring(0, 6); // String length limit for value name
|
||||||
calibrationData.calibrateInstance(bvalue4, logger); // Check if boat data value is to be calibrated
|
calibrationData.calibrateInstance(bvalue4, logger); // Check if boat data value is to be calibrated
|
||||||
double value4 = bvalue4->value; // Value as double in SI unit
|
double value4 = bvalue4->value; // Value as double in SI unit
|
||||||
|
@ -105,9 +105,9 @@ public:
|
||||||
unit4old = unit4; // Save old unit
|
unit4old = unit4; // Save old unit
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get boat values DBT
|
// Get boat value for DBT
|
||||||
GwApi::BoatValue *bvalue5 = pageData.values[4]; // Second element in list (only one value by PageOneValue)
|
GwApi::BoatValue *bvalue5 = pageData.values[4]; // Fifth element in list
|
||||||
String name5 = xdrDelete(bvalue5->getName()); // Value name
|
String name5 = xdrDelete(bvalue5->getName()); // Value name
|
||||||
name5 = name5.substring(0, 6); // String length limit for value name
|
name5 = name5.substring(0, 6); // String length limit for value name
|
||||||
calibrationData.calibrateInstance(bvalue5, logger); // Check if boat data value is to be calibrated
|
calibrationData.calibrateInstance(bvalue5, logger); // Check if boat data value is to be calibrated
|
||||||
double value5 = bvalue5->value; // Value as double in SI unit
|
double value5 = bvalue5->value; // Value as double in SI unit
|
||||||
|
@ -119,9 +119,9 @@ public:
|
||||||
unit5old = unit5; // Save old unit
|
unit5old = unit5; // Save old unit
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get boat values STW
|
// Get boat value for STW
|
||||||
GwApi::BoatValue *bvalue6 = pageData.values[5]; // Second element in list (only one value by PageOneValue)
|
GwApi::BoatValue *bvalue6 = pageData.values[5]; // Sixth element in list
|
||||||
String name6 = xdrDelete(bvalue6->getName()); // Value name
|
String name6 = xdrDelete(bvalue6->getName()); // Value name
|
||||||
name6 = name6.substring(0, 6); // String length limit for value name
|
name6 = name6.substring(0, 6); // String length limit for value name
|
||||||
calibrationData.calibrateInstance(bvalue6, logger); // Check if boat data value is to be calibrated
|
calibrationData.calibrateInstance(bvalue6, logger); // Check if boat data value is to be calibrated
|
||||||
double value6 = bvalue6->value; // Value as double in SI unit
|
double value6 = bvalue6->value; // Value as double in SI unit
|
||||||
|
@ -248,7 +248,7 @@ public:
|
||||||
float y = 150 - (rInstrument-30)*cos(i/180.0*pi); // y-coordinate cots
|
float y = 150 - (rInstrument-30)*cos(i/180.0*pi); // y-coordinate cots
|
||||||
const char *ii = "";
|
const char *ii = "";
|
||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
case 0: ii="0"; break;
|
case 0: ii="0"; break;
|
||||||
case 30 : ii="30"; break;
|
case 30 : ii="30"; break;
|
||||||
case 60 : ii="60"; break;
|
case 60 : ii="60"; break;
|
||||||
|
@ -372,11 +372,11 @@ static Page *createPage(CommonData &common){
|
||||||
* and will will provide the names of the fixed values we need
|
* and will will provide the names of the fixed values we need
|
||||||
*/
|
*/
|
||||||
PageDescription registerPageWindRose(
|
PageDescription registerPageWindRose(
|
||||||
"WindRose", // Page name
|
"WindRose", // 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
|
||||||
{"AWA", "AWS", "TWD", "TWS", "DBT", "STW"}, // Bus values we need in the page
|
{"AWA", "AWS", "TWD", "TWS", "DBT", "STW"}, // Bus values we need in the page
|
||||||
true // Show display header on/off
|
true // Show display header on/off
|
||||||
);
|
);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -48,7 +48,7 @@ public:
|
||||||
String flashLED = config->getString(config->flashLED);
|
String flashLED = config->getString(config->flashLED);
|
||||||
String backlightMode = config->getString(config->backlight);
|
String backlightMode = config->getString(config->backlight);
|
||||||
|
|
||||||
// Get boat values for AWA
|
// Get boat values #1
|
||||||
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)
|
||||||
String name1 = xdrDelete(bvalue1->getName()); // Value name
|
String name1 = xdrDelete(bvalue1->getName()); // Value name
|
||||||
name1 = name1.substring(0, 6); // String length limit for value name
|
name1 = name1.substring(0, 6); // String length limit for value name
|
||||||
|
@ -63,13 +63,13 @@ public:
|
||||||
unit1old = unit1; // Save old unit
|
unit1old = unit1; // Save old unit
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get boat values for AWS
|
// Get boat values #2
|
||||||
GwApi::BoatValue *bvalue2 = pageData.values[1]; // First element in list (only one value by PageOneValue)
|
GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list
|
||||||
String name2 = xdrDelete(bvalue2->getName()); // Value name
|
String name2 = xdrDelete(bvalue2->getName()); // Value name
|
||||||
name2 = name2.substring(0, 6); // String length limit for value name
|
name2 = name2.substring(0, 6); // String length limit for value name
|
||||||
calibrationData.calibrateInstance(bvalue2, logger); // Check if boat data value is to be calibrated
|
calibrationData.calibrateInstance(bvalue2, logger); // Check if boat data value is to be calibrated
|
||||||
double value2 = bvalue2->value; // Value as double in SI unit
|
double value2 = bvalue2->value; // Value as double in SI unit
|
||||||
bool valid2 = bvalue2->valid; // Valid information
|
bool valid2 = bvalue2->valid; // Valid information
|
||||||
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
|
||||||
if(valid2 == true){
|
if(valid2 == true){
|
||||||
|
@ -77,13 +77,13 @@ public:
|
||||||
unit2old = unit2; // Save old unit
|
unit2old = unit2; // Save old unit
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get boat values TWD
|
// Get boat values #3
|
||||||
GwApi::BoatValue *bvalue3 = pageData.values[2]; // Second element in list (only one value by PageOneValue)
|
GwApi::BoatValue *bvalue3 = pageData.values[2]; // Third element in list
|
||||||
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
|
||||||
calibrationData.calibrateInstance(bvalue3, logger); // Check if boat data value is to be calibrated
|
calibrationData.calibrateInstance(bvalue3, logger); // Check if boat data value is to be calibrated
|
||||||
double value3 = bvalue3->value; // Value as double in SI unit
|
double value3 = bvalue3->value; // Value as double in SI unit
|
||||||
bool valid3 = bvalue3->valid; // Valid information
|
bool valid3 = bvalue3->valid; // Valid information
|
||||||
String svalue3 = formatValue(bvalue3, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
String svalue3 = formatValue(bvalue3, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
||||||
String unit3 = formatValue(bvalue3, *commonData).unit; // Unit of value
|
String unit3 = formatValue(bvalue3, *commonData).unit; // Unit of value
|
||||||
if(valid3 == true){
|
if(valid3 == true){
|
||||||
|
@ -91,13 +91,13 @@ public:
|
||||||
unit3old = unit3; // Save old unit
|
unit3old = unit3; // Save old unit
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get boat values TWS
|
// Get boat values #4
|
||||||
GwApi::BoatValue *bvalue4 = pageData.values[3]; // Second element in list (only one value by PageOneValue)
|
GwApi::BoatValue *bvalue4 = pageData.values[3]; // Fourth element in list
|
||||||
String name4 = xdrDelete(bvalue4->getName()); // Value name
|
String name4 = xdrDelete(bvalue4->getName()); // Value name
|
||||||
name4 = name4.substring(0, 6); // String length limit for value name
|
name4 = name4.substring(0, 6); // String length limit for value name
|
||||||
calibrationData.calibrateInstance(bvalue4, logger); // Check if boat data value is to be calibrated
|
calibrationData.calibrateInstance(bvalue4, logger); // Check if boat data value is to be calibrated
|
||||||
double value4 = bvalue4->value; // Value as double in SI unit
|
double value4 = bvalue4->value; // Value as double in SI unit
|
||||||
bool valid4 = bvalue4->valid; // Valid information
|
bool valid4 = bvalue4->valid; // Valid information
|
||||||
String svalue4 = formatValue(bvalue4, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
String svalue4 = formatValue(bvalue4, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
||||||
String unit4 = formatValue(bvalue4, *commonData).unit; // Unit of value
|
String unit4 = formatValue(bvalue4, *commonData).unit; // Unit of value
|
||||||
if(valid4 == true){
|
if(valid4 == true){
|
||||||
|
@ -105,13 +105,13 @@ public:
|
||||||
unit4old = unit4; // Save old unit
|
unit4old = unit4; // Save old unit
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get boat values DBT
|
// Get boat values #5
|
||||||
GwApi::BoatValue *bvalue5 = pageData.values[4]; // Second element in list (only one value by PageOneValue)
|
GwApi::BoatValue *bvalue5 = pageData.values[4]; // Fifth element in list
|
||||||
String name5 = xdrDelete(bvalue5->getName()); // Value name
|
String name5 = xdrDelete(bvalue5->getName()); // Value name
|
||||||
name5 = name5.substring(0, 6); // String length limit for value name
|
name5 = name5.substring(0, 6); // String length limit for value name
|
||||||
calibrationData.calibrateInstance(bvalue5, logger); // Check if boat data value is to be calibrated
|
calibrationData.calibrateInstance(bvalue5, logger); // Check if boat data value is to be calibrated
|
||||||
double value5 = bvalue5->value; // Value as double in SI unit
|
double value5 = bvalue5->value; // Value as double in SI unit
|
||||||
bool valid5 = bvalue5->valid; // Valid information
|
bool valid5 = bvalue5->valid; // Valid information
|
||||||
String svalue5 = formatValue(bvalue5, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
String svalue5 = formatValue(bvalue5, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
||||||
String unit5 = formatValue(bvalue5, *commonData).unit; // Unit of value
|
String unit5 = formatValue(bvalue5, *commonData).unit; // Unit of value
|
||||||
if(valid5 == true){
|
if(valid5 == true){
|
||||||
|
@ -119,13 +119,13 @@ public:
|
||||||
unit5old = unit5; // Save old unit
|
unit5old = unit5; // Save old unit
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get boat values STW
|
// Get boat values #5
|
||||||
GwApi::BoatValue *bvalue6 = pageData.values[5]; // Second element in list (only one value by PageOneValue)
|
GwApi::BoatValue *bvalue6 = pageData.values[5]; // Sixth element in list
|
||||||
String name6 = xdrDelete(bvalue6->getName()); // Value name
|
String name6 = xdrDelete(bvalue6->getName()); // Value name
|
||||||
name6 = name6.substring(0, 6); // String length limit for value name
|
name6 = name6.substring(0, 6); // String length limit for value name
|
||||||
calibrationData.calibrateInstance(bvalue6, logger); // Check if boat data value is to be calibrated
|
calibrationData.calibrateInstance(bvalue6, logger); // Check if boat data value is to be calibrated
|
||||||
double value6 = bvalue6->value; // Value as double in SI unit
|
double value6 = bvalue6->value; // Value as double in SI unit
|
||||||
bool valid6 = bvalue6->valid; // Valid information
|
bool valid6 = bvalue6->valid; // Valid information
|
||||||
String svalue6 = formatValue(bvalue6, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
String svalue6 = formatValue(bvalue6, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
||||||
String unit6 = formatValue(bvalue6, *commonData).unit; // Unit of value
|
String unit6 = formatValue(bvalue6, *commonData).unit; // Unit of value
|
||||||
if(valid6 == true){
|
if(valid6 == true){
|
||||||
|
@ -136,7 +136,7 @@ public:
|
||||||
// Optical warning by limit violation (unused)
|
// Optical warning by limit violation (unused)
|
||||||
if(String(flashLED) == "Limit Violation"){
|
if(String(flashLED) == "Limit Violation"){
|
||||||
setBlinkingLED(false);
|
setBlinkingLED(false);
|
||||||
setFlashLED(false);
|
setFlashLED(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Logging boat values
|
// Logging boat values
|
||||||
|
@ -192,7 +192,7 @@ public:
|
||||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||||
getdisplay().setCursor(295, 65);
|
getdisplay().setCursor(295, 65);
|
||||||
if(valid3 == true){
|
if(valid3 == true){
|
||||||
// getdisplay().print(abs(value3 * 180 / PI), 0); // Value
|
// getdisplay().print(abs(value3 * 180 / M_PI), 0); // Value
|
||||||
getdisplay().print(svalue4); // Value
|
getdisplay().print(svalue4); // Value
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
@ -227,16 +227,15 @@ public:
|
||||||
if(holdvalues == false){
|
if(holdvalues == false){
|
||||||
getdisplay().print(unit5); // Unit
|
getdisplay().print(unit5); // Unit
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
getdisplay().print(unit5old); // Unit
|
getdisplay().print(unit5old); // Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//*******************************************************************************************
|
//*******************************************************************************************
|
||||||
|
|
||||||
// Draw wind rose
|
// Draw wind rose
|
||||||
int rInstrument = 110; // Radius of grafic instrument
|
int rInstrument = 110; // Radius of grafic instrument
|
||||||
float pi = 3.141592;
|
|
||||||
|
|
||||||
getdisplay().fillCircle(200, 150, rInstrument + 10, commonData->fgcolor); // Outer circle
|
getdisplay().fillCircle(200, 150, rInstrument + 10, commonData->fgcolor); // Outer circle
|
||||||
getdisplay().fillCircle(200, 150, rInstrument + 7, commonData->bgcolor); // Outer circle
|
getdisplay().fillCircle(200, 150, rInstrument + 7, commonData->bgcolor); // Outer circle
|
||||||
|
@ -246,24 +245,23 @@ public:
|
||||||
for(int i=0; i<360; i=i+10)
|
for(int i=0; i<360; i=i+10)
|
||||||
{
|
{
|
||||||
// Scaling values
|
// Scaling values
|
||||||
float x = 200 + (rInstrument-30)*sin(i/180.0*pi); // x-coordinate dots
|
float x = 200 + (rInstrument-30)*sin(i/180.0*M_PI); // x-coordinate dots
|
||||||
float y = 150 - (rInstrument-30)*cos(i/180.0*pi); // y-coordinate dots
|
float y = 150 - (rInstrument-30)*cos(i/180.0*M_PI); // y-coordinate dots
|
||||||
const char *ii = "";
|
const char *ii = "";
|
||||||
switch (i)
|
switch (i) {
|
||||||
{
|
case 0: ii="0"; break;
|
||||||
case 0: ii="0"; break;
|
case 30 : ii="30"; break;
|
||||||
case 30 : ii="30"; break;
|
case 60 : ii="60"; break;
|
||||||
case 60 : ii="60"; break;
|
case 90 : ii="90"; break;
|
||||||
case 90 : ii="90"; break;
|
case 120 : ii="120"; break;
|
||||||
case 120 : ii="120"; break;
|
case 150 : ii="150"; break;
|
||||||
case 150 : ii="150"; break;
|
case 180 : ii="180"; break;
|
||||||
case 180 : ii="180"; break;
|
case 210 : ii="210"; break;
|
||||||
case 210 : ii="210"; break;
|
case 240 : ii="240"; break;
|
||||||
case 240 : ii="240"; break;
|
case 270 : ii="270"; break;
|
||||||
case 270 : ii="270"; break;
|
case 300 : ii="300"; break;
|
||||||
case 300 : ii="300"; break;
|
case 330 : ii="330"; break;
|
||||||
case 330 : ii="330"; break;
|
default: break;
|
||||||
default: break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print text centered on position x, y
|
// Print text centered on position x, y
|
||||||
|
@ -277,11 +275,11 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw sub scale with dots
|
// Draw sub scale with dots
|
||||||
float x1c = 200 + rInstrument*sin(i/180.0*pi);
|
float x1c = 200 + rInstrument*sin(i/180.0*M_PI);
|
||||||
float y1c = 150 - rInstrument*cos(i/180.0*pi);
|
float y1c = 150 - rInstrument*cos(i/180.0*M_PI);
|
||||||
getdisplay().fillCircle((int)x1c, (int)y1c, 2, commonData->fgcolor);
|
getdisplay().fillCircle((int)x1c, (int)y1c, 2, commonData->fgcolor);
|
||||||
float sinx=sin(i/180.0*pi);
|
float sinx=sin(i/180.0*M_PI);
|
||||||
float cosx=cos(i/180.0*pi);
|
float cosx=cos(i/180.0*M_PI);
|
||||||
|
|
||||||
// Draw sub scale with lines (two triangles)
|
// Draw sub scale with lines (two triangles)
|
||||||
if(i % 30 == 0){
|
if(i % 30 == 0){
|
||||||
|
@ -309,7 +307,7 @@ public:
|
||||||
float xx1 = -startwidth;
|
float xx1 = -startwidth;
|
||||||
float xx2 = startwidth;
|
float xx2 = startwidth;
|
||||||
float yy1 = -startwidth;
|
float yy1 = -startwidth;
|
||||||
float yy2 = -(rInstrument-15);
|
float yy2 = -(rInstrument-15);
|
||||||
getdisplay().fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1),
|
getdisplay().fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1),
|
||||||
200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
||||||
200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData->fgcolor);
|
200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData->fgcolor);
|
||||||
|
@ -331,36 +329,26 @@ public:
|
||||||
|
|
||||||
//*******************************************************************************************
|
//*******************************************************************************************
|
||||||
|
|
||||||
// Show value6, so that it does not collide with the wind pointer
|
// Show value6, so that it does not collide with the wind pointer
|
||||||
if ( cos(value1) > 0){
|
getdisplay().setFont(&DSEG7Classic_BoldItalic16pt7b);
|
||||||
getdisplay().setFont(&DSEG7Classic_BoldItalic16pt7b);
|
if (cos(value1) > 0){
|
||||||
getdisplay().setCursor(160, 200);
|
getdisplay().setCursor(160, 200);
|
||||||
getdisplay().print(svalue6); // Value
|
getdisplay().print(svalue6); // Value
|
||||||
getdisplay().setFont(&Ubuntu_Bold8pt8b);
|
getdisplay().setFont(&Ubuntu_Bold8pt8b);
|
||||||
getdisplay().setCursor(190, 215);
|
getdisplay().setCursor(190, 215);
|
||||||
getdisplay().print(" ");
|
} else{
|
||||||
if(holdvalues == false){
|
getdisplay().setCursor(160, 130);
|
||||||
getdisplay().print(unit6); // Unit
|
getdisplay().print(svalue6); // Value
|
||||||
}
|
getdisplay().setFont(&Ubuntu_Bold8pt8b);
|
||||||
else{
|
getdisplay().setCursor(190, 90);
|
||||||
getdisplay().print(unit6old); // Unit
|
}
|
||||||
}
|
getdisplay().print(" ");
|
||||||
}
|
if(holdvalues == false){
|
||||||
else{
|
getdisplay().print(unit6); // Unit
|
||||||
getdisplay().setFont(&DSEG7Classic_BoldItalic16pt7b);
|
}
|
||||||
getdisplay().setCursor(160, 130);
|
else{
|
||||||
getdisplay().print(svalue6); // Value
|
getdisplay().print(unit6old); // Unit
|
||||||
getdisplay().setFont(&Ubuntu_Bold8pt8b);
|
}
|
||||||
getdisplay().setCursor(190, 90);
|
|
||||||
getdisplay().print(" ");
|
|
||||||
if(holdvalues == false){
|
|
||||||
getdisplay().print(unit6); // Unit
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
getdisplay().print(unit6old); // Unit
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return PAGE_UPDATE;
|
return PAGE_UPDATE;
|
||||||
};
|
};
|
||||||
|
@ -377,11 +365,10 @@ static Page *createPage(CommonData &common){
|
||||||
* and will will provide the names of the fixed values we need
|
* and will will provide the names of the fixed values we need
|
||||||
*/
|
*/
|
||||||
PageDescription registerPageWindRoseFlex(
|
PageDescription registerPageWindRoseFlex(
|
||||||
"WindRoseFlex", // Page name
|
"WindRoseFlex", // Page name
|
||||||
createPage, // Action
|
createPage, // Action
|
||||||
6, // Number of bus values depends on selection in Web configuration; was zero
|
6, // Number of bus values depends on selection in Web configuration; was zero
|
||||||
//{"AWA", "AWS", "COG", "SOG", "TWD", "TWS"}, // Bus values we need in the page, modified for WindRose2
|
true // Show display header on/off
|
||||||
true // Show display header on/off
|
|
||||||
);
|
);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -223,11 +223,11 @@ static Page* createPage(CommonData &common){
|
||||||
* this will be number of BoatValue pointers in pageData.values
|
* this will be number of BoatValue pointers in pageData.values
|
||||||
*/
|
*/
|
||||||
PageDescription registerPageXTETrack(
|
PageDescription registerPageXTETrack(
|
||||||
"XTETrack", // Page name
|
"XTETrack", // 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
|
||||||
{"XTE", "COG", "DTW", "BTW"}, // Bus values we need in the page
|
{"XTE", "COG", "DTW", "BTW"}, // Bus values we need in the page
|
||||||
true // Show display header on/off
|
true // Show display header on/off
|
||||||
);
|
);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -197,7 +197,7 @@ typedef struct{
|
||||||
double value;
|
double value;
|
||||||
String svalue;
|
String svalue;
|
||||||
String unit;
|
String unit;
|
||||||
} FormatedData;
|
} FormattedData;
|
||||||
|
|
||||||
// Formatter for boat values
|
// Formatter for boat values
|
||||||
FormatedData formatValue(GwApi::BoatValue *value, CommonData &commondata);
|
FormattedData formatValue(GwApi::BoatValue *value, CommonData &commondata);
|
||||||
|
|
|
@ -406,10 +406,9 @@ bool addTrueWind(GwApi* api, BoatValueList* boatValues) {
|
||||||
hdtVal = hdtBVal->valid ? hdtBVal->value : DBL_MIN;
|
hdtVal = hdtBVal->valid ? hdtBVal->value : DBL_MIN;
|
||||||
hdmVal = hdmBVal->valid ? hdmBVal->value : DBL_MIN;
|
hdmVal = hdmBVal->valid ? hdmBVal->value : DBL_MIN;
|
||||||
varVal = varBVal->valid ? varBVal->value : DBL_MIN;
|
varVal = varBVal->valid ? varBVal->value : DBL_MIN;
|
||||||
api->getLogger()->logDebug(GwLog::DEBUG,"obp60task addTrueWind: AWA: %.1f, AWS: %.1f, COG: %.1f, STW: %.1f, HDT: %.1f, HDM: %.1f, VAR: %.1f", awaBVal->value * RAD_TO_DEG, awsBVal->value * 3.6 / 1.852,
|
api->getLogger()->logDebug(GwLog::DEBUG,"obp60task addTrueWind: AWA %.1f, AWS %.1f, COG %.1f, STW %.1f, SOG %.1f, HDT %.1f, HDM %.1f, VAR %.1f", awaBVal->value * RAD_TO_DEG, awsBVal->value * 3.6 / 1.852,
|
||||||
cogBVal->value * RAD_TO_DEG, stwBVal->value * 3.6 / 1.852, hdtBVal->value * RAD_TO_DEG, hdmBVal->value * RAD_TO_DEG, varBVal->value * RAD_TO_DEG);
|
cogBVal->value * RAD_TO_DEG, stwBVal->value * 3.6 / 1.852, sogBVal->value * 3.6 / 1.852, hdtBVal->value * RAD_TO_DEG, hdmBVal->value * RAD_TO_DEG, varBVal->value * RAD_TO_DEG);
|
||||||
|
|
||||||
// isCalculated = WindUtils::calcTrueWind(&awaVal, &awsVal, &cogVal, &stwVal, &sogVal, &hdtVal, &hdmVal, &varVal, &twdBVal->value, &twsBVal->value, &twaBVal->value);
|
|
||||||
isCalculated = WindUtils::calcTrueWind(&awaVal, &awsVal, &cogVal, &stwVal, &sogVal, &hdtVal, &hdmVal, &varVal, &twd, &tws, &twa);
|
isCalculated = WindUtils::calcTrueWind(&awaVal, &awsVal, &cogVal, &stwVal, &sogVal, &hdtVal, &hdmVal, &varVal, &twd, &tws, &twa);
|
||||||
|
|
||||||
if (isCalculated) { // Replace values only, if successfully calculated and not already available
|
if (isCalculated) { // Replace values only, if successfully calculated and not already available
|
||||||
|
@ -426,8 +425,8 @@ bool addTrueWind(GwApi* api, BoatValueList* boatValues) {
|
||||||
twaBVal->valid = true;
|
twaBVal->valid = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
api->getLogger()->logDebug(GwLog::DEBUG,"obp60task calcTrueWind: TWD_Valid? %d, TWD=%.1f, TWS=%.1f, TWA=%.1f, isCalculated? %d", twdBVal->valid, twdBVal->value * RAD_TO_DEG, twsBVal->value * 3.6 / 1.852,
|
api->getLogger()->logDebug(GwLog::DEBUG,"obp60task addTrueWind: TWD_Valid %d, isCalculated %d, TWD %.1f, TWA %.1f, TWS %.1f", twdBVal->valid, isCalculated, twdBVal->value * RAD_TO_DEG,
|
||||||
twaBVal->value * RAD_TO_DEG, isCalculated);
|
twaBVal->value * RAD_TO_DEG, twsBVal->value * 3.6 / 1.852);
|
||||||
|
|
||||||
return isCalculated;
|
return isCalculated;
|
||||||
}
|
}
|
||||||
|
@ -466,8 +465,8 @@ void handleHstryBuf(GwApi* api, BoatValueList* boatValues, tBoatHstryData hstryB
|
||||||
GwApi::BoatValue *twsBVal = boatValues->findValueOrCreate(hstryBufList.twsHstry->getName());
|
GwApi::BoatValue *twsBVal = boatValues->findValueOrCreate(hstryBufList.twsHstry->getName());
|
||||||
GwApi::BoatValue *twaBVal = boatValues->findValueOrCreate("TWA");
|
GwApi::BoatValue *twaBVal = boatValues->findValueOrCreate("TWA");
|
||||||
|
|
||||||
api->getLogger()->logDebug(GwLog::DEBUG,"obp60task handleHstryBuf: twdBVal: %f, twsBVal: %f, twaBVal: %f, TWD_isValid? %d", twdBVal->value * RAD_TO_DEG,
|
api->getLogger()->logDebug(GwLog::DEBUG,"obp60task handleHstryBuf: twdBVal: %.1f, twaBVal: %.1f, twsBVal: %.1f, TWD_isValid? %d", twdBVal->value * RAD_TO_DEG,
|
||||||
twsBVal->value * 3.6 / 1.852, twaBVal->value * RAD_TO_DEG, twdBVal->valid);
|
twaBVal->value * RAD_TO_DEG, twsBVal->value * 3.6 / 1.852, twdBVal->valid);
|
||||||
calBVal = new GwApi::BoatValue("TWD"); // temporary solution for calibration of history buffer values
|
calBVal = new GwApi::BoatValue("TWD"); // temporary solution for calibration of history buffer values
|
||||||
calBVal->setFormat(twdBVal->getFormat());
|
calBVal->setFormat(twdBVal->getFormat());
|
||||||
if (twdBVal->valid) {
|
if (twdBVal->valid) {
|
||||||
|
|
Loading…
Reference in New Issue