Add RollPitch page and code cleaning
This commit is contained in:
parent
cf9ae1e767
commit
8054567f4f
|
@ -112,6 +112,14 @@ void setBuzzerPower(uint power){
|
|||
buzzerpower = power;
|
||||
}
|
||||
|
||||
// Delete xdr prefix from string
|
||||
String xdrDelete(String input){
|
||||
if(input.substring(0,3) == "xdr"){
|
||||
input = input.substring(3, input.length());
|
||||
}
|
||||
return input;
|
||||
}
|
||||
|
||||
// Show a triangle for trend direction high (x, y is the left edge)
|
||||
void displayTrendHigh(int16_t x, int16_t y, uint16_t size, uint16_t color){
|
||||
display.fillTriangle(x, y, x+size*2, y, x+size, y-size*2, color);
|
||||
|
|
|
@ -37,6 +37,8 @@ void setBlinkingLED(bool on); // Set blinking LED active
|
|||
void buzzer(uint frequency, uint duration); // Buzzer function
|
||||
void setBuzzerPower(uint power); // Set buzzer power
|
||||
|
||||
String xdrDelete(String input); // Delete xdr prefix from string
|
||||
|
||||
void displayTrendHigh(int16_t x, int16_t y, uint16_t size, uint16_t color);
|
||||
void displayTrendLow(int16_t x, int16_t y, uint16_t size, uint16_t color);
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@ FormatedData formatValue(GwApi::BoatValue *value, CommonData &commondata){
|
|||
static int dayoffset = 0;
|
||||
|
||||
// Load configuration values
|
||||
|
||||
String stimeZone = commondata.config->getString(commondata.config->timeZone); // [UTC -14.00...+12.00]
|
||||
double timeZone = stimeZone.toDouble();
|
||||
String lengthFormat = commondata.config->getString(commondata.config->lengthFormat); // [m|ft]
|
||||
|
@ -383,6 +382,25 @@ FormatedData formatValue(GwApi::BoatValue *value, CommonData &commondata){
|
|||
snprintf(buffer,bsize,"%3.0f",distance);
|
||||
}
|
||||
}
|
||||
//########################################################
|
||||
else if (value->getFormat() == "formatXdrD"){
|
||||
double angle = 0;
|
||||
if(usesimudata == false) {
|
||||
angle = value->value;
|
||||
angle = angle * 57.2958; // Unit conversion form rad to deg
|
||||
}
|
||||
else{
|
||||
angle = 20 + random(-5, 5);
|
||||
}
|
||||
if(angle > -10 && angle < 10){
|
||||
snprintf(buffer,bsize,"%3.1f",angle);
|
||||
}
|
||||
else{
|
||||
snprintf(buffer,bsize,"%3.0f",angle);
|
||||
}
|
||||
result.unit = "Deg";
|
||||
}
|
||||
//########################################################
|
||||
else{
|
||||
if(value->value < 10){
|
||||
snprintf(buffer,bsize,"%3.2f",value->value);
|
||||
|
|
|
@ -107,44 +107,26 @@ public:
|
|||
|
||||
// Show values GPS date
|
||||
display.setTextColor(textcolor);
|
||||
if(holdvalues == false){
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(10, 65);
|
||||
display.print(svalue2); // Value
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(10, 95);
|
||||
display.print("Date"); // Name
|
||||
}
|
||||
else{
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(10, 65);
|
||||
display.print(svalue2old); // Value
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(10, 95);
|
||||
display.print("Date"); // Name
|
||||
}
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(10, 65);
|
||||
if(holdvalues == false) display.print(svalue2); // Value
|
||||
else display.print(svalue2old);
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(10, 95);
|
||||
display.print("Date"); // Name
|
||||
|
||||
// Horizintal separator left
|
||||
display.fillRect(0, 149, 60, 3, pixelcolor);
|
||||
|
||||
// Show values GPS time
|
||||
display.setTextColor(textcolor);
|
||||
if(holdvalues == false){
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(10, 250);
|
||||
display.print(svalue1); // Value
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(10, 220);
|
||||
display.print("Time"); // Name
|
||||
}
|
||||
else{
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(10, 250);
|
||||
display.print(svalue1old); // Value
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(10, 220);
|
||||
display.print("Time"); // Name
|
||||
}
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(10, 250);
|
||||
if(holdvalues == false) display.print(svalue1); // Value
|
||||
else display.print(svalue1old);
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(10, 220);
|
||||
display.print("Time"); // Name
|
||||
|
||||
// Show values sunrise
|
||||
String sunrise = "---";
|
||||
|
|
|
@ -44,7 +44,7 @@ class PageDST810 : public Page
|
|||
|
||||
// Get boat values #1
|
||||
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue)
|
||||
String name1 = bvalue1->getName().c_str(); // Value name
|
||||
String name1 = xdrDelete(bvalue1->getName()); // Value name
|
||||
name1 = name1.substring(0, 6); // String length limit for value name
|
||||
double value1 = bvalue1->value; // Value as double in SI unit
|
||||
bool valid1 = bvalue1->valid; // Valid information
|
||||
|
@ -53,7 +53,7 @@ class PageDST810 : public Page
|
|||
|
||||
// Get boat values #2
|
||||
GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list (only one value by PageOneValue)
|
||||
String name2 = bvalue2->getName().c_str(); // Value name
|
||||
String name2 = xdrDelete(bvalue2->getName()); // Value name
|
||||
name2 = name2.substring(0, 6); // String length limit for value name
|
||||
double value2 = bvalue2->value; // Value as double in SI unit
|
||||
bool valid2 = bvalue2->valid; // Valid information
|
||||
|
@ -62,7 +62,7 @@ class PageDST810 : public Page
|
|||
|
||||
// Get boat values #3
|
||||
GwApi::BoatValue *bvalue3 = pageData.values[2]; // Second element in list (only one value by PageOneValue)
|
||||
String name3 = bvalue3->getName().c_str(); // Value name
|
||||
String name3 = xdrDelete(bvalue3->getName()); // Value name
|
||||
name3 = name3.substring(0, 6); // String length limit for value name
|
||||
double value3 = bvalue3->value; // Value as double in SI unit
|
||||
bool valid3 = bvalue3->valid; // Valid information
|
||||
|
@ -71,7 +71,7 @@ class PageDST810 : public Page
|
|||
|
||||
// Get boat values #4
|
||||
GwApi::BoatValue *bvalue4 = pageData.values[3]; // Second element in list (only one value by PageOneValue)
|
||||
String name4 = bvalue4->getName().c_str(); // Value name
|
||||
String name4 = xdrDelete(bvalue4->getName()); // Value name
|
||||
name4 = name4.substring(0, 6); // String length limit for value name
|
||||
double value4 = bvalue4->value; // Value as double in SI unit
|
||||
bool valid4 = bvalue4->valid; // Valid information
|
||||
|
|
|
@ -44,7 +44,7 @@ class PageFourValues : public Page
|
|||
|
||||
// Get boat values #1
|
||||
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue)
|
||||
String name1 = bvalue1->getName().c_str(); // Value name
|
||||
String name1 = xdrDelete(bvalue1->getName()); // Value name
|
||||
name1 = name1.substring(0, 6); // String length limit for value name
|
||||
double value1 = bvalue1->value; // Value as double in SI unit
|
||||
bool valid1 = bvalue1->valid; // Valid information
|
||||
|
@ -53,7 +53,7 @@ class PageFourValues : public Page
|
|||
|
||||
// Get boat values #2
|
||||
GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list (only one value by PageOneValue)
|
||||
String name2 = bvalue2->getName().c_str(); // Value name
|
||||
String name2 = xdrDelete(bvalue2->getName()); // Value name
|
||||
name2 = name2.substring(0, 6); // String length limit for value name
|
||||
double value2 = bvalue2->value; // Value as double in SI unit
|
||||
bool valid2 = bvalue2->valid; // Valid information
|
||||
|
@ -62,7 +62,7 @@ class PageFourValues : public Page
|
|||
|
||||
// Get boat values #3
|
||||
GwApi::BoatValue *bvalue3 = pageData.values[2]; // Second element in list (only one value by PageOneValue)
|
||||
String name3 = bvalue3->getName().c_str(); // Value name
|
||||
String name3 = xdrDelete(bvalue3->getName()); // Value name
|
||||
name3 = name3.substring(0, 6); // String length limit for value name
|
||||
double value3 = bvalue3->value; // Value as double in SI unit
|
||||
bool valid3 = bvalue3->valid; // Valid information
|
||||
|
@ -71,7 +71,7 @@ class PageFourValues : public Page
|
|||
|
||||
// Get boat values #4
|
||||
GwApi::BoatValue *bvalue4 = pageData.values[3]; // Second element in list (only one value by PageOneValue)
|
||||
String name4 = bvalue4->getName().c_str(); // Value name
|
||||
String name4 = xdrDelete(bvalue4->getName()); // Value name
|
||||
name4 = name4.substring(0, 6); // String length limit for value name
|
||||
double value4 = bvalue4->value; // Value as double in SI unit
|
||||
bool valid4 = bvalue4->valid; // Valid information
|
||||
|
|
|
@ -44,7 +44,7 @@ class PageFourValues2 : public Page
|
|||
|
||||
// Get boat values #1
|
||||
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue)
|
||||
String name1 = bvalue1->getName().c_str(); // Value name
|
||||
String name1 = xdrDelete(bvalue1->getName()); // Value name
|
||||
name1 = name1.substring(0, 6); // String length limit for value name
|
||||
double value1 = bvalue1->value; // Value as double in SI unit
|
||||
bool valid1 = bvalue1->valid; // Valid information
|
||||
|
@ -53,7 +53,7 @@ class PageFourValues2 : public Page
|
|||
|
||||
// Get boat values #2
|
||||
GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list (only one value by PageOneValue)
|
||||
String name2 = bvalue2->getName().c_str(); // Value name
|
||||
String name2 = xdrDelete(bvalue2->getName()); // Value name
|
||||
name2 = name2.substring(0, 6); // String length limit for value name
|
||||
double value2 = bvalue2->value; // Value as double in SI unit
|
||||
bool valid2 = bvalue2->valid; // Valid information
|
||||
|
@ -62,7 +62,7 @@ class PageFourValues2 : public Page
|
|||
|
||||
// Get boat values #3
|
||||
GwApi::BoatValue *bvalue3 = pageData.values[2]; // Second element in list (only one value by PageOneValue)
|
||||
String name3 = bvalue3->getName().c_str(); // Value name
|
||||
String name3 = xdrDelete(bvalue3->getName()); // Value name
|
||||
name3 = name3.substring(0, 6); // String length limit for value name
|
||||
double value3 = bvalue3->value; // Value as double in SI unit
|
||||
bool valid3 = bvalue3->valid; // Valid information
|
||||
|
@ -71,7 +71,7 @@ class PageFourValues2 : public Page
|
|||
|
||||
// Get boat values #4
|
||||
GwApi::BoatValue *bvalue4 = pageData.values[3]; // Second element in list (only one value by PageOneValue)
|
||||
String name4 = bvalue4->getName().c_str(); // Value name
|
||||
String name4 = xdrDelete(bvalue4->getName()); // Value name
|
||||
name4 = name4.substring(0, 6); // String length limit for value name
|
||||
double value4 = bvalue4->value; // Value as double in SI unit
|
||||
bool valid4 = bvalue4->valid; // Valid information
|
||||
|
|
|
@ -212,15 +212,15 @@ public:
|
|||
|
||||
if(rotsensor == "AS5600" && rotfunction == "Keel" && (valid1 == true || holdvalues == true || simulation == true)){
|
||||
// Print Unit of keel position
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(175, 110);
|
||||
display.print(unit1); // Unit
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(175, 110);
|
||||
display.print(unit1); // Unit
|
||||
}
|
||||
else{
|
||||
// Print Unit of keel position
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(145, 110);
|
||||
display.print("No sensor data"); // Info missing sensor
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(145, 110);
|
||||
display.print("No sensor data"); // Info missing sensor
|
||||
}
|
||||
|
||||
//*******************************************************************************************
|
||||
|
|
|
@ -37,7 +37,7 @@ class PageOneValue : public Page{
|
|||
|
||||
// Get boat values
|
||||
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue)
|
||||
String name1 = bvalue1->getName().c_str(); // Value name
|
||||
String name1 = xdrDelete(bvalue1->getName()); // Value name
|
||||
name1 = name1.substring(0, 6); // String length limit for value name
|
||||
double value1 = bvalue1->value; // Value as double in SI unit
|
||||
bool valid1 = bvalue1->valid; // Valid information
|
||||
|
|
|
@ -42,20 +42,16 @@ public:
|
|||
bool holdvalues = config->getBool(config->holdvalues);
|
||||
String flashLED = config->getString(config->flashLED);
|
||||
String backlightMode = config->getString(config->backlight);
|
||||
String stimezone = config->getString(config->timeZone);
|
||||
double timezone = stimezone.toDouble();
|
||||
|
||||
// Get boat values for GPS time
|
||||
// Get boat values for roll
|
||||
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue)
|
||||
String name1 = bvalue1->getName().c_str(); // Value name
|
||||
name1 = name1.substring(0, 6); // String length limit for value name
|
||||
if(simulation == false){
|
||||
value1 = bvalue1->value; // Value as double in SI unit
|
||||
String name1 = xdrDelete(bvalue1->getName()); // Value name
|
||||
name1 = name1.substring(0, 6); // String length limit for value name // Other simulation data see OBP60Formater.cpp
|
||||
bool valid1 = bvalue1->valid; // Valid information
|
||||
if(valid1 == false){
|
||||
value1 = 0;
|
||||
}
|
||||
else{
|
||||
value1 = 38160; // Simulation data for time value 11:36 in seconds
|
||||
} // Other simulation data see OBP60Formater.cpp
|
||||
bool valid1 = bvalue1->valid; // Valid information
|
||||
value1 = bvalue1->value; // Raw value for roll in rad
|
||||
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
|
||||
if(valid1 == true){
|
||||
|
@ -63,12 +59,15 @@ public:
|
|||
unit1old = unit1; // Save old unit
|
||||
}
|
||||
|
||||
// Get boat values for GPS date
|
||||
// Get boat values for pitch
|
||||
GwApi::BoatValue *bvalue2 = pageData.values[1]; // First element in list (only one value by PageOneValue)
|
||||
String name2 = bvalue2->getName().c_str(); // Value name
|
||||
String name2 = xdrDelete(bvalue2->getName()); // Value name
|
||||
name2 = name2.substring(0, 6); // String length limit for value name
|
||||
value2 = bvalue2->value; // Value as double in SI unit
|
||||
bool valid2 = bvalue2->valid; // Valid information
|
||||
bool valid2 = bvalue2->valid; // Valid information
|
||||
value2 = bvalue2->value; // Raw value for pitch
|
||||
if(valid1 == false){
|
||||
value1 = 0;
|
||||
}
|
||||
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
|
||||
if(valid2 == true){
|
||||
|
@ -108,45 +107,42 @@ public:
|
|||
// Horizintal separator left
|
||||
display.fillRect(0, 149, 60, 3, pixelcolor);
|
||||
|
||||
// Show values GPS time
|
||||
// Show roll value
|
||||
display.setTextColor(textcolor);
|
||||
if(holdvalues == false){
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(10, 250);
|
||||
display.print(svalue1); // Value
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(10, 220);
|
||||
display.print("Roll"); // Name
|
||||
}
|
||||
else{
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(10, 250);
|
||||
display.print(svalue1old); // Value
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(10, 220);
|
||||
display.print("ROLL"); // Name
|
||||
}
|
||||
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
display.setCursor(10, 270);
|
||||
if(holdvalues == false) display.print(svalue1); // Value
|
||||
else display.print(svalue1old);
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(10, 220);
|
||||
display.print(name1); // Name
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(10, 190);
|
||||
display.print(" ");
|
||||
if(holdvalues == false) display.print(unit1); // Unit
|
||||
else display.print(unit1old);
|
||||
|
||||
// Horizintal separator right
|
||||
display.fillRect(340, 149, 80, 3, pixelcolor);
|
||||
|
||||
// Show values sunset
|
||||
String sunset = "---";
|
||||
if(valid1 == true && valid2 == true){
|
||||
sunset = String(commonData.sundata.sunsetHour) + ":" + String(commonData.sundata.sunsetMinute + 100).substring(1);
|
||||
}
|
||||
|
||||
// Show pitch value
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(335, 250);
|
||||
display.print(sunset); // Value
|
||||
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
display.setCursor(295, 270);
|
||||
if(holdvalues == false) display.print(svalue2); // Value
|
||||
else display.print(svalue2old);
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(335, 220);
|
||||
display.print("Pitch"); // Name
|
||||
display.print(name2); // Name
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(335, 190);
|
||||
display.print(" ");
|
||||
if(holdvalues == false) display.print(unit1); // Unit
|
||||
else display.print(unit1old);
|
||||
|
||||
//*******************************************************************************************
|
||||
|
||||
// Draw clock
|
||||
// Draw instrument
|
||||
int rInstrument = 100; // Radius of instrument
|
||||
float pi = 3.141592;
|
||||
|
||||
|
@ -207,22 +203,56 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
// RollPitch values
|
||||
double hour = 0;
|
||||
double minute = 0;
|
||||
value1 = value1 + int(timezone*3600);
|
||||
if (value1 > 86400) {value1 = value1 - 86400;}
|
||||
if (value1 < 0) {value1 = value1 + 86400;}
|
||||
hour = (value1 / 3600.0);
|
||||
if(hour > 12) hour = hour - 12.0;
|
||||
minute = (hour - int(hour)) * 3600.0 / 60.0;
|
||||
LOG_DEBUG(GwLog::DEBUG,"... PageRollPitch, value1: %f hour: %f minute:%f", value1, hour, minute);
|
||||
// Draw keel position pointer
|
||||
float startwidth = 8; // Start width of pointer
|
||||
|
||||
if(valid1 == true || holdvalues == true || simulation == true){
|
||||
float sinx=sin((2 * pi) - (value1 + pi));
|
||||
float cosx=cos((2 * pi) - (value1 + pi));
|
||||
// Normal pointer
|
||||
// Pointer as triangle with center base 2*width
|
||||
float xx1 = -startwidth;
|
||||
float xx2 = startwidth;
|
||||
float yy1 = -startwidth;
|
||||
float yy2 = -(rInstrument * 0.7);
|
||||
display.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*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),pixelcolor);
|
||||
// Inverted pointer
|
||||
// Pointer as triangle with center base 2*width
|
||||
float endwidth = 2; // End width of pointer
|
||||
float ix1 = endwidth;
|
||||
float ix2 = -endwidth;
|
||||
float iy1 = -(rInstrument * 0.7);
|
||||
float iy2 = -endwidth;
|
||||
display.fillTriangle(200+(int)(cosx*ix1-sinx*iy1),150+(int)(sinx*ix1+cosx*iy1),
|
||||
200+(int)(cosx*ix2-sinx*iy1),150+(int)(sinx*ix2+cosx*iy1),
|
||||
200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),pixelcolor);
|
||||
|
||||
// Draw counterweight
|
||||
display.fillCircle(200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2), 5, pixelcolor);
|
||||
}
|
||||
|
||||
// Center circle
|
||||
display.fillCircle(200, 150, startwidth + 22, bgcolor);
|
||||
display.fillCircle(200, 150, startwidth + 20, pixelcolor); // Boat circle
|
||||
int x0 = 200 + 10*cos((2 * pi) - value1);
|
||||
int y0 = 150 + 10*sin((2 * pi) - value1);
|
||||
int x1 = x0 + 50*cos((2 * pi) - value1);
|
||||
int y1 = y0 + 50*sin((2 * pi) - value1);
|
||||
int x2 = x0 + 50*cos((2 * pi) - value1 - pi/2);
|
||||
int y2 = y0 + 50*sin((2 * pi) - value1 - pi/2);
|
||||
display.fillTriangle(x0, y0, x1, y1, x2, y2, bgcolor); // Clear half top side of circle (right triangle)
|
||||
x1 = x0 + 50*cos((2 * pi) - value1 + pi);
|
||||
y1 = y0 + 50*sin((2 * pi) - value1 + pi);
|
||||
display.fillTriangle(x0, y0, x1, y1, x2, y2, bgcolor); // Clear half top side of circle (left triangle)
|
||||
display.fillRect(150, 160, 100, 4, pixelcolor); // Water line
|
||||
|
||||
// Draw roll pointer
|
||||
int startwidth = 4; // Start width of pointer
|
||||
startwidth = 4; // Start width of pointer
|
||||
if(valid1 == true || holdvalues == true || simulation == true){
|
||||
float sinx=sin(minute * 6.0 * pi / 180); // Minute
|
||||
float cosx=cos(minute * 6.0 * pi / 180);
|
||||
float sinx=sin((2 * pi) - value1); // Roll
|
||||
float cosx=cos((2 * pi) - value1);
|
||||
// Normal pointer
|
||||
// Pointer as triangle with center base 2*width
|
||||
float xx1 = -startwidth;
|
||||
|
@ -243,10 +273,12 @@ public:
|
|||
200+(int)(cosx*ix2-sinx*iy1),150+(int)(sinx*ix2+cosx*iy1),
|
||||
200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),pixelcolor);
|
||||
}
|
||||
|
||||
// Center circle
|
||||
display.fillCircle(200, 150, startwidth + 6, bgcolor);
|
||||
display.fillCircle(200, 150, startwidth + 4, pixelcolor);
|
||||
else{
|
||||
// Print sensor info
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(145, 200);
|
||||
display.print("No sensor data"); // Info missing sensor
|
||||
}
|
||||
|
||||
//*******************************************************************************************
|
||||
// Key Layout
|
||||
|
@ -285,7 +317,7 @@ PageDescription registerPageRollPitch(
|
|||
"RollPitch", // Page name
|
||||
createPage, // Action
|
||||
0, // Number of bus values depends on selection in Web configuration
|
||||
{"GPST", "GPSD"}, // Bus values we need in the page
|
||||
{"xdrRoll", "xdrPitch"},// Bus values we need in the page
|
||||
true // Show display header on/off
|
||||
);
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ class PageThreeValues : public Page
|
|||
|
||||
// Get boat values #1
|
||||
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue)
|
||||
String name1 = bvalue1->getName().c_str(); // Value name
|
||||
String name1 = xdrDelete(bvalue1->getName()); // Value name
|
||||
name1 = name1.substring(0, 6); // String length limit for value name
|
||||
double value1 = bvalue1->value; // Value as double in SI unit
|
||||
bool valid1 = bvalue1->valid; // Valid information
|
||||
|
@ -51,7 +51,7 @@ class PageThreeValues : public Page
|
|||
|
||||
// Get boat values #2
|
||||
GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list (only one value by PageOneValue)
|
||||
String name2 = bvalue2->getName().c_str(); // Value name
|
||||
String name2 = xdrDelete(bvalue2->getName()); // Value name
|
||||
name2 = name2.substring(0, 6); // String length limit for value name
|
||||
double value2 = bvalue2->value; // Value as double in SI unit
|
||||
bool valid2 = bvalue2->valid; // Valid information
|
||||
|
@ -60,7 +60,7 @@ class PageThreeValues : public Page
|
|||
|
||||
// Get boat values #3
|
||||
GwApi::BoatValue *bvalue3 = pageData.values[2]; // Second element in list (only one value by PageOneValue)
|
||||
String name3 = bvalue3->getName().c_str(); // Value name
|
||||
String name3 = xdrDelete(bvalue3->getName()); // Value name
|
||||
name3 = name3.substring(0, 6); // String length limit for value name
|
||||
double value3 = bvalue3->value; // Value as double in SI unit
|
||||
bool valid3 = bvalue3->valid; // Valid information
|
||||
|
|
|
@ -40,7 +40,7 @@ class PageTwoValues : public Page
|
|||
|
||||
// Get boat values #1
|
||||
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue)
|
||||
String name1 = bvalue1->getName().c_str(); // Value name
|
||||
String name1 = xdrDelete(bvalue1->getName()); // Value name
|
||||
name1 = name1.substring(0, 6); // String length limit for value name
|
||||
double value1 = bvalue1->value; // Value as double in SI unit
|
||||
bool valid1 = bvalue1->valid; // Valid information
|
||||
|
@ -49,7 +49,7 @@ class PageTwoValues : public Page
|
|||
|
||||
// Get boat values #2
|
||||
GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list (only one value by PageOneValue)
|
||||
String name2 = bvalue2->getName().c_str(); // Value name
|
||||
String name2 = xdrDelete(bvalue2->getName()); // Value name
|
||||
name2 = name2.substring(0, 6); // String length limit for value name
|
||||
double value2 = bvalue2->value; // Value as double in SI unit
|
||||
bool valid2 = bvalue2->valid; // Valid information
|
||||
|
|
|
@ -47,7 +47,7 @@ public:
|
|||
|
||||
// Get boat values for AWS
|
||||
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue)
|
||||
String name1 = bvalue1->getName().c_str(); // Value name
|
||||
String name1 = xdrDelete(bvalue1->getName()); // Value name
|
||||
name1 = name1.substring(0, 6); // String length limit for value name
|
||||
double value1 = bvalue1->value; // Value as double in SI unit
|
||||
bool valid1 = bvalue1->valid; // Valid information
|
||||
|
@ -60,7 +60,7 @@ public:
|
|||
|
||||
// Get boat values for AWD
|
||||
GwApi::BoatValue *bvalue2 = pageData.values[1]; // First element in list (only one value by PageOneValue)
|
||||
String name2 = bvalue2->getName().c_str(); // Value name
|
||||
String name2 = xdrDelete(bvalue2->getName()); // Value name
|
||||
name2 = name2.substring(0, 6); // String length limit for value name
|
||||
double value2 = bvalue2->value; // Value as double in SI unit
|
||||
bool valid2 = bvalue2->valid; // Valid information
|
||||
|
@ -73,7 +73,7 @@ public:
|
|||
|
||||
// Get boat values #3
|
||||
GwApi::BoatValue *bvalue3 = pageData.values[2]; // Second element in list (only one value by PageOneValue)
|
||||
String name3 = bvalue3->getName().c_str(); // Value name
|
||||
String name3 = xdrDelete(bvalue3->getName()); // Value name
|
||||
name3 = name3.substring(0, 6); // String length limit for value name
|
||||
double value3 = bvalue3->value; // Value as double in SI unit
|
||||
bool valid3 = bvalue3->valid; // Valid information
|
||||
|
@ -86,7 +86,7 @@ public:
|
|||
|
||||
// Get boat values #4
|
||||
GwApi::BoatValue *bvalue4 = pageData.values[3]; // Second element in list (only one value by PageOneValue)
|
||||
String name4 = bvalue4->getName().c_str(); // Value name
|
||||
String name4 = xdrDelete(bvalue4->getName()); // Value name
|
||||
name4 = name4.substring(0, 6); // String length limit for value name
|
||||
double value4 = bvalue4->value; // Value as double in SI unit
|
||||
bool valid4 = bvalue4->valid; // Valid information
|
||||
|
@ -173,14 +173,14 @@ public:
|
|||
else{
|
||||
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
display.setCursor(10, 270);
|
||||
display.print(svalue2old); // Value
|
||||
display.print(svalue2old); // Value
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(10, 220);
|
||||
display.print(name2); // Name
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(10, 190);
|
||||
display.print(" ");
|
||||
display.print(unit2old); // Unit
|
||||
display.print(unit2old); // Unit
|
||||
}
|
||||
|
||||
// Show values TWD
|
||||
|
@ -200,14 +200,14 @@ public:
|
|||
else{
|
||||
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
display.setCursor(295, 65);
|
||||
display.print(svalue3old); // Value
|
||||
display.print(svalue3old); // Value
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(335, 95);
|
||||
display.print(name3); // Name
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(335, 115);
|
||||
display.print(" ");
|
||||
display.print(unit3old); // Unit
|
||||
display.print(unit3old); // Unit
|
||||
}
|
||||
|
||||
// Horizintal separator right
|
||||
|
@ -230,14 +230,14 @@ public:
|
|||
else{
|
||||
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
display.setCursor(295, 270);
|
||||
display.print(svalue4old); // Value
|
||||
display.print(svalue4old); // Value
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(335, 220);
|
||||
display.print(name4); // Name
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(335, 190);
|
||||
display.print(" ");
|
||||
display.print(unit4old); // Unit
|
||||
display.print(unit4old); // Unit
|
||||
}
|
||||
|
||||
//*******************************************************************************************
|
||||
|
|
Loading…
Reference in New Issue