Merge branch 'master' into keyboard: new page wind
This commit is contained in:
commit
e7db5038fb
|
@ -14,6 +14,9 @@
|
|||
#define FRAM_VOLTAGE_AVG 0x000A
|
||||
#define FRAM_VOLTAGE_TREND 0x000B
|
||||
#define FRAM_VOLTAGE_MODE 0x000C
|
||||
#define FRAM_WIND_SIZE 0x000D
|
||||
#define FRAM_WIND_SRC 0x000E
|
||||
#define FRAM_WIND_MODE 0x000F
|
||||
// Barograph history data
|
||||
#define FRAM_BAROGRAPH_START 0x0400
|
||||
#define FRAM_BAROGRAPH_END 0x13FF
|
||||
|
|
|
@ -1,186 +0,0 @@
|
|||
#ifdef BOARD_OBP60S3
|
||||
|
||||
#include "Pagedata.h"
|
||||
#include "OBP60Extensions.h"
|
||||
|
||||
class PageApparentWind : public Page
|
||||
{
|
||||
int16_t lp = 80; // Pointer length
|
||||
|
||||
public:
|
||||
PageApparentWind(CommonData &common){
|
||||
commonData = &common;
|
||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageApparentWind");
|
||||
}
|
||||
|
||||
// Key functions
|
||||
virtual int handleKey(int key){
|
||||
// Reduce instrument size
|
||||
if(key == 2){ // Code for reduce
|
||||
lp = lp - 10;
|
||||
if(lp < 10){
|
||||
lp = 10;
|
||||
}
|
||||
return 0; // Commit the key
|
||||
}
|
||||
|
||||
// Enlarge instrument size
|
||||
if(key == 5){ // Code for enlarge
|
||||
lp = lp + 10;
|
||||
if(lp > 80){
|
||||
lp = 80;
|
||||
}
|
||||
return 0; // Commit the key
|
||||
}
|
||||
|
||||
// Code for keylock
|
||||
if(key == 11){
|
||||
commonData->keylock = !commonData->keylock;
|
||||
return 0; // Commit the key
|
||||
}
|
||||
return key;
|
||||
}
|
||||
|
||||
virtual void displayPage(PageData &pageData)
|
||||
{
|
||||
GwConfigHandler *config = commonData->config;
|
||||
GwLog *logger = commonData->logger;
|
||||
|
||||
static String svalue1old = "";
|
||||
static String unit1old = "";
|
||||
static String svalue2old = "";
|
||||
static String unit2old = "";
|
||||
|
||||
// Get config data
|
||||
String lengthformat = config->getString(config->lengthFormat);
|
||||
// bool simulation = config->getBool(config->useSimuData);
|
||||
bool holdvalues = config->getBool(config->holdvalues);
|
||||
String flashLED = config->getString(config->flashLED);
|
||||
String backlightMode = config->getString(config->backlight);
|
||||
|
||||
// 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
|
||||
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
|
||||
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
|
||||
|
||||
// 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
|
||||
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
|
||||
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
|
||||
|
||||
// Optical warning by limit violation (unused)
|
||||
if(String(flashLED) == "Limit Violation"){
|
||||
setBlinkingLED(false);
|
||||
setFlashLED(false);
|
||||
}
|
||||
|
||||
// Logging boat values
|
||||
if (bvalue1 == NULL) return;
|
||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageApparentWind, %s:%f, %s:%f", name1.c_str(), value1, name2.c_str(), value2);
|
||||
|
||||
// Draw page
|
||||
//***********************************************************
|
||||
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
|
||||
getdisplay().setTextColor(commonData->fgcolor);
|
||||
|
||||
// Show values AWS
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(20, 50);
|
||||
if(holdvalues == false){
|
||||
getdisplay().print(name1); // Value name
|
||||
getdisplay().print(": ");
|
||||
getdisplay().print(svalue1); // Value
|
||||
getdisplay().print(" ");
|
||||
getdisplay().print(unit1); // Unit
|
||||
}
|
||||
else{
|
||||
getdisplay().print(name1); // Value name
|
||||
getdisplay().print(": ");
|
||||
getdisplay().print(svalue1old); // Value old
|
||||
getdisplay().print(" ");
|
||||
getdisplay().print(unit1old); // Unit old
|
||||
}
|
||||
|
||||
// Show values AWD
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(20, 260);
|
||||
if(holdvalues == false){
|
||||
getdisplay().print(name2); // Value name
|
||||
getdisplay().print(": ");
|
||||
getdisplay().print(svalue2); // Value
|
||||
getdisplay().print(" ");
|
||||
getdisplay().print(unit2); // Unit
|
||||
}
|
||||
else{
|
||||
getdisplay().print(name2); // Value name
|
||||
getdisplay().print(": ");
|
||||
getdisplay().print(svalue2old); // Value old
|
||||
getdisplay().print(" ");
|
||||
getdisplay().print(unit2old); // Unit old
|
||||
}
|
||||
|
||||
// Draw wind pointer
|
||||
static int16_t x0 = 200; // Center point
|
||||
static int16_t y0 = 145;
|
||||
static int16_t x1 = x0; // Start point for pointer
|
||||
static int16_t y1 = y0;
|
||||
static int16_t x2 = x0; // End point for pointer
|
||||
static int16_t y2 = y0;
|
||||
|
||||
//Draw instrument
|
||||
getdisplay().fillCircle(x0, y0, lp + 5, commonData->fgcolor);
|
||||
getdisplay().fillCircle(x0, y0, lp + 1, commonData->bgcolor);
|
||||
|
||||
// Calculation end point of pointer
|
||||
value2 = value2 - 3.14 / 2;
|
||||
x1 = x0 + cos(value2) * lp * 0.6;
|
||||
y1 = y0 + sin(value2) * lp * 0.6;
|
||||
x2 = x0 + cos(value2) * lp;
|
||||
y2 = y0 + sin(value2) * lp;
|
||||
getdisplay().drawLine(x1, y1, x2, y2, commonData->fgcolor);
|
||||
|
||||
// Key Layout
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
if(commonData->keylock == false){
|
||||
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
||||
getdisplay().setCursor(343, 290);
|
||||
getdisplay().print("[ILUM]");
|
||||
}
|
||||
}
|
||||
|
||||
// Update display
|
||||
getdisplay().nextPage(); // Partial update (fast)
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
static Page *createPage(CommonData &common){
|
||||
return new PageApparentWind(common);
|
||||
}
|
||||
/**
|
||||
* with the code below we make this page known to the PageTask
|
||||
* we give it a type (name) that can be selected in the config
|
||||
* we define which function is to be called
|
||||
* and we provide the number of user parameters we expect (0 here)
|
||||
* and will will provide the names of the fixed values we need
|
||||
*/
|
||||
PageDescription registerPageApparentWind(
|
||||
"ApparentWind", // Page name
|
||||
createPage, // Action
|
||||
0, // Number of bus values depends on selection in Web configuration
|
||||
{"AWS","AWA"}, // Bus values we need in the page
|
||||
true // Show display header on/off
|
||||
);
|
||||
|
||||
#endif
|
|
@ -334,9 +334,9 @@ static Page *createPage(CommonData &common){
|
|||
PageDescription registerPageRollPitch(
|
||||
"RollPitch", // Page name
|
||||
createPage, // Action
|
||||
0, // Number of bus values depends on selection in Web configuration
|
||||
2, // Number of bus values depends on selection in Web configuration
|
||||
// {"xdrROLL", "xdrPTCH"},// Bus values we need in the page
|
||||
{"xdrRoll", "xdrPitch"},// Bus values we need in the page
|
||||
//{"xdrRoll", "xdrPitch"},// Bus values we need in the page
|
||||
true // Show display header on/off
|
||||
);
|
||||
|
||||
|
|
|
@ -0,0 +1,645 @@
|
|||
#ifdef BOARD_OBP60S3
|
||||
|
||||
#include "Pagedata.h"
|
||||
#include "OBP60Extensions.h"
|
||||
#include "N2kMessages.h"
|
||||
|
||||
#define front_width 120
|
||||
#define front_height 162
|
||||
static unsigned char front_bits[] PROGMEM = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x80, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0xc0, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x01, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0x03,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xf0, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0xf0, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0x0f, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0x1f,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xfc, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0xfe, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xf7, 0x7f,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
|
||||
0xff, 0xf3, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xc0, 0xff, 0xe1, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xc1, 0xff, 0x01, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0x80, 0xff,
|
||||
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0,
|
||||
0x7f, 0x80, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xf0, 0x7f, 0x00, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0xfe, 0x0f, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x1f, 0x00, 0xfe,
|
||||
0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc,
|
||||
0x1f, 0x00, 0xfc, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xfc, 0x0f, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x0f, 0x00, 0xf8, 0x3f, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x07, 0x00, 0xf0,
|
||||
0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
|
||||
0x03, 0x00, 0xe0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x80, 0xff, 0x03, 0x00, 0xe0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x01, 0x00, 0xc0, 0xff, 0x01, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x00, 0x00, 0x80,
|
||||
0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff,
|
||||
0x00, 0x00, 0x80, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0xe0, 0x7f, 0x00, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0xfe, 0x07, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x3f, 0x00, 0x00, 0x00,
|
||||
0xfe, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x1f,
|
||||
0x00, 0x00, 0x00, 0xfc, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0xf8, 0x1f, 0x00, 0x00, 0x00, 0xf8, 0x1f, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xfc, 0x0f, 0x00, 0x00, 0x00, 0xf8, 0x1f, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x07, 0x00, 0x00, 0x00,
|
||||
0xf0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x07,
|
||||
0x00, 0x00, 0x00, 0xe0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0xfe, 0x03, 0x00, 0x00, 0x00, 0xe0, 0x7f, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, 0x00,
|
||||
0xc0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x00,
|
||||
0x00, 0x00, 0x00, 0x80, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xc0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0xc0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x03,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x7f, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0xfe, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x3f, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xf0, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x07, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0xf0, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x0f,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x0f, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0xf8, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x0f, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xf0, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xf8, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x1f, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0xfc, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x3f,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x03, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0xc0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xc0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xfe, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x7f, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x7f, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x80,
|
||||
0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00,
|
||||
0x00, 0x00, 0xc0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc,
|
||||
0x03, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xfc, 0x03, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x1f, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x07, 0x00, 0x00, 0x00, 0x00, 0xe0,
|
||||
0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x07, 0x00, 0x00,
|
||||
0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0,
|
||||
0x07, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xf0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x07, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xf0,
|
||||
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x1f, 0x00, 0x00,
|
||||
0x00, 0x00, 0xf8, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0,
|
||||
0x1f, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xc0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xfc,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00,
|
||||
0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x3f,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00,
|
||||
0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xfc, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x80, 0x1f, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x01, 0x00, 0x00, 0x80, 0x0f,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x01, 0x00,
|
||||
0x00, 0x80, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xf0, 0x03, 0x00, 0x00, 0xc0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0xc0, 0x07, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xc0, 0x03,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x07, 0x00,
|
||||
0x00, 0xe0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xe0, 0x07, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0xc0, 0x07, 0x00, 0x00, 0xe0, 0x01, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x0f, 0x00, 0x00, 0xf0, 0x01,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x0f, 0x00,
|
||||
0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x80, 0x0f, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x78, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00,
|
||||
0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x3e, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x3c, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00,
|
||||
0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x7c, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x0e, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00,
|
||||
0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0xf8, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x07, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x01,
|
||||
0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0xe0, 0x01, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xe0, 0x01, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x01, 0x80, 0x03, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03,
|
||||
0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0xc0, 0x03, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xc0, 0x03, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03, 0xc0, 0x01, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07,
|
||||
0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x80, 0x07, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0xe0, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07,
|
||||
0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x0f, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x70, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e,
|
||||
0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x0e, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x30, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c,
|
||||
0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x1c, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x18, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c,
|
||||
0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x1c, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38,
|
||||
0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x38, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x0c, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70,
|
||||
0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x70, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x0e, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70,
|
||||
0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x60, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x06, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
|
||||
0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x60, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x06, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0,
|
||||
0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0,
|
||||
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0,
|
||||
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xc0 };
|
||||
|
||||
class PageWind : public Page
|
||||
{
|
||||
bool keylock = false; // Keylock
|
||||
int8_t lp = 80; // Pointer length
|
||||
char mode = 'N'; // page mode (N)ormal | (L)ens | e(X)ample
|
||||
char source = 'A'; // data source (A)pparent | (T)rue
|
||||
|
||||
public:
|
||||
PageWind(CommonData &common){
|
||||
commonData = &common;
|
||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageWind");
|
||||
if (hasFRAM) {
|
||||
lp = fram.read(FRAM_WIND_SIZE);
|
||||
source = fram.read(FRAM_WIND_SRC);
|
||||
mode = fram.read(FRAM_WIND_MODE);
|
||||
}
|
||||
}
|
||||
|
||||
// Key functions
|
||||
virtual int handleKey(int key){
|
||||
|
||||
if(key == 1){ // Mode switch
|
||||
if(mode == 'N'){
|
||||
mode = 'L';
|
||||
} else if (mode == 'L') {
|
||||
mode = 'X';
|
||||
} else {
|
||||
mode = 'N';
|
||||
}
|
||||
if (hasFRAM) fram.write(FRAM_WIND_MODE, mode);
|
||||
return 0; // Commit the key
|
||||
}
|
||||
|
||||
if(key == 3){ // Source switch
|
||||
if(source == 'A'){
|
||||
source = 'T';
|
||||
} else {
|
||||
source = 'A';
|
||||
}
|
||||
if (hasFRAM) fram.write(FRAM_WIND_SRC, source);
|
||||
return 0; // Commit the key
|
||||
}
|
||||
|
||||
// Reduce instrument size
|
||||
if(key == 2 && mode == 'X'){ // Code for reduce
|
||||
lp = lp - 10;
|
||||
if(lp < 10){
|
||||
lp = 10;
|
||||
}
|
||||
if (hasFRAM) fram.write(FRAM_WIND_SIZE, lp);
|
||||
return 0; // Commit the key
|
||||
}
|
||||
|
||||
// Enlarge instrument size
|
||||
if(key == 5 && mode == 'X'){ // Code for enlarge
|
||||
lp = lp + 10;
|
||||
if(lp > 80){
|
||||
lp = 80;
|
||||
}
|
||||
if (hasFRAM) fram.write(FRAM_WIND_SIZE, lp);
|
||||
return 0; // Commit the key
|
||||
}
|
||||
|
||||
// Keylock function
|
||||
if(key == 11){ // Code for keylock
|
||||
commonData->keylock = !commonData->keylock;
|
||||
return 0; // Commit the key
|
||||
}
|
||||
return key;
|
||||
}
|
||||
|
||||
virtual void displayPage(PageData &pageData)
|
||||
{
|
||||
GwConfigHandler *config = commonData->config;
|
||||
GwLog *logger = commonData->logger;
|
||||
|
||||
static String svalue1old = "";
|
||||
static String unit1old = "";
|
||||
static String svalue2old = "";
|
||||
static String unit2old = "";
|
||||
|
||||
// Get config data
|
||||
String lengthformat = config->getString(config->lengthFormat);
|
||||
// bool simulation = config->getBool(config->useSimuData);
|
||||
bool holdvalues = config->getBool(config->holdvalues);
|
||||
String flashLED = config->getString(config->flashLED);
|
||||
String backlightMode = config->getString(config->backlight);
|
||||
|
||||
GwApi::BoatValue *bvalue1; // Value 1 for speed on top
|
||||
GwApi::BoatValue *bvalue2; // Value 2 for angle on bottom
|
||||
|
||||
// Get boat values for speed (AWS/TWS)
|
||||
if (source == 'A') {
|
||||
bvalue1 = pageData.values[0];
|
||||
} else {
|
||||
bvalue1 = pageData.values[2];
|
||||
}
|
||||
String name1 = bvalue1->getName().c_str(); // 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
|
||||
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
|
||||
|
||||
// Get boat values for angle (AWD/TWD)
|
||||
if (source == 'A') {
|
||||
bvalue2 = pageData.values[1];
|
||||
} else {
|
||||
bvalue2 = pageData.values[3];
|
||||
}
|
||||
String name2 = bvalue2->getName().c_str(); // 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
|
||||
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
|
||||
|
||||
// Optical warning by limit violation (unused)
|
||||
if(String(flashLED) == "Limit Violation"){
|
||||
setBlinkingLED(false);
|
||||
setFlashLED(false);
|
||||
}
|
||||
|
||||
// Logging boat values
|
||||
if (bvalue1 == NULL) return;
|
||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageWind, %s:%f, %s:%f", name1.c_str(), value1, name2.c_str(), value2);
|
||||
|
||||
// Draw page
|
||||
//***********************************************************
|
||||
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
|
||||
getdisplay().setTextColor(commonData->fgcolor);
|
||||
|
||||
|
||||
if (mode == 'X') {
|
||||
// Original example code with scaling circle
|
||||
|
||||
// Show values AWS/TWS
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(20, 50);
|
||||
getdisplay().print(name1); // Value name
|
||||
getdisplay().print(": ");
|
||||
if(holdvalues == false){
|
||||
getdisplay().print(svalue1); // Value
|
||||
getdisplay().print(" ");
|
||||
getdisplay().print(unit1); // Unit
|
||||
}
|
||||
else{
|
||||
getdisplay().print(svalue1old); // Value old
|
||||
getdisplay().print(" ");
|
||||
getdisplay().print(unit1old); // Unit old
|
||||
}
|
||||
|
||||
// Show values AWD/TWD
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(20, 260);
|
||||
getdisplay().print(name2); // Value name
|
||||
getdisplay().print(": ");
|
||||
if(holdvalues == false){
|
||||
getdisplay().print(svalue2); // Value
|
||||
getdisplay().print(" ");
|
||||
getdisplay().print(unit2); // Unit
|
||||
}
|
||||
else{
|
||||
getdisplay().print(svalue2old); // Value old
|
||||
getdisplay().print(" ");
|
||||
getdisplay().print(unit2old); // Unit old
|
||||
}
|
||||
|
||||
Point c = {200, 145};
|
||||
|
||||
// Draw instrument
|
||||
getdisplay().fillCircle(c.x, c.y, lp + 5, commonData->fgcolor);
|
||||
getdisplay().fillCircle(c.x, c.y, lp + 1, commonData->bgcolor);
|
||||
|
||||
// Wind pointer
|
||||
if (bvalue2->valid) {
|
||||
uint8_t lp0 = lp * 0.6; // effective pointer outside size
|
||||
uint8_t lp1 = lp * 0.4; // effective pointer inside size
|
||||
// zero position
|
||||
std::vector<Point> pts = {
|
||||
{c.x, c.y - lp},
|
||||
{c.x - 7, c.y - lp + lp0},
|
||||
{c.x, c.y - lp + lp1},
|
||||
{c.x + 7, c.y - lp + lp0}
|
||||
};
|
||||
fillPoly4(rotatePoints(c, pts, RadToDeg(value2)), commonData->fgcolor);
|
||||
} else {
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
drawTextCenter(c.x, c.y, "no data");
|
||||
}
|
||||
|
||||
} else if (mode == 'L') { // Mode (L)ens
|
||||
|
||||
Point c = {200, 155};
|
||||
uint16_t r = 150;
|
||||
|
||||
Point p;
|
||||
std::vector<Point> pts = { // polygon lines
|
||||
{c.x - 2, c.y - r},
|
||||
{c.x + 2, c.y - r},
|
||||
{c.x + 2, c.y - (r - 16)},
|
||||
{c.x - 2, c.y - (r - 16)}
|
||||
};
|
||||
int angle;
|
||||
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
|
||||
// starbord
|
||||
// text with line
|
||||
angle = 20;
|
||||
for (int i = 30; i < 150; i += 30) {
|
||||
p = rotatePoint(c, {c.x, c.y - r + 40}, i);
|
||||
drawTextCenter(p.x, p.y, String(angle));
|
||||
angle += 10;
|
||||
fillPoly4(rotatePoints(c, pts, i), commonData->fgcolor);
|
||||
}
|
||||
// dots
|
||||
for (int i = 30; i < 138; i += 6) {
|
||||
if (i % 15 != 0) {
|
||||
p = rotatePoint(c, {c.x, c.y - r + 5}, i);
|
||||
getdisplay().fillCircle(p.x, p.y, 2, commonData->fgcolor);
|
||||
}
|
||||
}
|
||||
|
||||
// port
|
||||
angle = 50;
|
||||
// text with line
|
||||
for (int i = 240; i <= 330; i += 30) {
|
||||
p = rotatePoint(c, {c.x, c.y - r + 40}, i);
|
||||
drawTextCenter(p.x, p.y, String(angle));
|
||||
angle -= 10;
|
||||
fillPoly4(rotatePoints(c, pts, i), commonData->fgcolor);
|
||||
}
|
||||
// dots
|
||||
for (int i = 228; i < 330; i += 6) {
|
||||
if (i % 15 != 0) {
|
||||
p = rotatePoint(c, {c.x, c.y - r + 5}, i);
|
||||
getdisplay().fillCircle(p.x, p.y, 2, commonData->fgcolor);
|
||||
}
|
||||
}
|
||||
|
||||
// data source
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(8, 50);
|
||||
if (source == 'A') {
|
||||
getdisplay().print("APP");
|
||||
} else {
|
||||
getdisplay().print("TRUE");
|
||||
}
|
||||
|
||||
// Wind pointer (angle)
|
||||
if (bvalue2->valid) {
|
||||
float alpha = RadToDeg(value2);
|
||||
bool port = (alpha > 180);
|
||||
if (port) {
|
||||
alpha = 360 - alpha;
|
||||
}
|
||||
if (alpha < 15) {
|
||||
alpha = 15; // stop at start of scale
|
||||
} else if (alpha > 55) {
|
||||
alpha = 55; // stop at end of scale
|
||||
}
|
||||
alpha = 3 * alpha - 30; // convert to lens scale
|
||||
if (port) {
|
||||
alpha *= -1;
|
||||
}
|
||||
|
||||
getdisplay().fillCircle(c.x, c.y, 8, commonData->fgcolor);
|
||||
pts = {
|
||||
{c.x - 1, c.y - (r - 20)},
|
||||
{c.x + 1, c.y - (r - 20)},
|
||||
{c.x + 6, c.y + 15},
|
||||
{c.x - 6, c.y + 15}
|
||||
};
|
||||
fillPoly4(rotatePoints(c, pts, alpha), commonData->fgcolor);
|
||||
getdisplay().fillCircle(c.x, c.y, 6, commonData->bgcolor);
|
||||
} else {
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
drawTextCenter(c.x, c.y, "no data");
|
||||
}
|
||||
|
||||
// Wind speed as decimal number
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(150, 250);
|
||||
if (holdvalues == false) {
|
||||
getdisplay().print(svalue1);
|
||||
} else {
|
||||
getdisplay().print(svalue1old);
|
||||
}
|
||||
// unit
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(220, 265);
|
||||
getdisplay().print("kts");
|
||||
}
|
||||
else {
|
||||
// Normal mode
|
||||
|
||||
// data source
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(8, 50);
|
||||
if (source == 'A') {
|
||||
getdisplay().print("APP");
|
||||
} else {
|
||||
getdisplay().print("TRUE");
|
||||
}
|
||||
|
||||
// draw ship front symbol (as bitmap)
|
||||
getdisplay().drawXBitmap(140, 30, front_bits, front_width, front_height, commonData->fgcolor);
|
||||
|
||||
Point c = {200, 155};
|
||||
uint16_t r = 150;
|
||||
|
||||
Point p;
|
||||
std::vector<Point> pts = { // polygon lines
|
||||
{c.x - 2, c.y - r},
|
||||
{c.x + 2, c.y - r},
|
||||
{c.x + 2, c.y - (r - 16)},
|
||||
{c.x - 2, c.y - (r - 16)}
|
||||
};
|
||||
int angle;
|
||||
|
||||
// starbord
|
||||
// text with line
|
||||
for (int i = 30; i < 150; i += 30) {
|
||||
p = rotatePoint(c, {c.x, c.y - r + 40}, i);
|
||||
drawTextCenter(p.x, p.y, String(i));
|
||||
fillPoly4(rotatePoints(c, pts, i), commonData->fgcolor);
|
||||
}
|
||||
// dots
|
||||
for (int i = 30; i < 150; i += 10) {
|
||||
if (i % 30 != 0) {
|
||||
p = rotatePoint(c, {c.x, c.y - r + 5}, i);
|
||||
getdisplay().fillCircle(p.x, p.y, 3, commonData->fgcolor);
|
||||
}
|
||||
}
|
||||
|
||||
// port
|
||||
// text with line
|
||||
angle = 120;
|
||||
for (int i = 240; i <= 330; i += 30) {
|
||||
p = rotatePoint(c, {c.x, c.y - r + 40}, i);
|
||||
drawTextCenter(p.x, p.y, String(angle));
|
||||
angle -= 30;
|
||||
fillPoly4(rotatePoints(c, pts, i), commonData->fgcolor);
|
||||
}
|
||||
// dots
|
||||
for (int i = 210; i < 340; i += 10) {
|
||||
if (i % 30 != 0) {
|
||||
p = rotatePoint(c, {c.x, c.y - r + 5}, i);
|
||||
getdisplay().fillCircle(p.x, p.y, 3, commonData->fgcolor);
|
||||
}
|
||||
}
|
||||
|
||||
// Wind speed as decimal number
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(150, 250);
|
||||
if (holdvalues == false) {
|
||||
getdisplay().print(svalue1);
|
||||
} else {
|
||||
getdisplay().print(svalue1old);
|
||||
}
|
||||
// unit
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(220, 265);
|
||||
getdisplay().print("kts");
|
||||
|
||||
// Wind pointer (angle)
|
||||
if (bvalue2->valid) {
|
||||
float alpha = RadToDeg(value2);
|
||||
getdisplay().fillCircle(c.x, c.y, 8, commonData->fgcolor);
|
||||
pts = {
|
||||
{c.x - 1, c.y - (r - 20)},
|
||||
{c.x + 1, c.y - (r - 20)},
|
||||
{c.x + 6, c.y + 15},
|
||||
{c.x - 6, c.y + 15}
|
||||
};
|
||||
fillPoly4(rotatePoints(c, pts, alpha), commonData->fgcolor);
|
||||
getdisplay().fillCircle(c.x, c.y, 6, commonData->bgcolor);
|
||||
} else {
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
drawTextCenter(c.x, c.y, "no data");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Key Layout
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
if(commonData->keylock == false){
|
||||
getdisplay().setCursor(10, 290);
|
||||
getdisplay().print("[MODE]");
|
||||
|
||||
if (mode == 'X') {
|
||||
getdisplay().setCursor(85, 290);
|
||||
getdisplay().print("[ - ]");
|
||||
getdisplay().setCursor(295, 290);
|
||||
getdisplay().print("[ + ]");
|
||||
}
|
||||
|
||||
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
||||
getdisplay().setCursor(343, 290);
|
||||
getdisplay().print("[ILUM]");
|
||||
}
|
||||
}
|
||||
|
||||
// Update display
|
||||
getdisplay().nextPage(); // Partial update (fast)
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
static Page *createPage(CommonData &common){
|
||||
return new PageWind(common);
|
||||
}
|
||||
/**
|
||||
* with the code below we make this page known to the PageTask
|
||||
* we give it a type (name) that can be selected in the config
|
||||
* we define which function is to be called
|
||||
* and we provide the number of user parameters we expect (0 here)
|
||||
* and will will provide the names of the fixed values we need
|
||||
*/
|
||||
PageDescription registerPageWind(
|
||||
"Wind", // Page name
|
||||
createPage, // Action
|
||||
0, // Number of bus values depends on selection in Web configuration
|
||||
{"AWS","AWA", "TWS", "TWA"}, // Bus values we need in the page
|
||||
true // Show display header on/off
|
||||
);
|
||||
|
||||
#endif
|
|
@ -185,7 +185,8 @@ public:
|
|||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(295, 65);
|
||||
if(valid3 == true){
|
||||
getdisplay().print(abs(value3 * 180 / PI), 0); // Value
|
||||
// getdisplay().print(abs(value3 * 180 / PI), 0); // Value
|
||||
getdisplay().print(svalue3); // Value
|
||||
}
|
||||
else{
|
||||
getdisplay().print("---"); // Value
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,7 @@
|
|||
#!/bin/perl -w
|
||||
#A tool to generate the part of config.json that deals with pages and fields.
|
||||
|
||||
#DEPRECATED, moved to get_set.py
|
||||
die "Please use gen_set.py instead";
|
||||
#List of all pages and the number of parameters they expect.
|
||||
%NoOfFieldsPerPage=qw(
|
||||
ApparentWind 0
|
||||
|
@ -81,7 +82,7 @@ for ($PageNo=1;$PageNo<=$NoOfPages;$PageNo++){
|
|||
print "\t",'"condition":[';
|
||||
foreach $page (@Pages) {
|
||||
if($NoOfFieldsPerPage{$page}>=$FieldNo){
|
||||
print '{"page1type":"',$page,'"},';
|
||||
print '{"page',$PageNo,'type":"',$page,'"},';
|
||||
}
|
||||
}
|
||||
print "\b],\n";
|
||||
|
|
|
@ -0,0 +1,123 @@
|
|||
#!/usr/bin/env python3
|
||||
# A tool to generate that part of config.json that deals with pages and fields.
|
||||
|
||||
import json
|
||||
|
||||
# List of all pages and the number of parameters they expect.
|
||||
no_of_fields_per_page = {
|
||||
"ApparentWind": 0,
|
||||
"XTETrack": 0,
|
||||
"Battery2": 0,
|
||||
"Battery": 0,
|
||||
"BME280": 0,
|
||||
"Clock": 0,
|
||||
"DST810": 0,
|
||||
"Fluid": 0,
|
||||
"FourValues2": 4,
|
||||
"FourValues": 4,
|
||||
"Generator": 0,
|
||||
"KeelPosition": 0,
|
||||
"OneValue": 1,
|
||||
"RollPitch": 2,
|
||||
"RudderPosition": 0,
|
||||
"Solar": 0,
|
||||
"ThreeValues": 3,
|
||||
"TwoValues": 2,
|
||||
"Voltage": 0,
|
||||
"White": 0,
|
||||
"WindRose": 0,
|
||||
"WindRoseFlex": 6,
|
||||
}
|
||||
|
||||
# No changes needed beyond this point
|
||||
# max number of pages supported by OBP60
|
||||
no_of_pages = 10
|
||||
# Default selection for each page
|
||||
default_pages = [
|
||||
"Voltage",
|
||||
"WindRose",
|
||||
"OneValue",
|
||||
"TwoValues",
|
||||
"ThreeValues",
|
||||
"FourValues",
|
||||
"FourValues2",
|
||||
"Clock",
|
||||
"RollPitch",
|
||||
"Battery2",
|
||||
]
|
||||
numbers = [
|
||||
"one",
|
||||
"two",
|
||||
"three",
|
||||
"four",
|
||||
"five",
|
||||
"six",
|
||||
"seven",
|
||||
"eight",
|
||||
"nine",
|
||||
"ten",
|
||||
]
|
||||
pages = sorted(no_of_fields_per_page.keys())
|
||||
max_no_of_fields_per_page = max(no_of_fields_per_page.values())
|
||||
|
||||
output = []
|
||||
|
||||
for page_no in range(1, no_of_pages + 1):
|
||||
page_data = {
|
||||
"name": f"page{page_no}type",
|
||||
"label": "Type",
|
||||
"type": "list",
|
||||
"default": default_pages[page_no - 1],
|
||||
"description": f"Type of page for page {page_no}",
|
||||
"list": pages,
|
||||
"category": f"OBP60 Page {page_no}",
|
||||
"capabilities": {"obp60": "true"},
|
||||
"condition": [{"visiblePages": vp} for vp in range(page_no, no_of_pages + 1)],
|
||||
#"fields": [],
|
||||
}
|
||||
output.append(page_data)
|
||||
|
||||
for field_no in range(1, max_no_of_fields_per_page + 1):
|
||||
field_data = {
|
||||
"name": f"page{page_no}value{field_no}",
|
||||
"label": f"Field {field_no}",
|
||||
"type": "boatData",
|
||||
"default": "",
|
||||
"description": f"The display for field {numbers[field_no - 1]}",
|
||||
"category": f"OBP60 Page {page_no}",
|
||||
"capabilities": {"obp60": "true"},
|
||||
"condition": [
|
||||
{f"page{page_no}type": page}
|
||||
for page in pages
|
||||
if no_of_fields_per_page[page] >= field_no
|
||||
],
|
||||
}
|
||||
output.append(field_data)
|
||||
|
||||
fluid_data ={
|
||||
"name": f"page{page_no}fluid",
|
||||
"label": "Fluid type",
|
||||
"type": "list",
|
||||
"default": "0",
|
||||
"list": [
|
||||
{"l":"Fuel (0)","v":"0"},
|
||||
{"l":"Water (1)","v":"1"},
|
||||
{"l":"Gray Water (2)","v":"2"},
|
||||
{"l":"Live Well (3)","v":"3"},
|
||||
{"l":"Oil (4)","v":"4"},
|
||||
{"l":"Black Water (5)","v":"5"},
|
||||
{"l":"Fuel Gasoline (6)","v":"6"}
|
||||
],
|
||||
"description": "Fluid type in tank",
|
||||
"category": f"OBP60 Page {page_no}",
|
||||
"capabilities": {
|
||||
"obp60":"true"
|
||||
},
|
||||
"condition":[{f"page{page_no}type":"Fluid"}]
|
||||
}
|
||||
output.append(fluid_data)
|
||||
|
||||
json_output = json.dumps(output, indent=4)
|
||||
# print omitting first and last line containing [ ] of JSON array
|
||||
print(json_output[1:-1])
|
||||
# print(",")
|
|
@ -205,8 +205,8 @@ void registerAllPages(PageList &list){
|
|||
list.add(®isterPageFourValues);
|
||||
extern PageDescription registerPageFourValues2;
|
||||
list.add(®isterPageFourValues2);
|
||||
extern PageDescription registerPageApparentWind;
|
||||
list.add(®isterPageApparentWind);
|
||||
extern PageDescription registerPageWind;
|
||||
list.add(®isterPageWind);
|
||||
extern PageDescription registerPageWindRose;
|
||||
list.add(®isterPageWindRose);
|
||||
extern PageDescription registerPageWindRoseFlex;
|
||||
|
|
Loading…
Reference in New Issue