Move page number, swipe and lock indicator to header
This commit is contained in:
parent
83f3e6f24b
commit
e4af7cf731
|
@ -314,16 +314,23 @@ void displayHeader(CommonData &commonData, GwApi::BoatValue *date, GwApi::BoatVa
|
||||||
usbRxOld = commonData.status.usbRx;
|
usbRxOld = commonData.status.usbRx;
|
||||||
usbTxOld = commonData.status.usbTx;
|
usbTxOld = commonData.status.usbTx;
|
||||||
|
|
||||||
|
// Display key lock status
|
||||||
|
if (commonData.keylock) {
|
||||||
|
getdisplay().drawXBitmap(150, 1, lock_bits, icon_width, icon_height, commonData.fgcolor);
|
||||||
|
} else {
|
||||||
|
getdisplay().drawXBitmap(150, 1, swipe_bits, icon_width, icon_height, commonData.fgcolor);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Current page number in a small box
|
||||||
|
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||||
|
getdisplay().drawRect(170, 2, 20, 15, textcolor);
|
||||||
|
drawTextCenter(179, 9, String(commonData.data.actpage));
|
||||||
|
|
||||||
// Heartbeat as dot
|
// Heartbeat as dot
|
||||||
getdisplay().setTextColor(textcolor);
|
getdisplay().setTextColor(textcolor);
|
||||||
getdisplay().setFont(&Ubuntu_Bold32pt7b);
|
getdisplay().setFont(&Ubuntu_Bold32pt7b);
|
||||||
getdisplay().setCursor(205, 14);
|
getdisplay().setCursor(205, 14);
|
||||||
if(heartbeat == true){
|
getdisplay().print(heartbeat ? "." : " ");
|
||||||
getdisplay().print(".");
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
getdisplay().print(" ");
|
|
||||||
}
|
|
||||||
heartbeat = !heartbeat;
|
heartbeat = !heartbeat;
|
||||||
|
|
||||||
// Date and time
|
// Date and time
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
|
|
||||||
// FRAM address reservations 32kB: 0x0000 - 0x7FFF
|
// FRAM address reservations 32kB: 0x0000 - 0x7FFF
|
||||||
// 0x0000 - 0x03ff: single variables
|
// 0x0000 - 0x03ff: single variables
|
||||||
|
#define FRAM_PAGE_NO 0x0002
|
||||||
|
// Voltage page
|
||||||
#define FRAM_VOLTAGE_AVG 0x000A
|
#define FRAM_VOLTAGE_AVG 0x000A
|
||||||
#define FRAM_VOLTAGE_TREND 0x000B
|
#define FRAM_VOLTAGE_TREND 0x000B
|
||||||
#define FRAM_VOLTAGE_MODE 0x000C
|
#define FRAM_VOLTAGE_MODE 0x000C
|
||||||
|
@ -19,7 +21,7 @@
|
||||||
extern Adafruit_FRAM_I2C fram;
|
extern Adafruit_FRAM_I2C fram;
|
||||||
extern bool hasFRAM;
|
extern bool hasFRAM;
|
||||||
|
|
||||||
// Fonts declarations for display (#inclues see OBP60Extensions.cpp)
|
// Fonts declarations for display (#includes see OBP60Extensions.cpp)
|
||||||
extern const GFXfont Ubuntu_Bold8pt7b;
|
extern const GFXfont Ubuntu_Bold8pt7b;
|
||||||
extern const GFXfont Ubuntu_Bold10pt7b;
|
extern const GFXfont Ubuntu_Bold10pt7b;
|
||||||
extern const GFXfont Ubuntu_Bold12pt7b;
|
extern const GFXfont Ubuntu_Bold12pt7b;
|
||||||
|
@ -32,7 +34,21 @@ extern const GFXfont DSEG7Classic_BoldItalic30pt7b;
|
||||||
extern const GFXfont DSEG7Classic_BoldItalic42pt7b;
|
extern const GFXfont DSEG7Classic_BoldItalic42pt7b;
|
||||||
extern const GFXfont DSEG7Classic_BoldItalic60pt7b;
|
extern const GFXfont DSEG7Classic_BoldItalic60pt7b;
|
||||||
|
|
||||||
// Gloabl functions
|
// Icons
|
||||||
|
#define icon_width 16
|
||||||
|
#define icon_height 16
|
||||||
|
|
||||||
|
static unsigned char swipe_bits[] PROGMEM = {
|
||||||
|
0x80, 0x03, 0xe0, 0x06, 0xb0, 0x0a, 0xa8, 0x0a, 0xa8, 0x0a, 0xa8, 0x3a,
|
||||||
|
0x28, 0x28, 0x08, 0x28, 0x08, 0x28, 0x08, 0x26, 0x08, 0x21, 0x08, 0x10,
|
||||||
|
0x10, 0x08, 0x10, 0x04, 0x10, 0x04, 0x00, 0x00 };
|
||||||
|
|
||||||
|
static unsigned char lock_bits[] PROGMEM = {
|
||||||
|
0xc0, 0x03, 0x60, 0x06, 0x30, 0x0c, 0x10, 0x08, 0x10, 0x08, 0x10, 0x08,
|
||||||
|
0xfc, 0x3f, 0x04, 0x20, 0x04, 0x20, 0x84, 0x21, 0x84, 0x21, 0x84, 0x21,
|
||||||
|
0x04, 0x20, 0x04, 0x20, 0x04, 0x20, 0xfc, 0x3f };
|
||||||
|
|
||||||
|
// Global functions
|
||||||
#ifdef DISPLAY_GDEW042T2
|
#ifdef DISPLAY_GDEW042T2
|
||||||
GxEPD2_BW<GxEPD2_420, GxEPD2_420::HEIGHT> & getdisplay();
|
GxEPD2_BW<GxEPD2_420, GxEPD2_420::HEIGHT> & getdisplay();
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -5,12 +5,12 @@
|
||||||
|
|
||||||
class PageApparentWind : public Page
|
class PageApparentWind : public Page
|
||||||
{
|
{
|
||||||
bool keylock = false; // Keylock
|
|
||||||
int16_t lp = 80; // Pointer length
|
int16_t lp = 80; // Pointer length
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageApparentWind(CommonData &common){
|
PageApparentWind(CommonData &common){
|
||||||
common.logger->logDebug(GwLog::LOG,"Show PageApparentWind");
|
commonData = &common;
|
||||||
|
common.logger->logDebug(GwLog::LOG,"Instantiate PageApparentWind");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Key functions
|
// Key functions
|
||||||
|
@ -33,18 +33,18 @@ public:
|
||||||
return 0; // Commit the key
|
return 0; // Commit the key
|
||||||
}
|
}
|
||||||
|
|
||||||
// Keylock function
|
// Code for keylock
|
||||||
if(key == 11){ // Code for keylock
|
if(key == 11){
|
||||||
keylock = !keylock; // Toggle keylock
|
commonData->keylock = !commonData->keylock;
|
||||||
return 0; // Commit the key
|
return 0; // Commit the key
|
||||||
}
|
}
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void displayPage(CommonData &commonData, PageData &pageData)
|
virtual void displayPage(PageData &pageData)
|
||||||
{
|
{
|
||||||
GwConfigHandler *config = commonData.config;
|
GwConfigHandler *config = commonData->config;
|
||||||
GwLog *logger=commonData.logger;
|
GwLog *logger = commonData->logger;
|
||||||
|
|
||||||
static String svalue1old = "";
|
static String svalue1old = "";
|
||||||
static String unit1old = "";
|
static String unit1old = "";
|
||||||
|
@ -64,8 +64,8 @@ public:
|
||||||
name1 = name1.substring(0, 6); // String length limit for value name
|
name1 = name1.substring(0, 6); // String length limit for value name
|
||||||
double value1 = bvalue1->value; // Value as double in SI unit
|
double value1 = bvalue1->value; // Value as double in SI unit
|
||||||
// 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
|
||||||
|
|
||||||
// Get boat values for AWD
|
// Get boat values for AWD
|
||||||
GwApi::BoatValue *bvalue2 = pageData.values[1]; // First element in list (only one value by PageOneValue)
|
GwApi::BoatValue *bvalue2 = pageData.values[1]; // First element in list (only one value by PageOneValue)
|
||||||
|
@ -73,8 +73,8 @@ public:
|
||||||
name2 = name2.substring(0, 6); // String length limit for value name
|
name2 = name2.substring(0, 6); // String length limit for value name
|
||||||
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
|
||||||
|
|
||||||
// Optical warning by limit violation (unused)
|
// Optical warning by limit violation (unused)
|
||||||
if(String(flashLED) == "Limit Violation"){
|
if(String(flashLED) == "Limit Violation"){
|
||||||
|
@ -92,7 +92,7 @@ public:
|
||||||
// Set display in partial refresh mode
|
// Set display in partial refresh mode
|
||||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||||
|
|
||||||
getdisplay().setTextColor(commonData.fgcolor);
|
getdisplay().setTextColor(commonData->fgcolor);
|
||||||
|
|
||||||
// Show values AWS
|
// Show values AWS
|
||||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||||
|
@ -139,8 +139,8 @@ public:
|
||||||
static int16_t y2 = y0;
|
static int16_t y2 = y0;
|
||||||
|
|
||||||
//Draw instrument
|
//Draw instrument
|
||||||
getdisplay().fillCircle(x0, y0, lp + 5, commonData.fgcolor);
|
getdisplay().fillCircle(x0, y0, lp + 5, commonData->fgcolor);
|
||||||
getdisplay().fillCircle(x0, y0, lp + 1, commonData.bgcolor);
|
getdisplay().fillCircle(x0, y0, lp + 1, commonData->bgcolor);
|
||||||
|
|
||||||
// Calculation end point of pointer
|
// Calculation end point of pointer
|
||||||
value2 = value2 - 3.14 / 2;
|
value2 = value2 - 3.14 / 2;
|
||||||
|
@ -148,22 +148,16 @@ public:
|
||||||
y1 = y0 + sin(value2) * lp * 0.6;
|
y1 = y0 + sin(value2) * lp * 0.6;
|
||||||
x2 = x0 + cos(value2) * lp;
|
x2 = x0 + cos(value2) * lp;
|
||||||
y2 = y0 + sin(value2) * lp;
|
y2 = y0 + sin(value2) * lp;
|
||||||
getdisplay().drawLine(x1, y1, x2, y2, commonData.fgcolor);
|
getdisplay().drawLine(x1, y1, x2, y2, commonData->fgcolor);
|
||||||
|
|
||||||
// Key Layout
|
// Key Layout
|
||||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||||
if(keylock == false){
|
if(commonData->keylock == false){
|
||||||
getdisplay().setCursor(130, 290);
|
|
||||||
getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
|
||||||
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
||||||
getdisplay().setCursor(343, 290);
|
getdisplay().setCursor(343, 290);
|
||||||
getdisplay().print("[ILUM]");
|
getdisplay().print("[ILUM]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
getdisplay().setCursor(130, 290);
|
|
||||||
getdisplay().print(" [ Keylock active ]");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update display
|
// Update display
|
||||||
getdisplay().nextPage(); // Partial update (fast)
|
getdisplay().nextPage(); // Partial update (fast)
|
||||||
|
|
|
@ -5,24 +5,24 @@
|
||||||
|
|
||||||
class PageBME280 : public Page
|
class PageBME280 : public Page
|
||||||
{
|
{
|
||||||
bool keylock = false; // Keylock
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageBME280(CommonData &common){
|
PageBME280(CommonData &common){
|
||||||
common.logger->logDebug(GwLog::LOG,"Show PageBME280");
|
commonData = &common;
|
||||||
|
common.logger->logDebug(GwLog::LOG,"Instantiate PageBME280");
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int handleKey(int key){
|
virtual int handleKey(int key){
|
||||||
if(key == 11){ // Code for keylock
|
// Code for keylock
|
||||||
keylock = !keylock; // Toggle keylock
|
if(key == 11){
|
||||||
|
commonData->keylock = !commonData->keylock;
|
||||||
return 0; // Commit the key
|
return 0; // Commit the key
|
||||||
}
|
}
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void displayPage(CommonData &commonData, PageData &pageData){
|
virtual void displayPage(PageData &pageData){
|
||||||
GwConfigHandler *config = commonData.config;
|
GwConfigHandler *config = commonData->config;
|
||||||
GwLog *logger=commonData.logger;
|
GwLog *logger = commonData->logger;
|
||||||
|
|
||||||
double value1 = 0;
|
double value1 = 0;
|
||||||
double value2 = 0;
|
double value2 = 0;
|
||||||
|
@ -42,7 +42,7 @@ class PageBME280 : public Page
|
||||||
String name1 = "Temp"; // Value name
|
String name1 = "Temp"; // Value name
|
||||||
name1 = name1.substring(0, 6); // String length limit for value name
|
name1 = name1.substring(0, 6); // String length limit for value name
|
||||||
if(simulation == false){
|
if(simulation == false){
|
||||||
value1 = commonData.data.airTemperature; // Value as double in SI unit
|
value1 = commonData->data.airTemperature; // Value as double in SI unit
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
value1 = 23.0 + float(random(0, 10)) / 10.0;
|
value1 = 23.0 + float(random(0, 10)) / 10.0;
|
||||||
|
@ -60,7 +60,7 @@ class PageBME280 : public Page
|
||||||
String name2 = "Humid"; // Value name
|
String name2 = "Humid"; // Value name
|
||||||
name2 = name2.substring(0, 6); // String length limit for value name
|
name2 = name2.substring(0, 6); // String length limit for value name
|
||||||
if(simulation == false){
|
if(simulation == false){
|
||||||
value2 = commonData.data.airHumidity; // Value as double in SI unit
|
value2 = commonData->data.airHumidity; // Value as double in SI unit
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
value2 = 43 + float(random(0, 4));
|
value2 = 43 + float(random(0, 4));
|
||||||
|
@ -78,7 +78,7 @@ class PageBME280 : public Page
|
||||||
String name3 = "Press"; // Value name
|
String name3 = "Press"; // Value name
|
||||||
name3 = name3.substring(0, 6); // String length limit for value name
|
name3 = name3.substring(0, 6); // String length limit for value name
|
||||||
if(simulation == false){
|
if(simulation == false){
|
||||||
value3 = commonData.data.airPressure; // Value as double in SI unit
|
value3 = commonData->data.airPressure; // Value as double in SI unit
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
value3 = 1006 + float(random(0, 5));
|
value3 = 1006 + float(random(0, 5));
|
||||||
|
@ -107,7 +107,7 @@ class PageBME280 : public Page
|
||||||
// Set display in partial refresh mode
|
// Set display in partial refresh mode
|
||||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||||
|
|
||||||
getdisplay().setTextColor(commonData.fgcolor);
|
getdisplay().setTextColor(commonData->fgcolor);
|
||||||
|
|
||||||
// ############### Value 1 ################
|
// ############### Value 1 ################
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ class PageBME280 : public Page
|
||||||
// ############### Horizontal Line ################
|
// ############### Horizontal Line ################
|
||||||
|
|
||||||
// Horizontal line 3 pix
|
// Horizontal line 3 pix
|
||||||
getdisplay().fillRect(0, 105, 400, 3, commonData.fgcolor);
|
getdisplay().fillRect(0, 105, 400, 3, commonData->fgcolor);
|
||||||
|
|
||||||
// ############### Value 2 ################
|
// ############### Value 2 ################
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ class PageBME280 : public Page
|
||||||
// ############### Horizontal Line ################
|
// ############### Horizontal Line ################
|
||||||
|
|
||||||
// Horizontal line 3 pix
|
// Horizontal line 3 pix
|
||||||
getdisplay().fillRect(0, 195, 400, 3, commonData.fgcolor);
|
getdisplay().fillRect(0, 195, 400, 3, commonData->fgcolor);
|
||||||
|
|
||||||
// ############### Value 3 ################
|
// ############### Value 3 ################
|
||||||
|
|
||||||
|
@ -180,18 +180,12 @@ class PageBME280 : public Page
|
||||||
|
|
||||||
// Key Layout
|
// Key Layout
|
||||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||||
if(keylock == false){
|
if(commonData->keylock == false){
|
||||||
getdisplay().setCursor(130, 290);
|
|
||||||
getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
|
||||||
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
||||||
getdisplay().setCursor(343, 290);
|
getdisplay().setCursor(343, 290);
|
||||||
getdisplay().print("[ILUM]");
|
getdisplay().print("[ILUM]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
getdisplay().setCursor(130, 290);
|
|
||||||
getdisplay().print(" [ Keylock active ]");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update display
|
// Update display
|
||||||
getdisplay().nextPage(); // Partial update (fast)
|
getdisplay().nextPage(); // Partial update (fast)
|
||||||
|
|
|
@ -5,12 +5,12 @@
|
||||||
|
|
||||||
class PageBattery : public Page
|
class PageBattery : public Page
|
||||||
{
|
{
|
||||||
bool keylock = false; // Keylock
|
|
||||||
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){
|
||||||
common.logger->logDebug(GwLog::LOG,"Show PageBattery");
|
commonData = &common;
|
||||||
|
common.logger->logDebug(GwLog::LOG,"Instantiate PageBattery");
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int handleKey(int key){
|
virtual int handleKey(int key){
|
||||||
|
@ -23,15 +23,15 @@ class PageBattery : public Page
|
||||||
|
|
||||||
// Code for keylock
|
// Code for keylock
|
||||||
if(key == 11){
|
if(key == 11){
|
||||||
keylock = !keylock; // Toggle keylock
|
commonData->keylock = !commonData->keylock;
|
||||||
return 0; // Commit the key
|
return 0; // Commit the key
|
||||||
}
|
}
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void displayPage(CommonData &commonData, PageData &pageData){
|
virtual void displayPage(PageData &pageData){
|
||||||
GwConfigHandler *config = commonData.config;
|
GwConfigHandler *config = commonData->config;
|
||||||
GwLog *logger=commonData.logger;
|
GwLog *logger = commonData->logger;
|
||||||
|
|
||||||
// Old values for hold function
|
// Old values for hold function
|
||||||
double value1 = 0;
|
double value1 = 0;
|
||||||
|
@ -58,19 +58,19 @@ class PageBattery : public Page
|
||||||
// Switch average values
|
// Switch average values
|
||||||
switch (average) {
|
switch (average) {
|
||||||
case 0:
|
case 0:
|
||||||
value1 = commonData.data.batteryVoltage; // Live data
|
value1 = commonData->data.batteryVoltage; // Live data
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
value1 = commonData.data.batteryVoltage10; // Average 10s
|
value1 = commonData->data.batteryVoltage10; // Average 10s
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
value1 = commonData.data.batteryVoltage60; // Average 60s
|
value1 = commonData->data.batteryVoltage60; // Average 60s
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
value1 = commonData.data.batteryVoltage300; // Average 300s
|
value1 = commonData->data.batteryVoltage300; // Average 300s
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
value1 = commonData.data.batteryVoltage; // Default
|
value1 = commonData->data.batteryVoltage; // Default
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -87,19 +87,19 @@ class PageBattery : public Page
|
||||||
if(String(powsensor1) == "INA219" || String(powsensor1) == "INA226"){
|
if(String(powsensor1) == "INA219" || String(powsensor1) == "INA226"){
|
||||||
switch (average) {
|
switch (average) {
|
||||||
case 0:
|
case 0:
|
||||||
value2 = commonData.data.batteryCurrent; // Live data
|
value2 = commonData->data.batteryCurrent; // Live data
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
value2 = commonData.data.batteryCurrent10; // Average 10s
|
value2 = commonData->data.batteryCurrent10; // Average 10s
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
value2 = commonData.data.batteryCurrent60; // Average 60s
|
value2 = commonData->data.batteryCurrent60; // Average 60s
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
value2 = commonData.data.batteryCurrent300; // Average 300s
|
value2 = commonData->data.batteryCurrent300; // Average 300s
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
value2 = commonData.data.batteryCurrent; // Default
|
value2 = commonData->data.batteryCurrent; // Default
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -116,19 +116,19 @@ class PageBattery : public Page
|
||||||
if(String(powsensor1) == "INA219" || String(powsensor1) == "INA226"){
|
if(String(powsensor1) == "INA219" || String(powsensor1) == "INA226"){
|
||||||
switch (average) {
|
switch (average) {
|
||||||
case 0:
|
case 0:
|
||||||
value3 = commonData.data.batteryPower; // Live data
|
value3 = commonData->data.batteryPower; // Live data
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
value3 = commonData.data.batteryPower10; // Average 10s
|
value3 = commonData->data.batteryPower10; // Average 10s
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
value3 = commonData.data.batteryPower60; // Average 60s
|
value3 = commonData->data.batteryPower60; // Average 60s
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
value3 = commonData.data.batteryPower300; // Average 300s
|
value3 = commonData->data.batteryPower300; // Average 300s
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
value3 = commonData.data.batteryPower; // Default
|
value3 = commonData->data.batteryPower; // Default
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -156,7 +156,7 @@ class PageBattery : public Page
|
||||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||||
|
|
||||||
// Show average settings
|
// Show average settings
|
||||||
getdisplay().setTextColor(commonData.fgcolor);
|
getdisplay().setTextColor(commonData->fgcolor);
|
||||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||||
switch (average) {
|
switch (average) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -228,7 +228,7 @@ class PageBattery : public Page
|
||||||
// ############### Horizontal Line ################
|
// ############### Horizontal Line ################
|
||||||
|
|
||||||
// Horizontal line 3 pix
|
// Horizontal line 3 pix
|
||||||
getdisplay().fillRect(0, 105, 400, 3, commonData.fgcolor);
|
getdisplay().fillRect(0, 105, 400, 3, commonData->fgcolor);
|
||||||
|
|
||||||
// ############### Value 2 ################
|
// ############### Value 2 ################
|
||||||
|
|
||||||
|
@ -257,7 +257,7 @@ class PageBattery : public Page
|
||||||
// ############### Horizontal Line ################
|
// ############### Horizontal Line ################
|
||||||
|
|
||||||
// Horizontal line 3 pix
|
// Horizontal line 3 pix
|
||||||
getdisplay().fillRect(0, 195, 400, 3, commonData.fgcolor);
|
getdisplay().fillRect(0, 195, 400, 3, commonData->fgcolor);
|
||||||
|
|
||||||
// ############### Value 3 ################
|
// ############### Value 3 ################
|
||||||
|
|
||||||
|
@ -288,20 +288,14 @@ class PageBattery : public Page
|
||||||
|
|
||||||
// Key Layout
|
// Key Layout
|
||||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||||
if(keylock == false){
|
if(commonData->keylock == false){
|
||||||
getdisplay().setCursor(10, 290);
|
getdisplay().setCursor(10, 290);
|
||||||
getdisplay().print("[AVG]");
|
getdisplay().print("[AVG]");
|
||||||
getdisplay().setCursor(130, 290);
|
|
||||||
getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
|
||||||
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
||||||
getdisplay().setCursor(343, 290);
|
getdisplay().setCursor(343, 290);
|
||||||
getdisplay().print("[ILUM]");
|
getdisplay().print("[ILUM]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
getdisplay().setCursor(130, 290);
|
|
||||||
getdisplay().print(" [ Keylock active ]");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update display
|
// Update display
|
||||||
getdisplay().nextPage(); // Partial update (fast)
|
getdisplay().nextPage(); // Partial update (fast)
|
||||||
|
|
|
@ -7,14 +7,14 @@
|
||||||
class PageBattery2 : public Page
|
class PageBattery2 : public Page
|
||||||
{
|
{
|
||||||
bool init = false; // Marker for init done
|
bool init = false; // Marker for init done
|
||||||
bool keylock = false; // Keylock
|
|
||||||
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
|
||||||
bool trend = true; // Trend indicator [0|1], 0=off, 1=on
|
bool trend = true; // Trend indicator [0|1], 0=off, 1=on
|
||||||
double raw = 0;
|
double raw = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageBattery2(CommonData &common){
|
PageBattery2(CommonData &common){
|
||||||
common.logger->logDebug(GwLog::LOG,"Show PageBattery2");
|
commonData = &common;
|
||||||
|
common.logger->logDebug(GwLog::LOG,"Instantiate PageBattery2");
|
||||||
}
|
}
|
||||||
virtual int handleKey(int key){
|
virtual int handleKey(int key){
|
||||||
// Change average
|
// Change average
|
||||||
|
@ -32,16 +32,16 @@ public:
|
||||||
|
|
||||||
// Code for keylock
|
// Code for keylock
|
||||||
if(key == 11){
|
if(key == 11){
|
||||||
keylock = !keylock; // Toggle keylock
|
commonData->keylock = !commonData->keylock;
|
||||||
return 0; // Commit the key
|
return 0; // Commit the key
|
||||||
}
|
}
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void displayPage(CommonData &commonData, PageData &pageData)
|
virtual void displayPage(PageData &pageData)
|
||||||
{
|
{
|
||||||
GwConfigHandler *config = commonData.config;
|
GwConfigHandler *config = commonData->config;
|
||||||
GwLog *logger=commonData.logger;
|
GwLog *logger = commonData->logger;
|
||||||
|
|
||||||
// Polynominal coefficients second order for battery energy level calculation
|
// Polynominal coefficients second order for battery energy level calculation
|
||||||
// index 0 = Pb, 1 = Gel, 2 = AGM, 3 = LiFePo4
|
// index 0 = Pb, 1 = Gel, 2 = AGM, 3 = LiFePo4
|
||||||
|
@ -71,42 +71,42 @@ public:
|
||||||
|
|
||||||
// Create trend value
|
// Create trend value
|
||||||
if(init == false){ // Load start values for first page run
|
if(init == false){ // Load start values for first page run
|
||||||
valueTrend = commonData.data.batteryVoltage10;
|
valueTrend = commonData->data.batteryVoltage10;
|
||||||
init = true;
|
init = true;
|
||||||
}
|
}
|
||||||
else{ // Reading trend value
|
else{ // Reading trend value
|
||||||
valueTrend = commonData.data.batteryVoltage10;
|
valueTrend = commonData->data.batteryVoltage10;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get raw value for trend indicator
|
// Get raw value for trend indicator
|
||||||
raw = commonData.data.batteryVoltage; // Live data
|
raw = commonData->data.batteryVoltage; // Live data
|
||||||
|
|
||||||
// Switch average values
|
// Switch average values
|
||||||
switch (average) {
|
switch (average) {
|
||||||
case 0:
|
case 0:
|
||||||
value1 = commonData.data.batteryVoltage; // Live data
|
value1 = commonData->data.batteryVoltage; // Live data
|
||||||
value2 = commonData.data.batteryCurrent;
|
value2 = commonData->data.batteryCurrent;
|
||||||
value3 = commonData.data.batteryPower;
|
value3 = commonData->data.batteryPower;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
value1 = commonData.data.batteryVoltage10; // Average 10s
|
value1 = commonData->data.batteryVoltage10; // Average 10s
|
||||||
value2 = commonData.data.batteryCurrent10;
|
value2 = commonData->data.batteryCurrent10;
|
||||||
value3 = commonData.data.batteryPower10;
|
value3 = commonData->data.batteryPower10;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
value1 = commonData.data.batteryVoltage60; // Average 60s
|
value1 = commonData->data.batteryVoltage60; // Average 60s
|
||||||
value2 = commonData.data.batteryCurrent60;
|
value2 = commonData->data.batteryCurrent60;
|
||||||
value3 = commonData.data.batteryPower60;
|
value3 = commonData->data.batteryPower60;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
value1 = commonData.data.batteryVoltage300; // Average 300s
|
value1 = commonData->data.batteryVoltage300; // Average 300s
|
||||||
value2 = commonData.data.batteryCurrent300;
|
value2 = commonData->data.batteryCurrent300;
|
||||||
value3 = commonData.data.batteryPower300;
|
value3 = commonData->data.batteryPower300;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
value1 = commonData.data.batteryVoltage; // Default
|
value1 = commonData->data.batteryVoltage; // Default
|
||||||
value2 = commonData.data.batteryCurrent;
|
value2 = commonData->data.batteryCurrent;
|
||||||
value3 = commonData.data.batteryPower;
|
value3 = commonData->data.batteryPower;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
bool valid1 = true;
|
bool valid1 = true;
|
||||||
|
@ -180,7 +180,7 @@ public:
|
||||||
// Set display in partial refresh mode
|
// Set display in partial refresh mode
|
||||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||||
|
|
||||||
getdisplay().setTextColor(commonData.fgcolor);
|
getdisplay().setTextColor(commonData->fgcolor);
|
||||||
|
|
||||||
// Show name
|
// Show name
|
||||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||||
|
@ -219,7 +219,7 @@ public:
|
||||||
getdisplay().print("Battery Type");
|
getdisplay().print("Battery Type");
|
||||||
|
|
||||||
// Show battery with fill level
|
// Show battery with fill level
|
||||||
batteryGraphic(150, 45, batPercentage, commonData.fgcolor, commonData.bgcolor);
|
batteryGraphic(150, 45, batPercentage, commonData->fgcolor, commonData->bgcolor);
|
||||||
|
|
||||||
// Show average settings
|
// Show average settings
|
||||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||||
|
@ -330,20 +330,14 @@ public:
|
||||||
|
|
||||||
// Key Layout
|
// Key Layout
|
||||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||||
if(keylock == false){
|
if(commonData->keylock == false){
|
||||||
getdisplay().setCursor(10, 290);
|
getdisplay().setCursor(10, 290);
|
||||||
getdisplay().print("[AVG]");
|
getdisplay().print("[AVG]");
|
||||||
getdisplay().setCursor(130, 290);
|
|
||||||
getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
|
||||||
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
||||||
getdisplay().setCursor(343, 290);
|
getdisplay().setCursor(343, 290);
|
||||||
getdisplay().print("[ILUM]");
|
getdisplay().print("[ILUM]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
getdisplay().setCursor(130, 290);
|
|
||||||
getdisplay().print(" [ Keylock active ]");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update display
|
// Update display
|
||||||
getdisplay().nextPage(); // Partial update (fast)
|
getdisplay().nextPage(); // Partial update (fast)
|
||||||
|
|
|
@ -5,27 +5,26 @@
|
||||||
|
|
||||||
class PageClock : public Page
|
class PageClock : public Page
|
||||||
{
|
{
|
||||||
bool keylock = false; // Keylock
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageClock(CommonData &common){
|
PageClock(CommonData &common){
|
||||||
common.logger->logDebug(GwLog::LOG,"Show PageClock");
|
commonData = &common;
|
||||||
|
common.logger->logDebug(GwLog::LOG,"Instantiate PageClock");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Key functions
|
// Key functions
|
||||||
virtual int handleKey(int key){
|
virtual int handleKey(int key){
|
||||||
// Keylock function
|
// Code for keylock
|
||||||
if(key == 11){ // Code for keylock
|
if(key == 11){
|
||||||
keylock = !keylock; // Toggle keylock
|
commonData->keylock = !commonData->keylock;
|
||||||
return 0; // Commit the key
|
return 0; // Commit the key
|
||||||
}
|
}
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void displayPage(CommonData &commonData, PageData &pageData)
|
virtual void displayPage(PageData &pageData)
|
||||||
{
|
{
|
||||||
GwConfigHandler *config = commonData.config;
|
GwConfigHandler *config = commonData->config;
|
||||||
GwLog *logger=commonData.logger;
|
GwLog *logger = commonData->logger;
|
||||||
|
|
||||||
static String svalue1old = "";
|
static String svalue1old = "";
|
||||||
static String unit1old = "";
|
static String unit1old = "";
|
||||||
|
@ -61,8 +60,8 @@ public:
|
||||||
value1 = 38160; // Simulation data for time value 11:36 in seconds
|
value1 = 38160; // Simulation data for time value 11:36 in seconds
|
||||||
} // Other simulation data see OBP60Formater.cpp
|
} // Other simulation data see OBP60Formater.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
|
||||||
if(valid1 == true){
|
if(valid1 == true){
|
||||||
svalue1old = svalue1; // Save old value
|
svalue1old = svalue1; // Save old value
|
||||||
unit1old = unit1; // Save old unit
|
unit1old = unit1; // Save old unit
|
||||||
|
@ -74,8 +73,8 @@ public:
|
||||||
name2 = name2.substring(0, 6); // String length limit for value name
|
name2 = name2.substring(0, 6); // String length limit for value name
|
||||||
value2 = bvalue2->value; // Value as double in SI unit
|
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){
|
||||||
svalue2old = svalue2; // Save old value
|
svalue2old = svalue2; // Save old value
|
||||||
unit2old = unit2; // Save old unit
|
unit2old = unit2; // Save old unit
|
||||||
|
@ -87,8 +86,8 @@ public:
|
||||||
name3 = name3.substring(0, 6); // String length limit for value name
|
name3 = name3.substring(0, 6); // String length limit for value name
|
||||||
value3 = bvalue3->value; // Value as double in SI unit
|
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){
|
||||||
svalue3old = svalue3; // Save old value
|
svalue3old = svalue3; // Save old value
|
||||||
unit3old = unit3; // Save old unit
|
unit3old = unit3; // Save old unit
|
||||||
|
@ -110,7 +109,7 @@ public:
|
||||||
// Set display in partial refresh mode
|
// Set display in partial refresh mode
|
||||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||||
|
|
||||||
getdisplay().setTextColor(commonData.fgcolor);
|
getdisplay().setTextColor(commonData->fgcolor);
|
||||||
|
|
||||||
// Show values GPS date
|
// Show values GPS date
|
||||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||||
|
@ -122,7 +121,7 @@ public:
|
||||||
getdisplay().print("Date"); // Name
|
getdisplay().print("Date"); // Name
|
||||||
|
|
||||||
// Horizintal separator left
|
// Horizintal separator left
|
||||||
getdisplay().fillRect(0, 149, 60, 3, commonData.fgcolor);
|
getdisplay().fillRect(0, 149, 60, 3, commonData->fgcolor);
|
||||||
|
|
||||||
// Show values GPS time
|
// Show values GPS time
|
||||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||||
|
@ -136,7 +135,7 @@ public:
|
||||||
// Show values sunrise
|
// Show values sunrise
|
||||||
String sunrise = "---";
|
String sunrise = "---";
|
||||||
if(valid1 == true && valid2 == true && valid3 == true){
|
if(valid1 == true && valid2 == true && valid3 == true){
|
||||||
sunrise = String(commonData.sundata.sunriseHour) + ":" + String(commonData.sundata.sunriseMinute + 100).substring(1);
|
sunrise = String(commonData->sundata.sunriseHour) + ":" + String(commonData->sundata.sunriseMinute + 100).substring(1);
|
||||||
svalue5old = sunrise;
|
svalue5old = sunrise;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,12 +148,12 @@ public:
|
||||||
getdisplay().print("SunR"); // Name
|
getdisplay().print("SunR"); // Name
|
||||||
|
|
||||||
// Horizintal separator right
|
// Horizintal separator right
|
||||||
getdisplay().fillRect(340, 149, 80, 3, commonData.fgcolor);
|
getdisplay().fillRect(340, 149, 80, 3, commonData->fgcolor);
|
||||||
|
|
||||||
// Show values sunset
|
// Show values sunset
|
||||||
String sunset = "---";
|
String sunset = "---";
|
||||||
if(valid1 == true && valid2 == true && valid3 == true){
|
if(valid1 == true && valid2 == true && valid3 == true){
|
||||||
sunset = String(commonData.sundata.sunsetHour) + ":" + String(commonData.sundata.sunsetMinute + 100).substring(1);
|
sunset = String(commonData->sundata.sunsetHour) + ":" + String(commonData->sundata.sunsetMinute + 100).substring(1);
|
||||||
svalue6old = sunset;
|
svalue6old = sunset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,8 +171,8 @@ public:
|
||||||
int rInstrument = 110; // Radius of clock
|
int rInstrument = 110; // Radius of clock
|
||||||
float pi = 3.141592;
|
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
|
||||||
|
|
||||||
for(int i=0; i<360; i=i+1)
|
for(int i=0; i<360; i=i+1)
|
||||||
{
|
{
|
||||||
|
@ -214,7 +213,7 @@ public:
|
||||||
if(i % 6 == 0){
|
if(i % 6 == 0){
|
||||||
float x1c = 200 + rInstrument*sin(i/180.0*pi);
|
float x1c = 200 + rInstrument*sin(i/180.0*pi);
|
||||||
float y1c = 150 - rInstrument*cos(i/180.0*pi);
|
float y1c = 150 - rInstrument*cos(i/180.0*pi);
|
||||||
getdisplay().fillCircle((int)x1c, (int)y1c, 2, commonData.fgcolor);
|
getdisplay().fillCircle((int)x1c, (int)y1c, 2, commonData->fgcolor);
|
||||||
sinx=sin(i/180.0*pi);
|
sinx=sin(i/180.0*pi);
|
||||||
cosx=cos(i/180.0*pi);
|
cosx=cos(i/180.0*pi);
|
||||||
}
|
}
|
||||||
|
@ -228,10 +227,10 @@ public:
|
||||||
float yy2 = -(rInstrument+10);
|
float yy2 = -(rInstrument+10);
|
||||||
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*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),commonData.fgcolor);
|
200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),commonData->fgcolor);
|
||||||
getdisplay().fillTriangle(200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
getdisplay().fillTriangle(200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
||||||
200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),
|
200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),
|
||||||
200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),commonData.fgcolor);
|
200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),commonData->fgcolor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,7 +269,7 @@ public:
|
||||||
float yy2 = -(rInstrument * 0.5);
|
float yy2 = -(rInstrument * 0.5);
|
||||||
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);
|
||||||
// Inverted pointer
|
// Inverted pointer
|
||||||
// Pointer as triangle with center base 2*width
|
// Pointer as triangle with center base 2*width
|
||||||
float endwidth = 2; // End width of pointer
|
float endwidth = 2; // End width of pointer
|
||||||
|
@ -280,7 +279,7 @@ public:
|
||||||
float iy2 = -endwidth;
|
float iy2 = -endwidth;
|
||||||
getdisplay().fillTriangle(200+(int)(cosx*ix1-sinx*iy1),150+(int)(sinx*ix1+cosx*iy1),
|
getdisplay().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*ix2-sinx*iy1),150+(int)(sinx*ix2+cosx*iy1),
|
||||||
200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData.fgcolor);
|
200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData->fgcolor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw minute pointer
|
// Draw minute pointer
|
||||||
|
@ -296,7 +295,7 @@ public:
|
||||||
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);
|
||||||
// Inverted pointer
|
// Inverted pointer
|
||||||
// Pointer as triangle with center base 2*width
|
// Pointer as triangle with center base 2*width
|
||||||
float endwidth = 2; // End width of pointer
|
float endwidth = 2; // End width of pointer
|
||||||
|
@ -306,28 +305,22 @@ public:
|
||||||
float iy2 = -endwidth;
|
float iy2 = -endwidth;
|
||||||
getdisplay().fillTriangle(200+(int)(cosx*ix1-sinx*iy1),150+(int)(sinx*ix1+cosx*iy1),
|
getdisplay().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*ix2-sinx*iy1),150+(int)(sinx*ix2+cosx*iy1),
|
||||||
200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData.fgcolor);
|
200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData->fgcolor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Center circle
|
// Center circle
|
||||||
getdisplay().fillCircle(200, 150, startwidth + 6, commonData.bgcolor);
|
getdisplay().fillCircle(200, 150, startwidth + 6, commonData->bgcolor);
|
||||||
getdisplay().fillCircle(200, 150, startwidth + 4, commonData.fgcolor);
|
getdisplay().fillCircle(200, 150, startwidth + 4, commonData->fgcolor);
|
||||||
|
|
||||||
//*******************************************************************************************
|
//*******************************************************************************************
|
||||||
// Key Layout
|
// Key Layout
|
||||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||||
if(keylock == false){
|
if(commonData->keylock == false){
|
||||||
getdisplay().setCursor(130, 290);
|
|
||||||
getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
|
||||||
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
||||||
getdisplay().setCursor(343, 290);
|
getdisplay().setCursor(343, 290);
|
||||||
getdisplay().print("[ILUM]");
|
getdisplay().print("[ILUM]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
getdisplay().setCursor(130, 290);
|
|
||||||
getdisplay().print(" [ Keylock active ]");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update display
|
// Update display
|
||||||
getdisplay().nextPage(); // Partial update (fast)
|
getdisplay().nextPage(); // Partial update (fast)
|
||||||
|
|
|
@ -5,24 +5,24 @@
|
||||||
|
|
||||||
class PageDST810 : public Page
|
class PageDST810 : public Page
|
||||||
{
|
{
|
||||||
bool keylock = false; // Keylock
|
public:
|
||||||
|
|
||||||
public:
|
|
||||||
PageDST810(CommonData &common){
|
PageDST810(CommonData &common){
|
||||||
common.logger->logDebug(GwLog::LOG,"Show PageDST810");
|
commonData = &common;
|
||||||
|
common.logger->logDebug(GwLog::LOG,"Instantiate PageDST810");
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int handleKey(int key){
|
virtual int handleKey(int key){
|
||||||
if(key == 11){ // Code for keylock
|
// Code for keylock
|
||||||
keylock = !keylock; // Toggle keylock
|
if(key == 11){
|
||||||
|
commonData->keylock = !commonData->keylock;
|
||||||
return 0; // Commit the key
|
return 0; // Commit the key
|
||||||
}
|
}
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void displayPage(CommonData &commonData, PageData &pageData){
|
virtual void displayPage(PageData &pageData){
|
||||||
GwConfigHandler *config = commonData.config;
|
GwConfigHandler *config = commonData->config;
|
||||||
GwLog *logger=commonData.logger;
|
GwLog *logger = commonData->logger;
|
||||||
|
|
||||||
// Old values for hold function
|
// Old values for hold function
|
||||||
static String svalue1old = "";
|
static String svalue1old = "";
|
||||||
|
@ -47,8 +47,8 @@ class PageDST810 : public Page
|
||||||
name1 = name1.substring(0, 6); // String length limit for value name
|
name1 = name1.substring(0, 6); // String length limit for value name
|
||||||
double value1 = bvalue1->value; // Value as double in SI unit
|
double value1 = bvalue1->value; // Value as double in SI unit
|
||||||
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
|
||||||
|
|
||||||
// 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 (only one value by PageOneValue)
|
||||||
|
@ -56,8 +56,8 @@ class PageDST810 : public Page
|
||||||
name2 = name2.substring(0, 6); // String length limit for value name
|
name2 = name2.substring(0, 6); // String length limit for value name
|
||||||
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
|
||||||
|
|
||||||
// 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]; // Second element in list (only one value by PageOneValue)
|
||||||
|
@ -65,8 +65,8 @@ class PageDST810 : public Page
|
||||||
name3 = name3.substring(0, 6); // String length limit for value name
|
name3 = name3.substring(0, 6); // String length limit for value name
|
||||||
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
|
||||||
|
|
||||||
// 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]; // Second element in list (only one value by PageOneValue)
|
||||||
|
@ -74,8 +74,8 @@ class PageDST810 : public Page
|
||||||
name4 = name4.substring(0, 6); // String length limit for value name
|
name4 = name4.substring(0, 6); // String length limit for value name
|
||||||
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
|
||||||
|
|
||||||
// Optical warning by limit violation (unused)
|
// Optical warning by limit violation (unused)
|
||||||
if(String(flashLED) == "Limit Violation"){
|
if(String(flashLED) == "Limit Violation"){
|
||||||
|
@ -93,7 +93,7 @@ class PageDST810 : public Page
|
||||||
// Set display in partial refresh mode
|
// Set display in partial refresh mode
|
||||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||||
|
|
||||||
getdisplay().setTextColor(commonData.fgcolor);
|
getdisplay().setTextColor(commonData->fgcolor);
|
||||||
|
|
||||||
// ############### Value 1 ################
|
// ############### Value 1 ################
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ class PageDST810 : public Page
|
||||||
// ############### Horizontal Line ################
|
// ############### Horizontal Line ################
|
||||||
|
|
||||||
// Horizontal line 3 pix
|
// Horizontal line 3 pix
|
||||||
getdisplay().fillRect(0, 105, 400, 3, commonData.fgcolor);
|
getdisplay().fillRect(0, 105, 400, 3, commonData->fgcolor);
|
||||||
|
|
||||||
// ############### Value 2 ################
|
// ############### Value 2 ################
|
||||||
|
|
||||||
|
@ -169,7 +169,7 @@ class PageDST810 : public Page
|
||||||
// ############### Horizontal Line ################
|
// ############### Horizontal Line ################
|
||||||
|
|
||||||
// Horizontal line 3 pix
|
// Horizontal line 3 pix
|
||||||
getdisplay().fillRect(0, 195, 400, 3, commonData.fgcolor);
|
getdisplay().fillRect(0, 195, 400, 3, commonData->fgcolor);
|
||||||
|
|
||||||
// ############### Value 3 ################
|
// ############### Value 3 ################
|
||||||
|
|
||||||
|
@ -207,7 +207,7 @@ class PageDST810 : public Page
|
||||||
// ############### Vertical Line ################
|
// ############### Vertical Line ################
|
||||||
|
|
||||||
// Vertical line 3 pix
|
// Vertical line 3 pix
|
||||||
getdisplay().fillRect(200, 195, 3, 75, commonData.fgcolor);
|
getdisplay().fillRect(200, 195, 3, 75, commonData->fgcolor);
|
||||||
|
|
||||||
// ############### Value 4 ################
|
// ############### Value 4 ################
|
||||||
|
|
||||||
|
@ -247,18 +247,12 @@ class PageDST810 : public Page
|
||||||
|
|
||||||
// Key Layout
|
// Key Layout
|
||||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||||
if(keylock == false){
|
if(commonData->keylock == false){
|
||||||
getdisplay().setCursor(130, 290);
|
|
||||||
getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
|
||||||
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
||||||
getdisplay().setCursor(343, 290);
|
getdisplay().setCursor(343, 290);
|
||||||
getdisplay().print("[ILUM]");
|
getdisplay().print("[ILUM]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
getdisplay().setCursor(130, 290);
|
|
||||||
getdisplay().print(" [ Keylock active ]");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update display
|
// Update display
|
||||||
getdisplay().nextPage(); // Partial update (fast)
|
getdisplay().nextPage(); // Partial update (fast)
|
||||||
|
|
|
@ -57,31 +57,33 @@ static unsigned char gasoline_bits[] = {
|
||||||
0x98, 0xcf, 0x38, 0xe7, 0x78, 0xf0, 0xf8, 0xfa, 0xf8, 0xfa, 0x78, 0xf0,
|
0x98, 0xcf, 0x38, 0xe7, 0x78, 0xf0, 0xf8, 0xfa, 0xf8, 0xfa, 0x78, 0xf0,
|
||||||
0x38, 0xe7, 0x98, 0xcf, 0xf8, 0xff, 0xf0, 0x7f };
|
0x38, 0xe7, 0x98, 0xcf, 0xf8, 0xff, 0xf0, 0x7f };
|
||||||
|
|
||||||
class PageFluid : public Page{
|
class PageFluid : public Page
|
||||||
bool keylock = false; // Keylock
|
{
|
||||||
int fluidtype;
|
int fluidtype;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageFluid(CommonData &common){
|
PageFluid(CommonData &common){
|
||||||
|
commonData = &common;
|
||||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageFluid");
|
common.logger->logDebug(GwLog::LOG,"Instantiate PageFluid");
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int handleKey(int key){
|
virtual int handleKey(int key){
|
||||||
if(key == 11){ // Code for keylock
|
// Code for keylock
|
||||||
keylock = !keylock; // Toggle keylock
|
if(key == 11){
|
||||||
|
commonData->keylock = !commonData->keylock;
|
||||||
return 0; // Commit the key
|
return 0; // Commit the key
|
||||||
}
|
}
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void displayNew(CommonData &commonData, PageData &pageData){
|
virtual void displayNew(PageData &pageData){
|
||||||
fluidtype = commonData.config->getInt("page" + String(pageData.pageNumber) + "fluid", 0);
|
fluidtype = commonData->config->getInt("page" + String(pageData.pageNumber) + "fluid", 0);
|
||||||
commonData.logger->logDebug(GwLog::LOG,"New PageFluid: fluidtype=%d", fluidtype);
|
commonData->logger->logDebug(GwLog::LOG,"New PageFluid: fluidtype=%d", fluidtype);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void displayPage(CommonData &commonData, PageData &pageData){
|
virtual void displayPage(PageData &pageData){
|
||||||
GwConfigHandler *config = commonData.config;
|
GwConfigHandler *config = commonData->config;
|
||||||
GwLog *logger=commonData.logger;
|
GwLog *logger = commonData->logger;
|
||||||
|
|
||||||
// Get config data
|
// Get config data
|
||||||
String flashLED = config->getString(config->flashLED);
|
String flashLED = config->getString(config->flashLED);
|
||||||
|
@ -107,7 +109,7 @@ class PageFluid : public Page{
|
||||||
// Set display in partial refresh mode
|
// Set display in partial refresh mode
|
||||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height());
|
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height());
|
||||||
|
|
||||||
getdisplay().setTextColor(commonData.fgcolor);
|
getdisplay().setTextColor(commonData->fgcolor);
|
||||||
|
|
||||||
// descriptions
|
// descriptions
|
||||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||||
|
@ -125,11 +127,11 @@ class PageFluid : public Page{
|
||||||
uint8_t r = 110;
|
uint8_t r = 110;
|
||||||
|
|
||||||
// circular frame
|
// circular frame
|
||||||
getdisplay().drawCircle(c.x, c.y, r+5, commonData.fgcolor);
|
getdisplay().drawCircle(c.x, c.y, r+5, commonData->fgcolor);
|
||||||
getdisplay().fillCircle(c.x, c.y, r+2, commonData.fgcolor);
|
getdisplay().fillCircle(c.x, c.y, r+2, commonData->fgcolor);
|
||||||
getdisplay().fillCircle(c.x, c.y, r-1, commonData.bgcolor);
|
getdisplay().fillCircle(c.x, c.y, r-1, commonData->bgcolor);
|
||||||
// center of pointer as dot
|
// center of pointer as dot
|
||||||
getdisplay().fillCircle(c.x, c.y, 8, commonData.fgcolor);
|
getdisplay().fillCircle(c.x, c.y, 8, commonData->fgcolor);
|
||||||
|
|
||||||
// value down centered
|
// value down centered
|
||||||
char buffer[6];
|
char buffer[6];
|
||||||
|
@ -143,19 +145,19 @@ class PageFluid : public Page{
|
||||||
// draw symbol (as bitmap)
|
// draw symbol (as bitmap)
|
||||||
switch (fluidtype) {
|
switch (fluidtype) {
|
||||||
case 0:
|
case 0:
|
||||||
getdisplay().drawXBitmap(c.x-8, c.y-50, fuel_bits, fuel_width, fuel_height, commonData.fgcolor);
|
getdisplay().drawXBitmap(c.x-8, c.y-50, fuel_bits, fuel_width, fuel_height, commonData->fgcolor);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
getdisplay().drawXBitmap(c.x-8, c.y-50, water_bits, water_width, water_height, commonData.fgcolor);
|
getdisplay().drawXBitmap(c.x-8, c.y-50, water_bits, water_width, water_height, commonData->fgcolor);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
getdisplay().drawXBitmap(c.x-8, c.y-50, oil_bits, oil_width, oil_height, commonData.fgcolor);
|
getdisplay().drawXBitmap(c.x-8, c.y-50, oil_bits, oil_width, oil_height, commonData->fgcolor);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
getdisplay().drawXBitmap(c.x-8, c.y-50, waste_bits, waste_width, waste_height, commonData.fgcolor);
|
getdisplay().drawXBitmap(c.x-8, c.y-50, waste_bits, waste_width, waste_height, commonData->fgcolor);
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
getdisplay().drawXBitmap(c.x-8, c.y-50, gasoline_bits, gasoline_width, gasoline_height, commonData.fgcolor);
|
getdisplay().drawXBitmap(c.x-8, c.y-50, gasoline_bits, gasoline_width, gasoline_height, commonData->fgcolor);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,11 +186,11 @@ class PageFluid : public Page{
|
||||||
{c.x + 2, c.y - (r - 16)},
|
{c.x + 2, c.y - (r - 16)},
|
||||||
{c.x - 2, c.y - (r - 16)}
|
{c.x - 2, c.y - (r - 16)}
|
||||||
};
|
};
|
||||||
fillPoly4(rotatePoints(c, pts, -120), commonData.fgcolor);
|
fillPoly4(rotatePoints(c, pts, -120), commonData->fgcolor);
|
||||||
fillPoly4(rotatePoints(c, pts, -60), commonData.fgcolor);
|
fillPoly4(rotatePoints(c, pts, -60), commonData->fgcolor);
|
||||||
fillPoly4(rotatePoints(c, pts, 0), commonData.fgcolor);
|
fillPoly4(rotatePoints(c, pts, 0), commonData->fgcolor);
|
||||||
fillPoly4(rotatePoints(c, pts, 60), commonData.fgcolor);
|
fillPoly4(rotatePoints(c, pts, 60), commonData->fgcolor);
|
||||||
fillPoly4(rotatePoints(c, pts, 120), commonData.fgcolor);
|
fillPoly4(rotatePoints(c, pts, 120), commonData->fgcolor);
|
||||||
|
|
||||||
// dots
|
// dots
|
||||||
// rotate 0 to 360 in 12 degree steps
|
// rotate 0 to 360 in 12 degree steps
|
||||||
|
@ -197,7 +199,7 @@ class PageFluid : public Page{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
p = rotatePoint(c, {c.x, c.y - r + 10}, angle);
|
p = rotatePoint(c, {c.x, c.y - r + 10}, angle);
|
||||||
getdisplay().fillCircle(p.x, p.y, 3, commonData.fgcolor);
|
getdisplay().fillCircle(p.x, p.y, 3, commonData->fgcolor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// pointer
|
// pointer
|
||||||
|
@ -208,25 +210,19 @@ class PageFluid : public Page{
|
||||||
{c.x + 6, c.y + 15},
|
{c.x + 6, c.y + 15},
|
||||||
{c.x - 6, c.y + 15}
|
{c.x - 6, c.y + 15}
|
||||||
};
|
};
|
||||||
fillPoly4(rotatePoints(c, pts, -120 + bvalue1->value * 2.4), commonData.fgcolor);
|
fillPoly4(rotatePoints(c, pts, -120 + bvalue1->value * 2.4), commonData->fgcolor);
|
||||||
// Pointer axis is white
|
// Pointer axis is white
|
||||||
getdisplay().fillCircle(c.x, c.y, 6, commonData.bgcolor);
|
getdisplay().fillCircle(c.x, c.y, 6, commonData->bgcolor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Key Layout
|
// Key Layout
|
||||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||||
if(keylock == false){
|
if(commonData->keylock == false){
|
||||||
getdisplay().setCursor(130, 296);
|
|
||||||
getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
|
||||||
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
||||||
getdisplay().setCursor(343, 296);
|
getdisplay().setCursor(343, 296);
|
||||||
getdisplay().print("[ILUM]");
|
getdisplay().print("[ILUM]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
getdisplay().setCursor(130, 296);
|
|
||||||
getdisplay().print(" [ Keylock active ]");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update display
|
// Update display
|
||||||
getdisplay().nextPage(); // Partial update (fast)
|
getdisplay().nextPage(); // Partial update (fast)
|
||||||
|
|
|
@ -5,24 +5,24 @@
|
||||||
|
|
||||||
class PageFourValues : public Page
|
class PageFourValues : public Page
|
||||||
{
|
{
|
||||||
bool keylock = false; // Keylock
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageFourValues(CommonData &common){
|
PageFourValues(CommonData &common){
|
||||||
common.logger->logDebug(GwLog::LOG,"Show PageFourValues");
|
commonData = &common;
|
||||||
|
common.logger->logDebug(GwLog::LOG,"Instantiate PageFourValues");
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int handleKey(int key){
|
virtual int handleKey(int key){
|
||||||
if(key == 11){ // Code for keylock
|
// Code for keylock
|
||||||
keylock = !keylock; // Toggle keylock
|
if(key == 11){
|
||||||
|
commonData->keylock = !commonData->keylock;
|
||||||
return 0; // Commit the key
|
return 0; // Commit the key
|
||||||
}
|
}
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void displayPage(CommonData &commonData, PageData &pageData){
|
virtual void displayPage(PageData &pageData){
|
||||||
GwConfigHandler *config = commonData.config;
|
GwConfigHandler *config = commonData->config;
|
||||||
GwLog *logger=commonData.logger;
|
GwLog *logger = commonData->logger;
|
||||||
|
|
||||||
// Old values for hold function
|
// Old values for hold function
|
||||||
static String svalue1old = "";
|
static String svalue1old = "";
|
||||||
|
@ -47,8 +47,8 @@ class PageFourValues : public Page
|
||||||
name1 = name1.substring(0, 6); // String length limit for value name
|
name1 = name1.substring(0, 6); // String length limit for value name
|
||||||
double value1 = bvalue1->value; // Value as double in SI unit
|
double value1 = bvalue1->value; // Value as double in SI unit
|
||||||
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
|
||||||
|
|
||||||
// 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 (only one value by PageOneValue)
|
||||||
|
@ -56,8 +56,8 @@ class PageFourValues : public Page
|
||||||
name2 = name2.substring(0, 6); // String length limit for value name
|
name2 = name2.substring(0, 6); // String length limit for value name
|
||||||
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
|
||||||
|
|
||||||
// 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]; // Second element in list (only one value by PageOneValue)
|
||||||
|
@ -65,8 +65,8 @@ class PageFourValues : public Page
|
||||||
name3 = name3.substring(0, 6); // String length limit for value name
|
name3 = name3.substring(0, 6); // String length limit for value name
|
||||||
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
|
||||||
|
|
||||||
// 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]; // Second element in list (only one value by PageOneValue)
|
||||||
|
@ -74,8 +74,8 @@ class PageFourValues : public Page
|
||||||
name4 = name4.substring(0, 6); // String length limit for value name
|
name4 = name4.substring(0, 6); // String length limit for value name
|
||||||
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
|
||||||
|
|
||||||
// Optical warning by limit violation (unused)
|
// Optical warning by limit violation (unused)
|
||||||
if(String(flashLED) == "Limit Violation"){
|
if(String(flashLED) == "Limit Violation"){
|
||||||
|
@ -93,7 +93,7 @@ class PageFourValues : public Page
|
||||||
// Set display in partial refresh mode
|
// Set display in partial refresh mode
|
||||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||||
|
|
||||||
getdisplay().setTextColor(commonData.fgcolor);
|
getdisplay().setTextColor(commonData->fgcolor);
|
||||||
|
|
||||||
// ############### Value 1 ################
|
// ############### Value 1 ################
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ class PageFourValues : public Page
|
||||||
// ############### Horizontal Line ################
|
// ############### Horizontal Line ################
|
||||||
|
|
||||||
// Horizontal line 3 pix
|
// Horizontal line 3 pix
|
||||||
getdisplay().fillRect(0, 80, 400, 3, commonData.fgcolor);
|
getdisplay().fillRect(0, 80, 400, 3, commonData->fgcolor);
|
||||||
|
|
||||||
// ############### Value 2 ################
|
// ############### Value 2 ################
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ class PageFourValues : public Page
|
||||||
// ############### Horizontal Line ################
|
// ############### Horizontal Line ################
|
||||||
|
|
||||||
// Horizontal line 3 pix
|
// Horizontal line 3 pix
|
||||||
getdisplay().fillRect(0, 146, 400, 3, commonData.fgcolor);
|
getdisplay().fillRect(0, 146, 400, 3, commonData->fgcolor);
|
||||||
|
|
||||||
// ############### Value 3 ################
|
// ############### Value 3 ################
|
||||||
|
|
||||||
|
@ -237,7 +237,7 @@ class PageFourValues : public Page
|
||||||
// ############### Horizontal Line ################
|
// ############### Horizontal Line ################
|
||||||
|
|
||||||
// Horizontal line 3 pix
|
// Horizontal line 3 pix
|
||||||
getdisplay().fillRect(0, 214, 400, 3, commonData.fgcolor);
|
getdisplay().fillRect(0, 214, 400, 3, commonData->fgcolor);
|
||||||
|
|
||||||
// ############### Value 4 ################
|
// ############### Value 4 ################
|
||||||
|
|
||||||
|
@ -287,18 +287,12 @@ class PageFourValues : public Page
|
||||||
|
|
||||||
// Key Layout
|
// Key Layout
|
||||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||||
if(keylock == false){
|
if(commonData->keylock == false){
|
||||||
getdisplay().setCursor(130, 290);
|
|
||||||
getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
|
||||||
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
||||||
getdisplay().setCursor(343, 290);
|
getdisplay().setCursor(343, 290);
|
||||||
getdisplay().print("[ILUM]");
|
getdisplay().print("[ILUM]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
getdisplay().setCursor(130, 290);
|
|
||||||
getdisplay().print(" [ Keylock active ]");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update display
|
// Update display
|
||||||
getdisplay().nextPage(); // Partial update (fast)
|
getdisplay().nextPage(); // Partial update (fast)
|
||||||
|
|
|
@ -5,24 +5,24 @@
|
||||||
|
|
||||||
class PageFourValues2 : public Page
|
class PageFourValues2 : public Page
|
||||||
{
|
{
|
||||||
bool keylock = false; // Keylock
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageFourValues2(CommonData &common){
|
PageFourValues2(CommonData &common){
|
||||||
common.logger->logDebug(GwLog::LOG,"Show PageFourValues2");
|
commonData = &common;
|
||||||
|
common.logger->logDebug(GwLog::LOG,"Instantiate PageFourValues2");
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int handleKey(int key){
|
virtual int handleKey(int key){
|
||||||
if(key == 11){ // Code for keylock
|
// Code for keylock
|
||||||
keylock = !keylock; // Toggle keylock
|
if(key == 11){
|
||||||
|
commonData->keylock = !commonData->keylock; // Toggle keylock
|
||||||
return 0; // Commit the key
|
return 0; // Commit the key
|
||||||
}
|
}
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void displayPage(CommonData &commonData, PageData &pageData){
|
virtual void displayPage(PageData &pageData){
|
||||||
GwConfigHandler *config = commonData.config;
|
GwConfigHandler *config = commonData->config;
|
||||||
GwLog *logger=commonData.logger;
|
GwLog *logger = commonData->logger;
|
||||||
|
|
||||||
// Old values for hold function
|
// Old values for hold function
|
||||||
static String svalue1old = "";
|
static String svalue1old = "";
|
||||||
|
@ -47,8 +47,8 @@ class PageFourValues2 : public Page
|
||||||
name1 = name1.substring(0, 6); // String length limit for value name
|
name1 = name1.substring(0, 6); // String length limit for value name
|
||||||
double value1 = bvalue1->value; // Value as double in SI unit
|
double value1 = bvalue1->value; // Value as double in SI unit
|
||||||
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
|
||||||
|
|
||||||
// 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 (only one value by PageOneValue)
|
||||||
|
@ -56,8 +56,8 @@ class PageFourValues2 : public Page
|
||||||
name2 = name2.substring(0, 6); // String length limit for value name
|
name2 = name2.substring(0, 6); // String length limit for value name
|
||||||
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
|
||||||
|
|
||||||
// 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]; // Second element in list (only one value by PageOneValue)
|
||||||
|
@ -65,8 +65,8 @@ class PageFourValues2 : public Page
|
||||||
name3 = name3.substring(0, 6); // String length limit for value name
|
name3 = name3.substring(0, 6); // String length limit for value name
|
||||||
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
|
||||||
|
|
||||||
// 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]; // Second element in list (only one value by PageOneValue)
|
||||||
|
@ -74,8 +74,8 @@ class PageFourValues2 : public Page
|
||||||
name4 = name4.substring(0, 6); // String length limit for value name
|
name4 = name4.substring(0, 6); // String length limit for value name
|
||||||
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
|
||||||
|
|
||||||
// Optical warning by limit violation (unused)
|
// Optical warning by limit violation (unused)
|
||||||
if(String(flashLED) == "Limit Violation"){
|
if(String(flashLED) == "Limit Violation"){
|
||||||
|
@ -93,7 +93,7 @@ class PageFourValues2 : public Page
|
||||||
// Set display in partial refresh mode
|
// Set display in partial refresh mode
|
||||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||||
|
|
||||||
getdisplay().setTextColor(commonData.fgcolor);
|
getdisplay().setTextColor(commonData->fgcolor);
|
||||||
|
|
||||||
// ############### Value 1 ################
|
// ############### Value 1 ################
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ class PageFourValues2 : public Page
|
||||||
// ############### Horizontal Line ################
|
// ############### Horizontal Line ################
|
||||||
|
|
||||||
// Horizontal line 3 pix
|
// Horizontal line 3 pix
|
||||||
getdisplay().fillRect(0, 105, 400, 3, commonData.fgcolor);
|
getdisplay().fillRect(0, 105, 400, 3, commonData->fgcolor);
|
||||||
|
|
||||||
// ############### Value 2 ################
|
// ############### Value 2 ################
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ class PageFourValues2 : public Page
|
||||||
// ############### Horizontal Line ################
|
// ############### Horizontal Line ################
|
||||||
|
|
||||||
// Horizontal line 3 pix
|
// Horizontal line 3 pix
|
||||||
getdisplay().fillRect(0, 195, 400, 3, commonData.fgcolor);
|
getdisplay().fillRect(0, 195, 400, 3, commonData->fgcolor);
|
||||||
|
|
||||||
// ############### Value 3 ################
|
// ############### Value 3 ################
|
||||||
|
|
||||||
|
@ -237,7 +237,7 @@ class PageFourValues2 : public Page
|
||||||
// ############### Vertical Line ################
|
// ############### Vertical Line ################
|
||||||
|
|
||||||
// Vertical line 3 pix
|
// Vertical line 3 pix
|
||||||
getdisplay().fillRect(200, 195, 3, 75, commonData.fgcolor);
|
getdisplay().fillRect(200, 195, 3, 75, commonData->fgcolor);
|
||||||
|
|
||||||
// ############### Value 4 ################
|
// ############### Value 4 ################
|
||||||
|
|
||||||
|
@ -287,18 +287,12 @@ class PageFourValues2 : public Page
|
||||||
|
|
||||||
// Key Layout
|
// Key Layout
|
||||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||||
if(keylock == false){
|
if(commonData->keylock == false){
|
||||||
getdisplay().setCursor(130, 290);
|
|
||||||
getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
|
||||||
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
||||||
getdisplay().setCursor(343, 290);
|
getdisplay().setCursor(343, 290);
|
||||||
getdisplay().print("[ILUM]");
|
getdisplay().print("[ILUM]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
getdisplay().setCursor(130, 290);
|
|
||||||
getdisplay().print(" [ Keylock active ]");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update display
|
// Update display
|
||||||
getdisplay().nextPage(); // Partial update (fast)
|
getdisplay().nextPage(); // Partial update (fast)
|
||||||
|
|
|
@ -6,26 +6,24 @@
|
||||||
|
|
||||||
class PageGenerator : public Page
|
class PageGenerator : public Page
|
||||||
{
|
{
|
||||||
bool init = false; // Marker for init done
|
|
||||||
bool keylock = false; // Keylock
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageGenerator(CommonData &common){
|
PageGenerator(CommonData &common){
|
||||||
common.logger->logDebug(GwLog::LOG,"Show PageGenerator");
|
commonData = &common;
|
||||||
|
common.logger->logDebug(GwLog::LOG,"Instantiate PageGenerator");
|
||||||
}
|
}
|
||||||
virtual int handleKey(int key){
|
virtual int handleKey(int key){
|
||||||
// Code for keylock
|
// Code for keylock
|
||||||
if(key == 11){
|
if(key == 11){
|
||||||
keylock = !keylock; // Toggle keylock
|
commonData->keylock = !commonData->keylock;
|
||||||
return 0; // Commit the key
|
return 0; // Commit the key
|
||||||
}
|
}
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void displayPage(CommonData &commonData, PageData &pageData)
|
virtual void displayPage(PageData &pageData)
|
||||||
{
|
{
|
||||||
GwConfigHandler *config = commonData.config;
|
GwConfigHandler *config = commonData->config;
|
||||||
GwLog *logger=commonData.logger;
|
GwLog *logger = commonData->logger;
|
||||||
|
|
||||||
// Get config data
|
// Get config data
|
||||||
bool simulation = config->getBool(config->useSimuData);
|
bool simulation = config->getBool(config->useSimuData);
|
||||||
|
@ -47,13 +45,13 @@ public:
|
||||||
|
|
||||||
// Get raw value for trend indicator
|
// Get raw value for trend indicator
|
||||||
if(powerSensor != "off"){
|
if(powerSensor != "off"){
|
||||||
value1 = commonData.data.generatorVoltage; // Use voltage from external sensor
|
value1 = commonData->data.generatorVoltage; // Use voltage from external sensor
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
value1 = commonData.data.batteryVoltage; // Use internal voltage sensor
|
value1 = commonData->data.batteryVoltage; // Use internal voltage sensor
|
||||||
}
|
}
|
||||||
value2 = commonData.data.generatorCurrent;
|
value2 = commonData->data.generatorCurrent;
|
||||||
value3 = commonData.data.generatorPower;
|
value3 = commonData->data.generatorPower;
|
||||||
genPercentage = value3 * 100 / (double)genPower; // Load value
|
genPercentage = value3 * 100 / (double)genPower; // Load value
|
||||||
// Limits for battery level
|
// Limits for battery level
|
||||||
if(genPercentage < 0) genPercentage = 0;
|
if(genPercentage < 0) genPercentage = 0;
|
||||||
|
@ -87,7 +85,7 @@ public:
|
||||||
// Set display in partial refresh mode
|
// Set display in partial refresh mode
|
||||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||||
|
|
||||||
getdisplay().setTextColor(commonData.fgcolor);
|
getdisplay().setTextColor(commonData->fgcolor);
|
||||||
|
|
||||||
// Show name
|
// Show name
|
||||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||||
|
@ -124,7 +122,7 @@ public:
|
||||||
getdisplay().print("Power Modul");
|
getdisplay().print("Power Modul");
|
||||||
|
|
||||||
// Show generator
|
// Show generator
|
||||||
generatorGraphic(200, 95, commonData.fgcolor, commonData.bgcolor);
|
generatorGraphic(200, 95, commonData->fgcolor, commonData->bgcolor);
|
||||||
|
|
||||||
// Show load level in percent
|
// Show load level in percent
|
||||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||||
|
@ -207,18 +205,12 @@ public:
|
||||||
|
|
||||||
// Key Layout
|
// Key Layout
|
||||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||||
if(keylock == false){
|
if(commonData->keylock == false){
|
||||||
getdisplay().setCursor(130, 290);
|
|
||||||
getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
|
||||||
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
||||||
getdisplay().setCursor(343, 290);
|
getdisplay().setCursor(343, 290);
|
||||||
getdisplay().print("[ILUM]");
|
getdisplay().print("[ILUM]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
getdisplay().setCursor(130, 290);
|
|
||||||
getdisplay().print(" [ Keylock active ]");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update display
|
// Update display
|
||||||
getdisplay().nextPage(); // Partial update (fast)
|
getdisplay().nextPage(); // Partial update (fast)
|
||||||
|
|
|
@ -5,27 +5,26 @@
|
||||||
|
|
||||||
class PageKeelPosition : public Page
|
class PageKeelPosition : public Page
|
||||||
{
|
{
|
||||||
bool keylock = false; // Keylock
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageKeelPosition(CommonData &common){
|
PageKeelPosition(CommonData &common){
|
||||||
common.logger->logDebug(GwLog::LOG,"Show PageKeelPosition");
|
commonData = &common;
|
||||||
|
common.logger->logDebug(GwLog::LOG,"Instantiate PageKeelPosition");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Key functions
|
// Key functions
|
||||||
virtual int handleKey(int key){
|
virtual int handleKey(int key){
|
||||||
// Keylock function
|
// Code for keylock
|
||||||
if(key == 11){ // Code for keylock
|
if(key == 11){
|
||||||
keylock = !keylock; // Toggle keylock
|
commonData->keylock = !commonData->keylock;
|
||||||
return 0; // Commit the key
|
return 0; // Commit the key
|
||||||
}
|
}
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void displayPage(CommonData &commonData, PageData &pageData)
|
virtual void displayPage(PageData &pageData)
|
||||||
{
|
{
|
||||||
GwConfigHandler *config = commonData.config;
|
GwConfigHandler *config = commonData->config;
|
||||||
GwLog *logger=commonData.logger;
|
GwLog *logger = commonData->logger;
|
||||||
|
|
||||||
double value1 = 0;
|
double value1 = 0;
|
||||||
double value1old = 0;
|
double value1old = 0;
|
||||||
|
@ -40,9 +39,9 @@ public:
|
||||||
String rotfunction = config->getString(config->rotFunction);
|
String rotfunction = config->getString(config->rotFunction);
|
||||||
|
|
||||||
// Get boat values for Keel position
|
// Get boat values for Keel position
|
||||||
bool valid1 = commonData.data.validRotAngle; // Valid information
|
bool valid1 = commonData->data.validRotAngle; // Valid information
|
||||||
if(simulation == false && rotsensor == "AS5600" && rotfunction == "Keel"){
|
if(simulation == false && rotsensor == "AS5600" && rotfunction == "Keel"){
|
||||||
value1 = commonData.data.rotationAngle; // Raw value without unit convertion
|
value1 = commonData->data.rotationAngle; // Raw value without unit convertion
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
value1 = 0;
|
value1 = 0;
|
||||||
|
@ -77,9 +76,9 @@ public:
|
||||||
int rInstrument = 110; // Radius of KeelPosition
|
int rInstrument = 110; // Radius of KeelPosition
|
||||||
float pi = 3.141592;
|
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
|
||||||
getdisplay().fillRect(0, 30, 400, 122, commonData.bgcolor); // Delete half top circle
|
getdisplay().fillRect(0, 30, 400, 122, commonData->bgcolor); // Delete half top circle
|
||||||
|
|
||||||
for(int i=90; i<=270; i=i+10)
|
for(int i=90; i<=270; i=i+10)
|
||||||
{
|
{
|
||||||
|
@ -117,7 +116,7 @@ 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*pi);
|
||||||
float y1c = 150 - rInstrument*cos(i/180.0*pi);
|
float y1c = 150 - rInstrument*cos(i/180.0*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*pi);
|
||||||
float cosx=cos(i/180.0*pi);
|
float cosx=cos(i/180.0*pi);
|
||||||
|
|
||||||
|
@ -130,10 +129,10 @@ public:
|
||||||
float yy2 = -(rInstrument+10);
|
float yy2 = -(rInstrument+10);
|
||||||
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*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),commonData.fgcolor);
|
200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),commonData->fgcolor);
|
||||||
getdisplay().fillTriangle(200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
getdisplay().fillTriangle(200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
||||||
200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),
|
200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),
|
||||||
200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),commonData.fgcolor);
|
200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),commonData->fgcolor);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -167,7 +166,7 @@ public:
|
||||||
float yy2 = -(rInstrument * 0.6);
|
float yy2 = -(rInstrument * 0.6);
|
||||||
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);
|
||||||
// Inverted pointer
|
// Inverted pointer
|
||||||
// Pointer as triangle with center base 2*width
|
// Pointer as triangle with center base 2*width
|
||||||
float endwidth = 2; // End width of pointer
|
float endwidth = 2; // End width of pointer
|
||||||
|
@ -177,17 +176,17 @@ public:
|
||||||
float iy2 = -endwidth;
|
float iy2 = -endwidth;
|
||||||
getdisplay().fillTriangle(200+(int)(cosx*ix1-sinx*iy1),150+(int)(sinx*ix1+cosx*iy1),
|
getdisplay().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*ix2-sinx*iy1),150+(int)(sinx*ix2+cosx*iy1),
|
||||||
200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData.fgcolor);
|
200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData->fgcolor);
|
||||||
|
|
||||||
// Draw counterweight
|
// Draw counterweight
|
||||||
getdisplay().fillCircle(200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2), 5, commonData.fgcolor);
|
getdisplay().fillCircle(200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2), 5, commonData->fgcolor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Center circle
|
// Center circle
|
||||||
getdisplay().fillCircle(200, 140, startwidth + 22, commonData.bgcolor);
|
getdisplay().fillCircle(200, 140, startwidth + 22, commonData->bgcolor);
|
||||||
getdisplay().fillCircle(200, 140, startwidth + 20, commonData.fgcolor); // Boat circle
|
getdisplay().fillCircle(200, 140, startwidth + 20, commonData->fgcolor); // Boat circle
|
||||||
getdisplay().fillRect(200 - 30, 140 - 30, 2 * 30, 30, commonData.bgcolor); // Delete half top of boat circle
|
getdisplay().fillRect(200 - 30, 140 - 30, 2 * 30, 30, commonData->bgcolor); // Delete half top of boat circle
|
||||||
getdisplay().fillRect(150, 150, 100, 4, commonData.fgcolor); // Water line
|
getdisplay().fillRect(150, 150, 100, 4, commonData->fgcolor); // Water line
|
||||||
|
|
||||||
// Print label
|
// Print label
|
||||||
getdisplay().setFont(&Ubuntu_Bold16pt7b);
|
getdisplay().setFont(&Ubuntu_Bold16pt7b);
|
||||||
|
@ -210,18 +209,12 @@ public:
|
||||||
//*******************************************************************************************
|
//*******************************************************************************************
|
||||||
// Key Layout
|
// Key Layout
|
||||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||||
if(keylock == false){
|
if(commonData->keylock == false){
|
||||||
getdisplay().setCursor(130, 290);
|
|
||||||
getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
|
||||||
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
||||||
getdisplay().setCursor(343, 290);
|
getdisplay().setCursor(343, 290);
|
||||||
getdisplay().print("[ILUM]");
|
getdisplay().print("[ILUM]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
getdisplay().setCursor(130, 290);
|
|
||||||
getdisplay().print(" [ Keylock active ]");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update display
|
// Update display
|
||||||
getdisplay().nextPage(); // Partial update (fast)
|
getdisplay().nextPage(); // Partial update (fast)
|
||||||
|
|
|
@ -3,25 +3,26 @@
|
||||||
#include "Pagedata.h"
|
#include "Pagedata.h"
|
||||||
#include "OBP60Extensions.h"
|
#include "OBP60Extensions.h"
|
||||||
|
|
||||||
class PageOneValue : public Page{
|
class PageOneValue : public Page
|
||||||
bool keylock = false; // Keylock
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageOneValue(CommonData &common){
|
PageOneValue(CommonData &common){
|
||||||
common.logger->logDebug(GwLog::LOG,"Show PageOneValue");
|
commonData = &common;
|
||||||
|
common.logger->logDebug(GwLog::LOG,"Instantiate PageOneValue");
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int handleKey(int key){
|
virtual int handleKey(int key){
|
||||||
if(key == 11){ // Code for keylock
|
// Code for keylock
|
||||||
keylock = !keylock; // Toggle keylock
|
if(key == 11){
|
||||||
|
commonData->keylock = !commonData->keylock;
|
||||||
return 0; // Commit the key
|
return 0; // Commit the key
|
||||||
}
|
}
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void displayPage(CommonData &commonData, PageData &pageData){
|
virtual void displayPage(PageData &pageData){
|
||||||
GwConfigHandler *config = commonData.config;
|
GwConfigHandler *config = commonData->config;
|
||||||
GwLog *logger=commonData.logger;
|
GwLog *logger = commonData->logger;
|
||||||
|
|
||||||
// Old values for hold function
|
// Old values for hold function
|
||||||
static String svalue1old = "";
|
static String svalue1old = "";
|
||||||
|
@ -40,8 +41,8 @@ class PageOneValue : public Page{
|
||||||
name1 = name1.substring(0, 6); // String length limit for value name
|
name1 = name1.substring(0, 6); // String length limit for value name
|
||||||
double value1 = bvalue1->value; // Value as double in SI unit
|
double value1 = bvalue1->value; // Value as double in SI unit
|
||||||
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
|
||||||
|
|
||||||
// Optical warning by limit violation (unused)
|
// Optical warning by limit violation (unused)
|
||||||
if(String(flashLED) == "Limit Violation"){
|
if(String(flashLED) == "Limit Violation"){
|
||||||
|
@ -60,7 +61,7 @@ class PageOneValue : public Page{
|
||||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||||
|
|
||||||
// Show name
|
// Show name
|
||||||
getdisplay().setTextColor(commonData.fgcolor);
|
getdisplay().setTextColor(commonData->fgcolor);
|
||||||
getdisplay().setFont(&Ubuntu_Bold32pt7b);
|
getdisplay().setFont(&Ubuntu_Bold32pt7b);
|
||||||
getdisplay().setCursor(20, 100);
|
getdisplay().setCursor(20, 100);
|
||||||
getdisplay().print(name1); // Page name
|
getdisplay().print(name1); // Page name
|
||||||
|
@ -103,18 +104,12 @@ class PageOneValue : public Page{
|
||||||
|
|
||||||
// Key Layout
|
// Key Layout
|
||||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||||
if(keylock == false){
|
if(commonData->keylock == false){
|
||||||
getdisplay().setCursor(130, 290);
|
|
||||||
getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
|
||||||
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
||||||
getdisplay().setCursor(343, 290);
|
getdisplay().setCursor(343, 290);
|
||||||
getdisplay().print("[ILUM]");
|
getdisplay().print("[ILUM]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
getdisplay().setCursor(130, 290);
|
|
||||||
getdisplay().print(" [ Keylock active ]");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update display
|
// Update display
|
||||||
getdisplay().nextPage(); // Partial update (fast)
|
getdisplay().nextPage(); // Partial update (fast)
|
||||||
|
|
|
@ -5,27 +5,25 @@
|
||||||
|
|
||||||
class PageRollPitch : public Page
|
class PageRollPitch : public Page
|
||||||
{
|
{
|
||||||
bool keylock = false; // Keylock
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageRollPitch(CommonData &common){
|
PageRollPitch(CommonData &common){
|
||||||
common.logger->logDebug(GwLog::LOG,"Show PageRollPitch");
|
commonData = &common;
|
||||||
|
common.logger->logDebug(GwLog::LOG,"Instantiate PageRollPitch");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Key functions
|
// Key functions
|
||||||
virtual int handleKey(int key){
|
virtual int handleKey(int key){
|
||||||
// Keylock function
|
// Code for keylock
|
||||||
if(key == 11){ // Code for keylock
|
if(key == 11){
|
||||||
keylock = !keylock; // Toggle keylock
|
commonData->keylock = !commonData->keylock;
|
||||||
return 0; // Commit the key
|
return 0; // Commit the key
|
||||||
}
|
}
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void displayPage(CommonData &commonData, PageData &pageData)
|
virtual void displayPage(PageData &pageData){
|
||||||
{
|
GwConfigHandler *config = commonData->config;
|
||||||
GwConfigHandler *config = commonData.config;
|
GwLog *logger = commonData->logger;
|
||||||
GwLog *logger=commonData.logger;
|
|
||||||
|
|
||||||
double value1 = 0;
|
double value1 = 0;
|
||||||
double value2 = 0;
|
double value2 = 0;
|
||||||
|
@ -120,7 +118,7 @@ public:
|
||||||
// Set display in partial refresh mode
|
// Set display in partial refresh mode
|
||||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||||
|
|
||||||
getdisplay().setTextColor(commonData.fgcolor);
|
getdisplay().setTextColor(commonData->fgcolor);
|
||||||
|
|
||||||
// Show roll limit
|
// Show roll limit
|
||||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||||
|
@ -136,7 +134,7 @@ public:
|
||||||
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);
|
||||||
|
|
||||||
// Show roll value
|
// Show roll value
|
||||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||||
|
@ -151,7 +149,7 @@ public:
|
||||||
getdisplay().print("Deg");
|
getdisplay().print("Deg");
|
||||||
|
|
||||||
// Horizintal separator right
|
// Horizintal separator right
|
||||||
getdisplay().fillRect(340, 149, 80, 3, commonData.fgcolor);
|
getdisplay().fillRect(340, 149, 80, 3, commonData->fgcolor);
|
||||||
|
|
||||||
// Show pitch value
|
// Show pitch value
|
||||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||||
|
@ -171,8 +169,8 @@ public:
|
||||||
int rInstrument = 100; // Radius of instrument
|
int rInstrument = 100; // Radius of instrument
|
||||||
float pi = 3.141592;
|
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
|
||||||
|
|
||||||
for(int i=0; i<360; i=i+10)
|
for(int i=0; i<360; i=i+10)
|
||||||
{
|
{
|
||||||
|
@ -207,7 +205,7 @@ 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*pi);
|
||||||
float y1c = 150 - rInstrument*cos(i/180.0*pi);
|
float y1c = 150 - rInstrument*cos(i/180.0*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*pi);
|
||||||
float cosx=cos(i/180.0*pi);
|
float cosx=cos(i/180.0*pi);
|
||||||
|
|
||||||
|
@ -220,10 +218,10 @@ public:
|
||||||
float yy2 = -(rInstrument+10);
|
float yy2 = -(rInstrument+10);
|
||||||
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*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),commonData.fgcolor);
|
200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),commonData->fgcolor);
|
||||||
getdisplay().fillTriangle(200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
getdisplay().fillTriangle(200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
||||||
200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),
|
200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),
|
||||||
200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),commonData.fgcolor);
|
200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),commonData->fgcolor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -244,7 +242,7 @@ public:
|
||||||
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);
|
||||||
// Inverted pointer
|
// Inverted pointer
|
||||||
// Pointer as triangle with center base 2*width
|
// Pointer as triangle with center base 2*width
|
||||||
float endwidth = 2; // End width of pointer
|
float endwidth = 2; // End width of pointer
|
||||||
|
@ -254,26 +252,26 @@ public:
|
||||||
float iy2 = -endwidth;
|
float iy2 = -endwidth;
|
||||||
getdisplay().fillTriangle(200+(int)(cosx*ix1-sinx*iy1),150+(int)(sinx*ix1+cosx*iy1),
|
getdisplay().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*ix2-sinx*iy1),150+(int)(sinx*ix2+cosx*iy1),
|
||||||
200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData.fgcolor);
|
200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData->fgcolor);
|
||||||
|
|
||||||
// Draw counterweight
|
// Draw counterweight
|
||||||
getdisplay().fillCircle(200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2), 5, commonData.fgcolor);
|
getdisplay().fillCircle(200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2), 5, commonData->fgcolor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Center circle
|
// Center circle
|
||||||
getdisplay().fillCircle(200, 150, startwidth + 22, commonData.bgcolor);
|
getdisplay().fillCircle(200, 150, startwidth + 22, commonData->bgcolor);
|
||||||
getdisplay().fillCircle(200, 150, startwidth + 20, commonData.fgcolor); // Boat circle
|
getdisplay().fillCircle(200, 150, startwidth + 20, commonData->fgcolor); // Boat circle
|
||||||
int x0 = 200;
|
int x0 = 200;
|
||||||
int y0 = 150;
|
int y0 = 150;
|
||||||
int x1 = x0 + 50*cos(value1);
|
int x1 = x0 + 50*cos(value1);
|
||||||
int y1 = y0 + 50*sin(value1);
|
int y1 = y0 + 50*sin(value1);
|
||||||
int x2 = x0 + 50*cos(value1 - pi/2);
|
int x2 = x0 + 50*cos(value1 - pi/2);
|
||||||
int y2 = y0 + 50*sin(value1 - pi/2);
|
int y2 = y0 + 50*sin(value1 - pi/2);
|
||||||
getdisplay().fillTriangle(x0, y0, x1, y1, x2, y2, commonData.bgcolor); // Clear half top side of boat circle (right triangle)
|
getdisplay().fillTriangle(x0, y0, x1, y1, x2, y2, commonData->bgcolor); // Clear half top side of boat circle (right triangle)
|
||||||
x1 = x0 + 50*cos(value1 + pi);
|
x1 = x0 + 50*cos(value1 + pi);
|
||||||
y1 = y0 + 50*sin(value1 + pi);
|
y1 = y0 + 50*sin(value1 + pi);
|
||||||
getdisplay().fillTriangle(x0, y0, x1, y1, x2, y2, commonData.bgcolor); // Clear half top side of boat circle (left triangle)
|
getdisplay().fillTriangle(x0, y0, x1, y1, x2, y2, commonData->bgcolor); // Clear half top side of boat circle (left triangle)
|
||||||
getdisplay().fillRect(150, 160, 100, 4, commonData.fgcolor); // Water line
|
getdisplay().fillRect(150, 160, 100, 4, commonData->fgcolor); // Water line
|
||||||
|
|
||||||
// Draw roll pointer
|
// Draw roll pointer
|
||||||
startwidth = 4; // Start width of pointer
|
startwidth = 4; // Start width of pointer
|
||||||
|
@ -288,7 +286,7 @@ public:
|
||||||
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);
|
||||||
// Inverted pointer
|
// Inverted pointer
|
||||||
// Pointer as triangle with center base 2*width
|
// Pointer as triangle with center base 2*width
|
||||||
float endwidth = 2; // End width of pointer
|
float endwidth = 2; // End width of pointer
|
||||||
|
@ -298,7 +296,7 @@ public:
|
||||||
float iy2 = -endwidth;
|
float iy2 = -endwidth;
|
||||||
getdisplay().fillTriangle(200+(int)(cosx*ix1-sinx*iy1),150+(int)(sinx*ix1+cosx*iy1),
|
getdisplay().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*ix2-sinx*iy1),150+(int)(sinx*ix2+cosx*iy1),
|
||||||
200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData.fgcolor);
|
200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData->fgcolor);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
// Print sensor info
|
// Print sensor info
|
||||||
|
@ -310,18 +308,12 @@ public:
|
||||||
//*******************************************************************************************
|
//*******************************************************************************************
|
||||||
// Key Layout
|
// Key Layout
|
||||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||||
if(keylock == false){
|
if(commonData->keylock == false){
|
||||||
getdisplay().setCursor(130, 290);
|
|
||||||
getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
|
||||||
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
||||||
getdisplay().setCursor(343, 290);
|
getdisplay().setCursor(343, 290);
|
||||||
getdisplay().print("[ILUM]");
|
getdisplay().print("[ILUM]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
getdisplay().setCursor(130, 290);
|
|
||||||
getdisplay().print(" [ Keylock active ]");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update display
|
// Update display
|
||||||
getdisplay().nextPage(); // Partial update (fast)
|
getdisplay().nextPage(); // Partial update (fast)
|
||||||
|
|
|
@ -5,27 +5,25 @@
|
||||||
|
|
||||||
class PageRudderPosition : public Page
|
class PageRudderPosition : public Page
|
||||||
{
|
{
|
||||||
bool keylock = false; // Keylock
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageRudderPosition(CommonData &common){
|
PageRudderPosition(CommonData &common){
|
||||||
|
commonData = &common;
|
||||||
common.logger->logDebug(GwLog::LOG,"Show PageRudderPosition");
|
common.logger->logDebug(GwLog::LOG,"Show PageRudderPosition");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Key functions
|
// Key functions
|
||||||
virtual int handleKey(int key){
|
virtual int handleKey(int key){
|
||||||
// Keylock function
|
// Code for keylock
|
||||||
if(key == 11){ // Code for keylock
|
if(key == 11){
|
||||||
keylock = !keylock; // Toggle keylock
|
commonData->keylock = !commonData->keylock;
|
||||||
return 0; // Commit the key
|
return 0; // Commit the key
|
||||||
}
|
}
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void displayPage(CommonData &commonData, PageData &pageData)
|
virtual void displayPage(PageData &pageData){
|
||||||
{
|
GwConfigHandler *config = commonData->config;
|
||||||
GwConfigHandler *config = commonData.config;
|
GwLog *logger = commonData->logger;
|
||||||
GwLog *logger=commonData.logger;
|
|
||||||
|
|
||||||
static String unit1old = "";
|
static String unit1old = "";
|
||||||
double value1 = 0.1;
|
double value1 = 0.1;
|
||||||
|
@ -44,8 +42,8 @@ public:
|
||||||
name1 = name1.substring(0, 6); // String length limit for value name
|
name1 = name1.substring(0, 6); // String length limit for value name
|
||||||
value1 = bvalue1->value; // Raw value without unit convertion
|
value1 = bvalue1->value; // Raw value without unit convertion
|
||||||
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
|
||||||
if(valid1 == true){
|
if(valid1 == true){
|
||||||
value1old = value1; // Save old value
|
value1old = value1; // Save old value
|
||||||
unit1old = unit1; // Save old unit
|
unit1old = unit1; // Save old unit
|
||||||
|
@ -82,9 +80,9 @@ public:
|
||||||
int rInstrument = 110; // Radius of RudderPosition
|
int rInstrument = 110; // Radius of RudderPosition
|
||||||
float pi = 3.141592;
|
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
|
||||||
getdisplay().fillRect(0, 30, 400, 122, commonData.bgcolor); // Delete half top circle
|
getdisplay().fillRect(0, 30, 400, 122, commonData->bgcolor); // Delete half top circle
|
||||||
|
|
||||||
for(int i=90; i<=270; i=i+10)
|
for(int i=90; i<=270; i=i+10)
|
||||||
{
|
{
|
||||||
|
@ -122,7 +120,7 @@ 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*pi);
|
||||||
float y1c = 150 - rInstrument*cos(i/180.0*pi);
|
float y1c = 150 - rInstrument*cos(i/180.0*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*pi);
|
||||||
float cosx=cos(i/180.0*pi);
|
float cosx=cos(i/180.0*pi);
|
||||||
|
|
||||||
|
@ -135,10 +133,10 @@ public:
|
||||||
float yy2 = -(rInstrument+10);
|
float yy2 = -(rInstrument+10);
|
||||||
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*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),commonData.fgcolor);
|
200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),commonData->fgcolor);
|
||||||
getdisplay().fillTriangle(200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
getdisplay().fillTriangle(200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
||||||
200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),
|
200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),
|
||||||
200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),commonData.fgcolor);
|
200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),commonData->fgcolor);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -190,7 +188,7 @@ public:
|
||||||
float yy2 = -(rInstrument * 0.5);
|
float yy2 = -(rInstrument * 0.5);
|
||||||
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);
|
||||||
// Inverted pointer
|
// Inverted pointer
|
||||||
// Pointer as triangle with center base 2*width
|
// Pointer as triangle with center base 2*width
|
||||||
float endwidth = 2; // End width of pointer
|
float endwidth = 2; // End width of pointer
|
||||||
|
@ -200,28 +198,22 @@ public:
|
||||||
float iy2 = -endwidth;
|
float iy2 = -endwidth;
|
||||||
getdisplay().fillTriangle(200+(int)(cosx*ix1-sinx*iy1),150+(int)(sinx*ix1+cosx*iy1),
|
getdisplay().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*ix2-sinx*iy1),150+(int)(sinx*ix2+cosx*iy1),
|
||||||
200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData.fgcolor);
|
200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData->fgcolor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Center circle
|
// Center circle
|
||||||
getdisplay().fillCircle(200, 150, startwidth + 6, commonData.bgcolor);
|
getdisplay().fillCircle(200, 150, startwidth + 6, commonData->bgcolor);
|
||||||
getdisplay().fillCircle(200, 150, startwidth + 4, commonData.fgcolor);
|
getdisplay().fillCircle(200, 150, startwidth + 4, commonData->fgcolor);
|
||||||
|
|
||||||
//*******************************************************************************************
|
//*******************************************************************************************
|
||||||
// Key Layout
|
// Key Layout
|
||||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||||
if(keylock == false){
|
if(commonData->keylock == false){
|
||||||
getdisplay().setCursor(130, 290);
|
|
||||||
getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
|
||||||
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
||||||
getdisplay().setCursor(343, 290);
|
getdisplay().setCursor(343, 290);
|
||||||
getdisplay().print("[ILUM]");
|
getdisplay().print("[ILUM]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
getdisplay().setCursor(130, 290);
|
|
||||||
getdisplay().print(" [ Keylock active ]");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update display
|
// Update display
|
||||||
getdisplay().nextPage(); // Partial update (fast)
|
getdisplay().nextPage(); // Partial update (fast)
|
||||||
|
|
|
@ -6,26 +6,23 @@
|
||||||
|
|
||||||
class PageSolar : public Page
|
class PageSolar : public Page
|
||||||
{
|
{
|
||||||
bool init = false; // Marker for init done
|
|
||||||
bool keylock = false; // Keylock
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageSolar(CommonData &common){
|
PageSolar(CommonData &common){
|
||||||
common.logger->logDebug(GwLog::LOG,"Show PageSolar");
|
commonData = &common;
|
||||||
|
common.logger->logDebug(GwLog::LOG,"Instantiate PageSolar");
|
||||||
}
|
}
|
||||||
virtual int handleKey(int key){
|
virtual int handleKey(int key){
|
||||||
// Code for keylock
|
// Code for keylock
|
||||||
if(key == 11){
|
if(key == 11){
|
||||||
keylock = !keylock; // Toggle keylock
|
commonData->keylock = !commonData->keylock;
|
||||||
return 0; // Commit the key
|
return 0; // Commit the key
|
||||||
}
|
}
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void displayPage(CommonData &commonData, PageData &pageData)
|
virtual void displayPage(PageData &pageData){
|
||||||
{
|
GwConfigHandler *config = commonData->config;
|
||||||
GwConfigHandler *config = commonData.config;
|
GwLog *logger = commonData->logger;
|
||||||
GwLog *logger=commonData.logger;
|
|
||||||
|
|
||||||
// Get config data
|
// Get config data
|
||||||
bool simulation = config->getBool(config->useSimuData);
|
bool simulation = config->getBool(config->useSimuData);
|
||||||
|
@ -47,13 +44,13 @@ public:
|
||||||
|
|
||||||
// Get raw value for trend indicator
|
// Get raw value for trend indicator
|
||||||
if(powerSensor != "off"){
|
if(powerSensor != "off"){
|
||||||
value1 = commonData.data.solarVoltage; // Use voltage from external sensor
|
value1 = commonData->data.solarVoltage; // Use voltage from external sensor
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
value1 = commonData.data.batteryVoltage; // Use internal voltage sensor
|
value1 = commonData->data.batteryVoltage; // Use internal voltage sensor
|
||||||
}
|
}
|
||||||
value2 = commonData.data.solarCurrent;
|
value2 = commonData->data.solarCurrent;
|
||||||
value3 = commonData.data.solarPower;
|
value3 = commonData->data.solarPower;
|
||||||
solPercentage = value3 * 100 / (double)solPower; // Load value
|
solPercentage = value3 * 100 / (double)solPower; // Load value
|
||||||
// Limits for battery level
|
// Limits for battery level
|
||||||
if(solPercentage < 0) solPercentage = 0;
|
if(solPercentage < 0) solPercentage = 0;
|
||||||
|
@ -87,7 +84,7 @@ public:
|
||||||
// Set display in partial refresh mode
|
// Set display in partial refresh mode
|
||||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||||
|
|
||||||
getdisplay().setTextColor(commonData.fgcolor);
|
getdisplay().setTextColor(commonData->fgcolor);
|
||||||
|
|
||||||
// Show name
|
// Show name
|
||||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||||
|
@ -121,7 +118,7 @@ public:
|
||||||
getdisplay().print("Solar Modul");
|
getdisplay().print("Solar Modul");
|
||||||
|
|
||||||
// Show solar panel
|
// Show solar panel
|
||||||
solarGraphic(150, 45, commonData.fgcolor, commonData.bgcolor);
|
solarGraphic(150, 45, commonData->fgcolor, commonData->bgcolor);
|
||||||
|
|
||||||
// Show load level in percent
|
// Show load level in percent
|
||||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||||
|
@ -204,18 +201,12 @@ public:
|
||||||
|
|
||||||
// Key Layout
|
// Key Layout
|
||||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||||
if(keylock == false){
|
if(commonData->keylock == false){
|
||||||
getdisplay().setCursor(130, 290);
|
|
||||||
getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
|
||||||
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
||||||
getdisplay().setCursor(343, 290);
|
getdisplay().setCursor(343, 290);
|
||||||
getdisplay().print("[ILUM]");
|
getdisplay().print("[ILUM]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
getdisplay().setCursor(130, 290);
|
|
||||||
getdisplay().print(" [ Keylock active ]");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update display
|
// Update display
|
||||||
getdisplay().nextPage(); // Partial update (fast)
|
getdisplay().nextPage(); // Partial update (fast)
|
||||||
|
|
|
@ -5,24 +5,24 @@
|
||||||
|
|
||||||
class PageThreeValues : public Page
|
class PageThreeValues : public Page
|
||||||
{
|
{
|
||||||
bool keylock = false; // Keylock
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageThreeValues(CommonData &common){
|
PageThreeValues(CommonData &common){
|
||||||
common.logger->logDebug(GwLog::LOG,"Show PageThreeValue");
|
commonData = &common;
|
||||||
|
common.logger->logDebug(GwLog::LOG,"Instantiate PageThreeValue");
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int handleKey(int key){
|
virtual int handleKey(int key){
|
||||||
if(key == 11){ // Code for keylock
|
// Code for keylock
|
||||||
keylock = !keylock; // Toggle keylock
|
if(key == 11){
|
||||||
|
commonData->keylock = !commonData->keylock;
|
||||||
return 0; // Commit the key
|
return 0; // Commit the key
|
||||||
}
|
}
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void displayPage(CommonData &commonData, PageData &pageData){
|
virtual void displayPage(PageData &pageData){
|
||||||
GwConfigHandler *config = commonData.config;
|
GwConfigHandler *config = commonData->config;
|
||||||
GwLog *logger=commonData.logger;
|
GwLog *logger = commonData->logger;
|
||||||
|
|
||||||
// Old values for hold function
|
// Old values for hold function
|
||||||
static String svalue1old = "";
|
static String svalue1old = "";
|
||||||
|
@ -45,8 +45,8 @@ class PageThreeValues : public Page
|
||||||
name1 = name1.substring(0, 6); // String length limit for value name
|
name1 = name1.substring(0, 6); // String length limit for value name
|
||||||
double value1 = bvalue1->value; // Value as double in SI unit
|
double value1 = bvalue1->value; // Value as double in SI unit
|
||||||
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
|
||||||
|
|
||||||
// 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 (only one value by PageOneValue)
|
||||||
|
@ -54,8 +54,8 @@ class PageThreeValues : public Page
|
||||||
name2 = name2.substring(0, 6); // String length limit for value name
|
name2 = name2.substring(0, 6); // String length limit for value name
|
||||||
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
|
||||||
|
|
||||||
// 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]; // Second element in list (only one value by PageOneValue)
|
||||||
|
@ -63,8 +63,8 @@ class PageThreeValues : public Page
|
||||||
name3 = name3.substring(0, 6); // String length limit for value name
|
name3 = name3.substring(0, 6); // String length limit for value name
|
||||||
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
|
||||||
|
|
||||||
// Optical warning by limit violation (unused)
|
// Optical warning by limit violation (unused)
|
||||||
if(String(flashLED) == "Limit Violation"){
|
if(String(flashLED) == "Limit Violation"){
|
||||||
|
@ -85,7 +85,7 @@ class PageThreeValues : public Page
|
||||||
// ############### Value 1 ################
|
// ############### Value 1 ################
|
||||||
|
|
||||||
// Show name
|
// Show name
|
||||||
getdisplay().setTextColor(commonData.fgcolor);
|
getdisplay().setTextColor(commonData->fgcolor);
|
||||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||||
getdisplay().setCursor(20, 55);
|
getdisplay().setCursor(20, 55);
|
||||||
getdisplay().print(name1); // Page name
|
getdisplay().print(name1); // Page name
|
||||||
|
@ -129,7 +129,7 @@ class PageThreeValues : public Page
|
||||||
// ############### Horizontal Line ################
|
// ############### Horizontal Line ################
|
||||||
|
|
||||||
// Horizontal line 3 pix
|
// Horizontal line 3 pix
|
||||||
getdisplay().fillRect(0, 105, 400, 3, commonData.fgcolor);
|
getdisplay().fillRect(0, 105, 400, 3, commonData->fgcolor);
|
||||||
|
|
||||||
// ############### Value 2 ################
|
// ############### Value 2 ################
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ class PageThreeValues : public Page
|
||||||
// ############### Horizontal Line ################
|
// ############### Horizontal Line ################
|
||||||
|
|
||||||
// Horizontal line 3 pix
|
// Horizontal line 3 pix
|
||||||
getdisplay().fillRect(0, 195, 400, 3, commonData.fgcolor);
|
getdisplay().fillRect(0, 195, 400, 3, commonData->fgcolor);
|
||||||
|
|
||||||
// ############### Value 3 ################
|
// ############### Value 3 ################
|
||||||
|
|
||||||
|
@ -227,18 +227,12 @@ class PageThreeValues : public Page
|
||||||
|
|
||||||
// Key Layout
|
// Key Layout
|
||||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||||
if(keylock == false){
|
if(commonData->keylock == false){
|
||||||
getdisplay().setCursor(130, 290);
|
|
||||||
getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
|
||||||
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
||||||
getdisplay().setCursor(343, 290);
|
getdisplay().setCursor(343, 290);
|
||||||
getdisplay().print("[ILUM]");
|
getdisplay().print("[ILUM]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
getdisplay().setCursor(130, 290);
|
|
||||||
getdisplay().print(" [ Keylock active ]");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update display
|
// Update display
|
||||||
getdisplay().nextPage(); // Partial update (fast)
|
getdisplay().nextPage(); // Partial update (fast)
|
||||||
|
|
|
@ -5,24 +5,24 @@
|
||||||
|
|
||||||
class PageTwoValues : public Page
|
class PageTwoValues : public Page
|
||||||
{
|
{
|
||||||
bool keylock = false; // Keylock
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageTwoValues(CommonData &common){
|
PageTwoValues(CommonData &common){
|
||||||
common.logger->logDebug(GwLog::LOG,"Show PageTwoValue");
|
commonData = &common;
|
||||||
|
common.logger->logDebug(GwLog::LOG,"Instantiate PageTwoValue");
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int handleKey(int key){
|
virtual int handleKey(int key){
|
||||||
if(key == 11){ // Code for keylock
|
// Code for keylock
|
||||||
keylock = !keylock; // Toggle keylock
|
if(key == 11){
|
||||||
|
commonData->keylock = !commonData->keylock;
|
||||||
return 0; // Commit the key
|
return 0; // Commit the key
|
||||||
}
|
}
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void displayPage(CommonData &commonData, PageData &pageData){
|
virtual void displayPage(PageData &pageData){
|
||||||
GwConfigHandler *config = commonData.config;
|
GwConfigHandler *config = commonData->config;
|
||||||
GwLog *logger=commonData.logger;
|
GwLog *logger = commonData->logger;
|
||||||
|
|
||||||
// Old values for hold function
|
// Old values for hold function
|
||||||
static String svalue1old = "";
|
static String svalue1old = "";
|
||||||
|
@ -43,8 +43,8 @@ class PageTwoValues : public Page
|
||||||
name1 = name1.substring(0, 6); // String length limit for value name
|
name1 = name1.substring(0, 6); // String length limit for value name
|
||||||
double value1 = bvalue1->value; // Value as double in SI unit
|
double value1 = bvalue1->value; // Value as double in SI unit
|
||||||
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
|
||||||
|
|
||||||
// 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 (only one value by PageOneValue)
|
||||||
|
@ -52,8 +52,8 @@ class PageTwoValues : public Page
|
||||||
name2 = name2.substring(0, 6); // String length limit for value name
|
name2 = name2.substring(0, 6); // String length limit for value name
|
||||||
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
|
||||||
|
|
||||||
// Optical warning by limit violation (unused)
|
// Optical warning by limit violation (unused)
|
||||||
if(String(flashLED) == "Limit Violation"){
|
if(String(flashLED) == "Limit Violation"){
|
||||||
|
@ -74,7 +74,7 @@ class PageTwoValues : public Page
|
||||||
// ############### Value 1 ################
|
// ############### Value 1 ################
|
||||||
|
|
||||||
// Show name
|
// Show name
|
||||||
getdisplay().setTextColor(commonData.fgcolor);
|
getdisplay().setTextColor(commonData->fgcolor);
|
||||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||||
getdisplay().setCursor(20, 80);
|
getdisplay().setCursor(20, 80);
|
||||||
getdisplay().print(name1); // Page name
|
getdisplay().print(name1); // Page name
|
||||||
|
@ -118,7 +118,7 @@ class PageTwoValues : public Page
|
||||||
// ############### Horizontal Line ################
|
// ############### Horizontal Line ################
|
||||||
|
|
||||||
// Horizontal line 3 pix
|
// Horizontal line 3 pix
|
||||||
getdisplay().fillRect(0, 145, 400, 3, commonData.fgcolor);
|
getdisplay().fillRect(0, 145, 400, 3, commonData->fgcolor);
|
||||||
|
|
||||||
// ############### Value 2 ################
|
// ############### Value 2 ################
|
||||||
|
|
||||||
|
@ -168,9 +168,7 @@ class PageTwoValues : public Page
|
||||||
|
|
||||||
// Key Layout
|
// Key Layout
|
||||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||||
if(keylock == false){
|
if(commonData->keylock == false){
|
||||||
getdisplay().setCursor(130, 290);
|
|
||||||
getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
|
||||||
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
||||||
getdisplay().setCursor(343, 290);
|
getdisplay().setCursor(343, 290);
|
||||||
getdisplay().print("[ILUM]");
|
getdisplay().print("[ILUM]");
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
class PageVoltage : public Page
|
class PageVoltage : public Page
|
||||||
{
|
{
|
||||||
bool init = false; // Marker for init done
|
bool init = false; // Marker for init done
|
||||||
bool keylock = false; // Keylock
|
|
||||||
uint8_t average = 0; // Average type [0...3], 0=off, 1=10s, 2=60s, 3=300s
|
uint8_t average = 0; // Average type [0...3], 0=off, 1=10s, 2=60s, 3=300s
|
||||||
bool trend = true; // Trend indicator [0|1], 0=off, 1=on
|
bool trend = true; // Trend indicator [0|1], 0=off, 1=on
|
||||||
double raw = 0;
|
double raw = 0;
|
||||||
|
@ -15,6 +14,7 @@ char mode = 'D'; // display mode (A)nalog | (D)igital
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageVoltage(CommonData &common){
|
PageVoltage(CommonData &common){
|
||||||
|
commonData = &common;
|
||||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageVoltage");
|
common.logger->logDebug(GwLog::LOG,"Instantiate PageVoltage");
|
||||||
if (hasFRAM) {
|
if (hasFRAM) {
|
||||||
average = fram.read(FRAM_VOLTAGE_AVG);
|
average = fram.read(FRAM_VOLTAGE_AVG);
|
||||||
|
@ -51,7 +51,7 @@ public:
|
||||||
|
|
||||||
// Code for keylock
|
// Code for keylock
|
||||||
if(key == 11){
|
if(key == 11){
|
||||||
keylock = !keylock; // Toggle keylock
|
commonData->keylock = !commonData->keylock;
|
||||||
return 0; // Commit the key
|
return 0; // Commit the key
|
||||||
}
|
}
|
||||||
return key;
|
return key;
|
||||||
|
@ -92,10 +92,9 @@ public:
|
||||||
getdisplay().fillRect(x + 16, y + 11, 6, 3, color);
|
getdisplay().fillRect(x + 16, y + 11, 6, 3, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void displayPage(CommonData &commonData, PageData &pageData)
|
virtual void displayPage(PageData &pageData){
|
||||||
{
|
GwConfigHandler *config = commonData->config;
|
||||||
GwConfigHandler *config = commonData.config;
|
GwLog *logger = commonData->logger;
|
||||||
GwLog *logger=commonData.logger;
|
|
||||||
|
|
||||||
// Get config data
|
// Get config data
|
||||||
bool simulation = config->getBool(config->useSimuData);
|
bool simulation = config->getBool(config->useSimuData);
|
||||||
|
@ -113,32 +112,32 @@ public:
|
||||||
|
|
||||||
// Create trend value
|
// Create trend value
|
||||||
if(init == false){ // Load start values for first page run
|
if(init == false){ // Load start values for first page run
|
||||||
valueTrend = commonData.data.batteryVoltage10;
|
valueTrend = commonData->data.batteryVoltage10;
|
||||||
init = true;
|
init = true;
|
||||||
}
|
}
|
||||||
else{ // Reading trend value
|
else{ // Reading trend value
|
||||||
valueTrend = commonData.data.batteryVoltage10;
|
valueTrend = commonData->data.batteryVoltage10;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get raw value for trend indicator
|
// Get raw value for trend indicator
|
||||||
raw = commonData.data.batteryVoltage; // Live data
|
raw = commonData->data.batteryVoltage; // Live data
|
||||||
|
|
||||||
// Switch average values
|
// Switch average values
|
||||||
switch (average) {
|
switch (average) {
|
||||||
case 0:
|
case 0:
|
||||||
value1 = commonData.data.batteryVoltage; // Live data
|
value1 = commonData->data.batteryVoltage; // Live data
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
value1 = commonData.data.batteryVoltage10; // Average 10s
|
value1 = commonData->data.batteryVoltage10; // Average 10s
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
value1 = commonData.data.batteryVoltage60; // Average 60s
|
value1 = commonData->data.batteryVoltage60; // Average 60s
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
value1 = commonData.data.batteryVoltage300; // Average 300s
|
value1 = commonData->data.batteryVoltage300; // Average 300s
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
value1 = commonData.data.batteryVoltage; // Default
|
value1 = commonData->data.batteryVoltage; // Default
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
bool valid1 = true;
|
bool valid1 = true;
|
||||||
|
@ -193,7 +192,7 @@ public:
|
||||||
// Display mode digital
|
// Display mode digital
|
||||||
|
|
||||||
// Show name
|
// Show name
|
||||||
getdisplay().setTextColor(commonData.fgcolor);
|
getdisplay().setTextColor(commonData->fgcolor);
|
||||||
getdisplay().setFont(&Ubuntu_Bold32pt7b);
|
getdisplay().setFont(&Ubuntu_Bold32pt7b);
|
||||||
getdisplay().setCursor(20, 100);
|
getdisplay().setCursor(20, 100);
|
||||||
getdisplay().print(name1); // Value name
|
getdisplay().print(name1); // Value name
|
||||||
|
@ -246,18 +245,18 @@ public:
|
||||||
// Trend indicator
|
// Trend indicator
|
||||||
// Show trend indicator
|
// Show trend indicator
|
||||||
if(trend == true){
|
if(trend == true){
|
||||||
getdisplay().fillRect(310, 240, 40, 120, commonData.bgcolor); // Clear area
|
getdisplay().fillRect(310, 240, 40, 120, commonData->bgcolor); // Clear area
|
||||||
getdisplay().fillRect(315, 183, 35, 4, commonData.fgcolor); // Draw separator
|
getdisplay().fillRect(315, 183, 35, 4, commonData->fgcolor); // Draw separator
|
||||||
if(int(raw * 10) > int(valueTrend * 10)){
|
if(int(raw * 10) > int(valueTrend * 10)){
|
||||||
displayTrendHigh(320, 174, 11, commonData.fgcolor); // Show high indicator
|
displayTrendHigh(320, 174, 11, commonData->fgcolor); // Show high indicator
|
||||||
}
|
}
|
||||||
if(int(raw * 10) < int(valueTrend * 10)){
|
if(int(raw * 10) < int(valueTrend * 10)){
|
||||||
displayTrendLow(320, 195, 11, commonData.fgcolor); // Show low indicator
|
displayTrendLow(320, 195, 11, commonData->fgcolor); // Show low indicator
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// No trend indicator
|
// No trend indicator
|
||||||
else{
|
else{
|
||||||
getdisplay().fillRect(310, 240, 40, 120, commonData.bgcolor); // Clear area
|
getdisplay().fillRect(310, 240, 40, 120, commonData->bgcolor); // Clear area
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -272,9 +271,9 @@ public:
|
||||||
std::vector<Point> pts;
|
std::vector<Point> pts;
|
||||||
|
|
||||||
// Instrument
|
// Instrument
|
||||||
getdisplay().drawCircleHelper(c.x, c.y, r + 2, 0x01, commonData.fgcolor);
|
getdisplay().drawCircleHelper(c.x, c.y, r + 2, 0x01, commonData->fgcolor);
|
||||||
getdisplay().drawCircleHelper(c.x, c.y, r + 1, 0x01, commonData.fgcolor);
|
getdisplay().drawCircleHelper(c.x, c.y, r + 1, 0x01, commonData->fgcolor);
|
||||||
getdisplay().drawCircleHelper(c.x, c.y, r , 0x01, commonData.fgcolor);
|
getdisplay().drawCircleHelper(c.x, c.y, r , 0x01, commonData->fgcolor);
|
||||||
|
|
||||||
// Scale
|
// Scale
|
||||||
// angle to voltage scale mapping
|
// angle to voltage scale mapping
|
||||||
|
@ -290,14 +289,14 @@ public:
|
||||||
getdisplay().setFont(&Ubuntu_Bold10pt7b);
|
getdisplay().setFont(&Ubuntu_Bold10pt7b);
|
||||||
for (int angle = 3; angle < 90; angle += 3) {
|
for (int angle = 3; angle < 90; angle += 3) {
|
||||||
if (angle % 15 == 0) {
|
if (angle % 15 == 0) {
|
||||||
fillPoly4(rotatePoints(c, pts, angle), commonData.fgcolor);
|
fillPoly4(rotatePoints(c, pts, angle), commonData->fgcolor);
|
||||||
p1 = rotatePoint(c, {c.x - r + 30, c.y}, angle);
|
p1 = rotatePoint(c, {c.x - r + 30, c.y}, angle);
|
||||||
drawTextCenter(p1.x, p1.y, mapping[angle]);
|
drawTextCenter(p1.x, p1.y, mapping[angle]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
p1 = rotatePoint(c, {c.x - r, c.y}, angle);
|
p1 = rotatePoint(c, {c.x - r, c.y}, angle);
|
||||||
p2 = rotatePoint(c, {c.x - r + 6, c.y}, angle);
|
p2 = rotatePoint(c, {c.x - r + 6, c.y}, angle);
|
||||||
getdisplay().drawLine(p1.x, p1.y, p2.x, p2.y, commonData.fgcolor);
|
getdisplay().drawLine(p1.x, p1.y, p2.x, p2.y, commonData->fgcolor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,7 +325,7 @@ public:
|
||||||
{c.x - r + 38, c.y - 2},
|
{c.x - r + 38, c.y - 2},
|
||||||
{c.x - 2, c.y - 3}
|
{c.x - 2, c.y - 3}
|
||||||
};
|
};
|
||||||
fillPoly4(rotatePoints(c, pts, angle), commonData.fgcolor);
|
fillPoly4(rotatePoints(c, pts, angle), commonData->fgcolor);
|
||||||
// thin part
|
// thin part
|
||||||
pts = {
|
pts = {
|
||||||
{c.x - r + 40, c.y + 1},
|
{c.x - r + 40, c.y + 1},
|
||||||
|
@ -334,14 +333,14 @@ public:
|
||||||
{c.x - r + 5, c.y -1},
|
{c.x - r + 5, c.y -1},
|
||||||
{c.x - r + 40, c.y - 1},
|
{c.x - r + 40, c.y - 1},
|
||||||
};
|
};
|
||||||
fillPoly4(rotatePoints(c, pts, angle), commonData.fgcolor);
|
fillPoly4(rotatePoints(c, pts, angle), commonData->fgcolor);
|
||||||
|
|
||||||
// base
|
// base
|
||||||
getdisplay().fillCircle(c.x, c.y, 7, commonData.fgcolor);
|
getdisplay().fillCircle(c.x, c.y, 7, commonData->fgcolor);
|
||||||
getdisplay().fillCircle(c.x, c.y, 4, commonData.bgcolor);
|
getdisplay().fillCircle(c.x, c.y, 4, commonData->bgcolor);
|
||||||
|
|
||||||
// Symbol
|
// Symbol
|
||||||
printVoltageSymbol(40, 60, commonData.fgcolor);
|
printVoltageSymbol(40, 60, commonData->fgcolor);
|
||||||
|
|
||||||
// Additional information at right side
|
// Additional information at right side
|
||||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||||
|
@ -361,32 +360,26 @@ public:
|
||||||
|
|
||||||
// FRAM indicator
|
// FRAM indicator
|
||||||
if (hasFRAM) {
|
if (hasFRAM) {
|
||||||
getdisplay().drawXBitmap(300, 240, fram_bits, fram_width, fram_height, commonData.fgcolor);
|
getdisplay().drawXBitmap(300, 240, fram_bits, fram_width, fram_height, commonData->fgcolor);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Key Layout
|
// Key Layout
|
||||||
getdisplay().setTextColor(commonData.fgcolor);
|
getdisplay().setTextColor(commonData->fgcolor);
|
||||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||||
if(keylock == false){
|
if(commonData->keylock == false){
|
||||||
getdisplay().setCursor(10, 290);
|
getdisplay().setCursor(10, 290);
|
||||||
getdisplay().print("[AVG]");
|
getdisplay().print("[AVG]");
|
||||||
getdisplay().setCursor(62, 290);
|
getdisplay().setCursor(62, 290);
|
||||||
getdisplay().print("[MODE]");
|
getdisplay().print("[MODE]");
|
||||||
getdisplay().setCursor(130, 290);
|
|
||||||
getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
|
||||||
getdisplay().setCursor(293, 290);
|
getdisplay().setCursor(293, 290);
|
||||||
getdisplay().print("[TRD]");
|
getdisplay().print("[TRD]");
|
||||||
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
||||||
getdisplay().setCursor(343, 290);
|
getdisplay().setCursor(343, 290);
|
||||||
getdisplay().print("[ILUM]");
|
getdisplay().print("[ILUM]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
getdisplay().setCursor(130, 290);
|
|
||||||
getdisplay().print(" [ Keylock active ]");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update display
|
// Update display
|
||||||
getdisplay().nextPage(); // Partial update (fast)
|
getdisplay().nextPage(); // Partial update (fast)
|
||||||
|
|
|
@ -3,17 +3,17 @@
|
||||||
#include "Pagedata.h"
|
#include "Pagedata.h"
|
||||||
#include "OBP60Extensions.h"
|
#include "OBP60Extensions.h"
|
||||||
|
|
||||||
class PageWhite : public Page{
|
class PageWhite : public Page
|
||||||
bool keylock = false; // Keylock
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageWhite(CommonData &common){
|
PageWhite(CommonData &common){
|
||||||
common.logger->logDebug(GwLog::LOG,"Show PageWhite");
|
commonData = &common;
|
||||||
|
common.logger->logDebug(GwLog::LOG,"Instantiate PageWhite");
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void displayPage(CommonData &commonData, PageData &pageData){
|
virtual void displayPage(PageData &pageData){
|
||||||
GwConfigHandler *config = commonData.config;
|
GwConfigHandler *config = commonData->config;
|
||||||
GwLog *logger=commonData.logger;
|
GwLog *logger = commonData->logger;
|
||||||
|
|
||||||
// Get config data
|
// Get config data
|
||||||
String flashLED = config->getString(config->flashLED);
|
String flashLED = config->getString(config->flashLED);
|
||||||
|
@ -60,4 +60,4 @@ PageDescription registerPageWhite(
|
||||||
false // Show display header on/off
|
false // Show display header on/off
|
||||||
);
|
);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -5,28 +5,27 @@
|
||||||
|
|
||||||
class PageWindRose : public Page
|
class PageWindRose : public Page
|
||||||
{
|
{
|
||||||
bool keylock = false; // Keylock
|
|
||||||
int16_t lp = 80; // Pointer length
|
int16_t lp = 80; // Pointer length
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageWindRose(CommonData &common){
|
PageWindRose(CommonData &common){
|
||||||
|
commonData = &common;
|
||||||
common.logger->logDebug(GwLog::LOG,"Show PageWindRose");
|
common.logger->logDebug(GwLog::LOG,"Show PageWindRose");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Key functions
|
// Key functions
|
||||||
virtual int handleKey(int key){
|
virtual int handleKey(int key){
|
||||||
// Keylock function
|
// Code for keylock
|
||||||
if(key == 11){ // Code for keylock
|
if(key == 11){
|
||||||
keylock = !keylock; // Toggle keylock
|
commonData->keylock = !commonData->keylock;
|
||||||
return 0; // Commit the key
|
return 0; // Commit the key
|
||||||
}
|
}
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void displayPage(CommonData &commonData, PageData &pageData)
|
virtual void displayPage(PageData &pageData){
|
||||||
{
|
GwConfigHandler *config = commonData->config;
|
||||||
GwConfigHandler *config = commonData.config;
|
GwLog *logger = commonData->logger;
|
||||||
GwLog *logger=commonData.logger;
|
|
||||||
|
|
||||||
static String svalue1old = "";
|
static String svalue1old = "";
|
||||||
static String unit1old = "";
|
static String unit1old = "";
|
||||||
|
@ -54,9 +53,9 @@ public:
|
||||||
name1 = name1.substring(0, 6); // String length limit for value name
|
name1 = name1.substring(0, 6); // String length limit for value name
|
||||||
double value1 = bvalue1->value; // Value as double in SI unit
|
double value1 = bvalue1->value; // Value as double in SI unit
|
||||||
bool valid1 = bvalue1->valid; // Valid information
|
bool valid1 = bvalue1->valid; // Valid information
|
||||||
value1 = formatValue(bvalue1, commonData).value;// Format only nesaccery for simulation data for pointer
|
value1 = formatValue(bvalue1, *commonData).value;// Format only nesaccery for simulation data for pointer
|
||||||
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
|
||||||
if(valid1 == true){
|
if(valid1 == true){
|
||||||
svalue1old = svalue1; // Save old value
|
svalue1old = svalue1; // Save old value
|
||||||
unit1old = unit1; // Save old unit
|
unit1old = unit1; // Save old unit
|
||||||
|
@ -68,8 +67,8 @@ public:
|
||||||
name2 = name2.substring(0, 6); // String length limit for value name
|
name2 = name2.substring(0, 6); // String length limit for value name
|
||||||
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){
|
||||||
svalue2old = svalue2; // Save old value
|
svalue2old = svalue2; // Save old value
|
||||||
unit2old = unit2; // Save old unit
|
unit2old = unit2; // Save old unit
|
||||||
|
@ -81,8 +80,8 @@ public:
|
||||||
name3 = name3.substring(0, 6); // String length limit for value name
|
name3 = name3.substring(0, 6); // String length limit for value name
|
||||||
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){
|
||||||
svalue3old = svalue3; // Save old value
|
svalue3old = svalue3; // Save old value
|
||||||
unit3old = unit3; // Save old unit
|
unit3old = unit3; // Save old unit
|
||||||
|
@ -94,8 +93,8 @@ public:
|
||||||
name4 = name4.substring(0, 6); // String length limit for value name
|
name4 = name4.substring(0, 6); // String length limit for value name
|
||||||
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){
|
||||||
svalue4old = svalue4; // Save old value
|
svalue4old = svalue4; // Save old value
|
||||||
unit4old = unit4; // Save old unit
|
unit4old = unit4; // Save old unit
|
||||||
|
@ -107,8 +106,8 @@ public:
|
||||||
name5 = name5.substring(0, 6); // String length limit for value name
|
name5 = name5.substring(0, 6); // String length limit for value name
|
||||||
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){
|
||||||
svalue5old = svalue5; // Save old value
|
svalue5old = svalue5; // Save old value
|
||||||
unit5old = unit5; // Save old unit
|
unit5old = unit5; // Save old unit
|
||||||
|
@ -120,8 +119,8 @@ public:
|
||||||
name6 = name6.substring(0, 6); // String length limit for value name
|
name6 = name6.substring(0, 6); // String length limit for value name
|
||||||
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){
|
||||||
svalue6old = svalue6; // Save old value
|
svalue6old = svalue6; // Save old value
|
||||||
unit6old = unit6; // Save old unit
|
unit6old = unit6; // Save old unit
|
||||||
|
@ -143,7 +142,7 @@ public:
|
||||||
// Set display in partial refresh mode
|
// Set display in partial refresh mode
|
||||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||||
|
|
||||||
getdisplay().setTextColor(commonData.fgcolor);
|
getdisplay().setTextColor(commonData->fgcolor);
|
||||||
|
|
||||||
// Show values AWA
|
// Show values AWA
|
||||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||||
|
@ -163,7 +162,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Horizintal separator left
|
// Horizintal separator left
|
||||||
getdisplay().fillRect(0, 149, 60, 3, commonData.fgcolor);
|
getdisplay().fillRect(0, 149, 60, 3, commonData->fgcolor);
|
||||||
|
|
||||||
// Show values AWS
|
// Show values AWS
|
||||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||||
|
@ -205,7 +204,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Horizintal separator right
|
// Horizintal separator right
|
||||||
getdisplay().fillRect(340, 149, 80, 3, commonData.fgcolor);
|
getdisplay().fillRect(340, 149, 80, 3, commonData->fgcolor);
|
||||||
|
|
||||||
// Show values TWS
|
// Show values TWS
|
||||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||||
|
@ -230,10 +229,10 @@ public:
|
||||||
int rInstrument = 110; // Radius of grafic instrument
|
int rInstrument = 110; // Radius of grafic instrument
|
||||||
float pi = 3.141592;
|
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
|
||||||
getdisplay().fillCircle(200, 150, rInstrument - 10, commonData.fgcolor); // Inner circle
|
getdisplay().fillCircle(200, 150, rInstrument - 10, commonData->fgcolor); // Inner circle
|
||||||
getdisplay().fillCircle(200, 150, rInstrument - 13, commonData.bgcolor); // Inner circle
|
getdisplay().fillCircle(200, 150, rInstrument - 13, commonData->bgcolor); // Inner circle
|
||||||
|
|
||||||
for(int i=0; i<360; i=i+10)
|
for(int i=0; i<360; i=i+10)
|
||||||
{
|
{
|
||||||
|
@ -271,7 +270,7 @@ 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*pi);
|
||||||
float y1c = 150 - rInstrument*cos(i/180.0*pi);
|
float y1c = 150 - rInstrument*cos(i/180.0*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*pi);
|
||||||
float cosx=cos(i/180.0*pi);
|
float cosx=cos(i/180.0*pi);
|
||||||
|
|
||||||
|
@ -284,10 +283,10 @@ public:
|
||||||
float yy2 = -(rInstrument+10);
|
float yy2 = -(rInstrument+10);
|
||||||
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*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),commonData.fgcolor);
|
200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),commonData->fgcolor);
|
||||||
getdisplay().fillTriangle(200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
getdisplay().fillTriangle(200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
||||||
200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),
|
200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),
|
||||||
200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),commonData.fgcolor);
|
200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),commonData->fgcolor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -304,7 +303,7 @@ public:
|
||||||
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);
|
||||||
// Inverted pointer
|
// Inverted pointer
|
||||||
// Pointer as triangle with center base 2*width
|
// Pointer as triangle with center base 2*width
|
||||||
float endwidth = 2; // End width of pointer
|
float endwidth = 2; // End width of pointer
|
||||||
|
@ -314,12 +313,12 @@ public:
|
||||||
float iy2 = -endwidth;
|
float iy2 = -endwidth;
|
||||||
getdisplay().fillTriangle(200+(int)(cosx*ix1-sinx*iy1),150+(int)(sinx*ix1+cosx*iy1),
|
getdisplay().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*ix2-sinx*iy1),150+(int)(sinx*ix2+cosx*iy1),
|
||||||
200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData.fgcolor);
|
200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData->fgcolor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Center circle
|
// Center circle
|
||||||
getdisplay().fillCircle(200, 150, startwidth + 6, commonData.bgcolor);
|
getdisplay().fillCircle(200, 150, startwidth + 6, commonData->bgcolor);
|
||||||
getdisplay().fillCircle(200, 150, startwidth + 4, commonData.fgcolor);
|
getdisplay().fillCircle(200, 150, startwidth + 4, commonData->fgcolor);
|
||||||
|
|
||||||
//*******************************************************************************************
|
//*******************************************************************************************
|
||||||
|
|
||||||
|
@ -353,18 +352,12 @@ public:
|
||||||
|
|
||||||
// Key Layout
|
// Key Layout
|
||||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||||
if(keylock == false){
|
if(commonData->keylock == false){
|
||||||
getdisplay().setCursor(130, 290);
|
|
||||||
getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
|
||||||
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
||||||
getdisplay().setCursor(343, 290);
|
getdisplay().setCursor(343, 290);
|
||||||
getdisplay().print("[ILUM]");
|
getdisplay().print("[ILUM]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
getdisplay().setCursor(130, 290);
|
|
||||||
getdisplay().print(" [ Keylock active ]");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update display
|
// Update display
|
||||||
getdisplay().nextPage(); // Partial update (fast)
|
getdisplay().nextPage(); // Partial update (fast)
|
||||||
|
|
|
@ -5,28 +5,27 @@
|
||||||
|
|
||||||
class PageWindRoseFlex : public Page
|
class PageWindRoseFlex : public Page
|
||||||
{
|
{
|
||||||
bool keylock = false; // Keylock
|
|
||||||
int16_t lp = 80; // Pointer length
|
int16_t lp = 80; // Pointer length
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageWindRoseFlex(CommonData &common){
|
PageWindRoseFlex(CommonData &common){
|
||||||
|
commonData = &common;
|
||||||
common.logger->logDebug(GwLog::LOG,"Show PageWindRoseFlex");
|
common.logger->logDebug(GwLog::LOG,"Show PageWindRoseFlex");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Key functions
|
// Key functions
|
||||||
virtual int handleKey(int key){
|
virtual int handleKey(int key){
|
||||||
// Keylock function
|
// Code for keylock
|
||||||
if(key == 11){ // Code for keylock
|
if(key == 11){
|
||||||
keylock = !keylock; // Toggle keylock
|
commonData->keylock = !commonData->keylock;
|
||||||
return 0; // Commit the key
|
return 0; // Commit the key
|
||||||
}
|
}
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void displayPage(CommonData &commonData, PageData &pageData)
|
virtual void displayPage(PageData &pageData){
|
||||||
{
|
GwConfigHandler *config = commonData->config;
|
||||||
GwConfigHandler *config = commonData.config;
|
GwLog *logger = commonData->logger;
|
||||||
GwLog *logger=commonData.logger;
|
|
||||||
|
|
||||||
static String svalue1old = "";
|
static String svalue1old = "";
|
||||||
static String unit1old = "";
|
static String unit1old = "";
|
||||||
|
@ -54,9 +53,9 @@ public:
|
||||||
name1 = name1.substring(0, 6); // String length limit for value name
|
name1 = name1.substring(0, 6); // String length limit for value name
|
||||||
double value1 = bvalue1->value; // Value as double in SI unit
|
double value1 = bvalue1->value; // Value as double in SI unit
|
||||||
bool valid1 = bvalue1->valid; // Valid information
|
bool valid1 = bvalue1->valid; // Valid information
|
||||||
value1 = formatValue(bvalue1, commonData).value;// Format only nesaccery for simulation data for pointer
|
value1 = formatValue(bvalue1, *commonData).value;// Format only nesaccery for simulation data for pointer
|
||||||
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
|
||||||
if(valid1 == true){
|
if(valid1 == true){
|
||||||
svalue1old = svalue1; // Save old value
|
svalue1old = svalue1; // Save old value
|
||||||
unit1old = unit1; // Save old unit
|
unit1old = unit1; // Save old unit
|
||||||
|
@ -68,8 +67,8 @@ public:
|
||||||
name2 = name2.substring(0, 6); // String length limit for value name
|
name2 = name2.substring(0, 6); // String length limit for value name
|
||||||
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){
|
||||||
svalue2old = svalue2; // Save old value
|
svalue2old = svalue2; // Save old value
|
||||||
unit2old = unit2; // Save old unit
|
unit2old = unit2; // Save old unit
|
||||||
|
@ -81,8 +80,8 @@ public:
|
||||||
name3 = name3.substring(0, 6); // String length limit for value name
|
name3 = name3.substring(0, 6); // String length limit for value name
|
||||||
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){
|
||||||
svalue3old = svalue3; // Save old value
|
svalue3old = svalue3; // Save old value
|
||||||
unit3old = unit3; // Save old unit
|
unit3old = unit3; // Save old unit
|
||||||
|
@ -94,8 +93,8 @@ public:
|
||||||
name4 = name4.substring(0, 6); // String length limit for value name
|
name4 = name4.substring(0, 6); // String length limit for value name
|
||||||
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){
|
||||||
svalue4old = svalue4; // Save old value
|
svalue4old = svalue4; // Save old value
|
||||||
unit4old = unit4; // Save old unit
|
unit4old = unit4; // Save old unit
|
||||||
|
@ -107,8 +106,8 @@ public:
|
||||||
name5 = name5.substring(0, 6); // String length limit for value name
|
name5 = name5.substring(0, 6); // String length limit for value name
|
||||||
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){
|
||||||
svalue5old = svalue5; // Save old value
|
svalue5old = svalue5; // Save old value
|
||||||
unit5old = unit5; // Save old unit
|
unit5old = unit5; // Save old unit
|
||||||
|
@ -120,8 +119,8 @@ public:
|
||||||
name6 = name6.substring(0, 6); // String length limit for value name
|
name6 = name6.substring(0, 6); // String length limit for value name
|
||||||
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){
|
||||||
svalue6old = svalue6; // Save old value
|
svalue6old = svalue6; // Save old value
|
||||||
unit6old = unit6; // Save old unit
|
unit6old = unit6; // Save old unit
|
||||||
|
@ -143,7 +142,7 @@ public:
|
||||||
// Set display in partial refresh mode
|
// Set display in partial refresh mode
|
||||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||||
|
|
||||||
getdisplay().setTextColor(commonData.fgcolor);
|
getdisplay().setTextColor(commonData->fgcolor);
|
||||||
|
|
||||||
// Show values AWA
|
// Show values AWA
|
||||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||||
|
@ -163,7 +162,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Horizintal separator left
|
// Horizintal separator left
|
||||||
getdisplay().fillRect(0, 149, 60, 3, commonData.fgcolor);
|
getdisplay().fillRect(0, 149, 60, 3, commonData->fgcolor);
|
||||||
|
|
||||||
// Show values AWS
|
// Show values AWS
|
||||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||||
|
@ -205,7 +204,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Horizintal separator right
|
// Horizintal separator right
|
||||||
getdisplay().fillRect(340, 149, 80, 3, commonData.fgcolor);
|
getdisplay().fillRect(340, 149, 80, 3, commonData->fgcolor);
|
||||||
|
|
||||||
// Show values TWS
|
// Show values TWS
|
||||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||||
|
@ -230,10 +229,10 @@ public:
|
||||||
int rInstrument = 110; // Radius of grafic instrument
|
int rInstrument = 110; // Radius of grafic instrument
|
||||||
float pi = 3.141592;
|
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
|
||||||
getdisplay().fillCircle(200, 150, rInstrument - 10, commonData.fgcolor); // Inner circle
|
getdisplay().fillCircle(200, 150, rInstrument - 10, commonData->fgcolor); // Inner circle
|
||||||
getdisplay().fillCircle(200, 150, rInstrument - 13, commonData.bgcolor); // Inner circle
|
getdisplay().fillCircle(200, 150, rInstrument - 13, commonData->bgcolor); // Inner circle
|
||||||
|
|
||||||
for(int i=0; i<360; i=i+10)
|
for(int i=0; i<360; i=i+10)
|
||||||
{
|
{
|
||||||
|
@ -271,7 +270,7 @@ 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*pi);
|
||||||
float y1c = 150 - rInstrument*cos(i/180.0*pi);
|
float y1c = 150 - rInstrument*cos(i/180.0*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*pi);
|
||||||
float cosx=cos(i/180.0*pi);
|
float cosx=cos(i/180.0*pi);
|
||||||
|
|
||||||
|
@ -284,10 +283,10 @@ public:
|
||||||
float yy2 = -(rInstrument+10);
|
float yy2 = -(rInstrument+10);
|
||||||
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*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),commonData.fgcolor);
|
200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),commonData->fgcolor);
|
||||||
getdisplay().fillTriangle(200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
getdisplay().fillTriangle(200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
||||||
200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),
|
200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),
|
||||||
200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),commonData.fgcolor);
|
200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),commonData->fgcolor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -304,7 +303,7 @@ public:
|
||||||
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);
|
||||||
// Inverted pointer
|
// Inverted pointer
|
||||||
// Pointer as triangle with center base 2*width
|
// Pointer as triangle with center base 2*width
|
||||||
float endwidth = 2; // End width of pointer
|
float endwidth = 2; // End width of pointer
|
||||||
|
@ -314,12 +313,12 @@ public:
|
||||||
float iy2 = -endwidth;
|
float iy2 = -endwidth;
|
||||||
getdisplay().fillTriangle(200+(int)(cosx*ix1-sinx*iy1),150+(int)(sinx*ix1+cosx*iy1),
|
getdisplay().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*ix2-sinx*iy1),150+(int)(sinx*ix2+cosx*iy1),
|
||||||
200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData.fgcolor);
|
200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData->fgcolor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Center circle
|
// Center circle
|
||||||
getdisplay().fillCircle(200, 150, startwidth + 6, commonData.bgcolor);
|
getdisplay().fillCircle(200, 150, startwidth + 6, commonData->bgcolor);
|
||||||
getdisplay().fillCircle(200, 150, startwidth + 4, commonData.fgcolor);
|
getdisplay().fillCircle(200, 150, startwidth + 4, commonData->fgcolor);
|
||||||
|
|
||||||
//*******************************************************************************************
|
//*******************************************************************************************
|
||||||
|
|
||||||
|
@ -353,18 +352,12 @@ public:
|
||||||
|
|
||||||
// Key Layout
|
// Key Layout
|
||||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||||
if(keylock == false){
|
if(commonData->keylock == false){
|
||||||
getdisplay().setCursor(130, 290);
|
|
||||||
getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
|
||||||
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
||||||
getdisplay().setCursor(343, 290);
|
getdisplay().setCursor(343, 290);
|
||||||
getdisplay().print("[ILUM]");
|
getdisplay().print("[ILUM]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
getdisplay().setCursor(130, 290);
|
|
||||||
getdisplay().print(" [ Keylock active ]");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update display
|
// Update display
|
||||||
getdisplay().nextPage(); // Partial update (fast)
|
getdisplay().nextPage(); // Partial update (fast)
|
||||||
|
|
|
@ -26,12 +26,12 @@ static unsigned char ship_bits[] PROGMEM = {
|
||||||
0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00,
|
0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00,
|
||||||
0x00, 0xf0, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
0x00, 0xf0, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||||
|
|
||||||
class PageXTETrack : public Page{
|
class PageXTETrack : public Page
|
||||||
bool keylock = false; // Keylock
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageXTETrack(CommonData &common){
|
PageXTETrack(CommonData &common){
|
||||||
common.logger->logDebug(GwLog::LOG,"Show PageXTETrack");
|
commonData = &common;
|
||||||
|
common.logger->logDebug(GwLog::LOG,"Instantiate PageXTETrack");
|
||||||
}
|
}
|
||||||
|
|
||||||
void drawSegment(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1,
|
void drawSegment(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1,
|
||||||
|
@ -52,16 +52,17 @@ class PageXTETrack : public Page{
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int handleKey(int key){
|
virtual int handleKey(int key){
|
||||||
if(key == 11){ // Code for keylock
|
// Code for keylock
|
||||||
keylock = !keylock; // Toggle keylock
|
if(key == 11){
|
||||||
|
commonData->keylock = !commonData->keylock;
|
||||||
return 0; // Commit the key
|
return 0; // Commit the key
|
||||||
}
|
}
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void displayPage(CommonData &commonData, PageData &pageData){
|
virtual void displayPage(PageData &pageData){
|
||||||
GwConfigHandler *config = commonData.config;
|
GwConfigHandler *config = commonData->config;
|
||||||
GwLog *logger=commonData.logger;
|
GwLog *logger = commonData->logger;
|
||||||
|
|
||||||
// Get config data
|
// Get config data
|
||||||
String flashLED = config->getString(config->flashLED);
|
String flashLED = config->getString(config->flashLED);
|
||||||
|
@ -85,7 +86,7 @@ class PageXTETrack : public Page{
|
||||||
// Set display in partial refresh mode
|
// Set display in partial refresh mode
|
||||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||||
|
|
||||||
getdisplay().setTextColor(commonData.fgcolor);
|
getdisplay().setTextColor(commonData->fgcolor);
|
||||||
|
|
||||||
// descriptions
|
// descriptions
|
||||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||||
|
@ -105,25 +106,25 @@ class PageXTETrack : public Page{
|
||||||
uint16_t w, h;
|
uint16_t w, h;
|
||||||
|
|
||||||
GwApi::BoatValue *bv_xte = pageData.values[0]; // XTE
|
GwApi::BoatValue *bv_xte = pageData.values[0]; // XTE
|
||||||
String sval_xte = formatValue(bv_xte, commonData).svalue;
|
String sval_xte = formatValue(bv_xte, *commonData).svalue;
|
||||||
getdisplay().getTextBounds(sval_xte, 0, 0, &x, &y, &w, &h);
|
getdisplay().getTextBounds(sval_xte, 0, 0, &x, &y, &w, &h);
|
||||||
getdisplay().setCursor(160-w, 170);
|
getdisplay().setCursor(160-w, 170);
|
||||||
getdisplay().print(sval_xte);
|
getdisplay().print(sval_xte);
|
||||||
|
|
||||||
GwApi::BoatValue *bv_cog = pageData.values[1]; // COG
|
GwApi::BoatValue *bv_cog = pageData.values[1]; // COG
|
||||||
String sval_cog = formatValue(bv_cog, commonData).svalue;
|
String sval_cog = formatValue(bv_cog, *commonData).svalue;
|
||||||
getdisplay().getTextBounds(sval_cog, 0, 0, &x, &y, &w, &h);
|
getdisplay().getTextBounds(sval_cog, 0, 0, &x, &y, &w, &h);
|
||||||
getdisplay().setCursor(360-w, 170);
|
getdisplay().setCursor(360-w, 170);
|
||||||
getdisplay().print(sval_cog);
|
getdisplay().print(sval_cog);
|
||||||
|
|
||||||
GwApi::BoatValue *bv_dtw = pageData.values[2]; // DTW
|
GwApi::BoatValue *bv_dtw = pageData.values[2]; // DTW
|
||||||
String sval_dtw = formatValue(bv_dtw, commonData).svalue;
|
String sval_dtw = formatValue(bv_dtw, *commonData).svalue;
|
||||||
getdisplay().getTextBounds(sval_dtw, 0, 0, &x, &y, &w, &h);
|
getdisplay().getTextBounds(sval_dtw, 0, 0, &x, &y, &w, &h);
|
||||||
getdisplay().setCursor(160-w, 257);
|
getdisplay().setCursor(160-w, 257);
|
||||||
getdisplay().print(sval_dtw);
|
getdisplay().print(sval_dtw);
|
||||||
|
|
||||||
GwApi::BoatValue *bv_btw = pageData.values[3]; // BTW
|
GwApi::BoatValue *bv_btw = pageData.values[3]; // BTW
|
||||||
String sval_btw = formatValue(bv_btw, commonData).svalue;
|
String sval_btw = formatValue(bv_btw, *commonData).svalue;
|
||||||
getdisplay().getTextBounds(sval_btw, 0, 0, &x, &y, &w, &h);
|
getdisplay().getTextBounds(sval_btw, 0, 0, &x, &y, &w, &h);
|
||||||
getdisplay().setCursor(360-w, 257);
|
getdisplay().setCursor(360-w, 257);
|
||||||
getdisplay().print(sval_btw);
|
getdisplay().print(sval_btw);
|
||||||
|
@ -133,7 +134,7 @@ class PageXTETrack : public Page{
|
||||||
// XTETrack view
|
// XTETrack view
|
||||||
|
|
||||||
// draw ship symbol (as bitmap)
|
// draw ship symbol (as bitmap)
|
||||||
getdisplay().drawXBitmap(184, 68, ship_bits, ship_width, ship_height, commonData.fgcolor);
|
getdisplay().drawXBitmap(184, 68, ship_bits, ship_width, ship_height, commonData->fgcolor);
|
||||||
|
|
||||||
// draw next waypoint name
|
// draw next waypoint name
|
||||||
String sval_wpname = "no data";
|
String sval_wpname = "no data";
|
||||||
|
@ -188,28 +189,22 @@ class PageXTETrack : public Page{
|
||||||
}
|
}
|
||||||
|
|
||||||
// left segments
|
// left segments
|
||||||
drawSegment(0, 54, 46, 24, 75, 24, 0, 90, commonData.fgcolor, seg[2]);
|
drawSegment(0, 54, 46, 24, 75, 24, 0, 90, commonData->fgcolor, seg[2]);
|
||||||
drawSegment(0, 100, 82, 24, 112, 24, 50, 100, commonData.fgcolor, seg[1]);
|
drawSegment(0, 100, 82, 24, 112, 24, 50, 100, commonData->fgcolor, seg[1]);
|
||||||
drawSegment(60, 100, 117, 24, 147, 24, 110, 100, commonData.fgcolor,seg[0]);
|
drawSegment(60, 100, 117, 24, 147, 24, 110, 100, commonData->fgcolor,seg[0]);
|
||||||
// right segments
|
// right segments
|
||||||
drawSegment(340, 100, 283, 24, 253, 24, 290, 100, commonData.fgcolor, seg[3]);
|
drawSegment(340, 100, 283, 24, 253, 24, 290, 100, commonData->fgcolor, seg[3]);
|
||||||
drawSegment(399, 100, 318, 24, 289, 24, 350, 100, commonData.fgcolor, seg[4]);
|
drawSegment(399, 100, 318, 24, 289, 24, 350, 100, commonData->fgcolor, seg[4]);
|
||||||
drawSegment(399, 54, 354, 24, 325, 24, 399, 90, commonData.fgcolor, seg[5]);
|
drawSegment(399, 54, 354, 24, 325, 24, 399, 90, commonData->fgcolor, seg[5]);
|
||||||
|
|
||||||
// Key Layout
|
// Key Layout
|
||||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||||
if(keylock == false){
|
if(commonData->keylock == false){
|
||||||
getdisplay().setCursor(130, 296);
|
|
||||||
getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
|
||||||
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
||||||
getdisplay().setCursor(343, 296);
|
getdisplay().setCursor(343, 296);
|
||||||
getdisplay().print("[ILUM]");
|
getdisplay().print("[ILUM]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
getdisplay().setCursor(130, 296);
|
|
||||||
getdisplay().print(" [ Keylock active ]");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update display
|
// Update display
|
||||||
getdisplay().nextPage(); // Partial update (fast)
|
getdisplay().nextPage(); // Partial update (fast)
|
||||||
|
|
|
@ -73,13 +73,16 @@ typedef struct{
|
||||||
GwApi::BoatValue *date=NULL;
|
GwApi::BoatValue *date=NULL;
|
||||||
uint16_t fgcolor;
|
uint16_t fgcolor;
|
||||||
uint16_t bgcolor;
|
uint16_t bgcolor;
|
||||||
|
bool keylock = false;
|
||||||
} CommonData;
|
} CommonData;
|
||||||
|
|
||||||
//a base class that all pages must inherit from
|
//a base class that all pages must inherit from
|
||||||
class Page{
|
class Page{
|
||||||
|
protected:
|
||||||
|
CommonData *commonData;
|
||||||
public:
|
public:
|
||||||
virtual void displayPage(CommonData &commonData, PageData &pageData)=0;
|
virtual void displayPage(PageData &pageData)=0;
|
||||||
virtual void displayNew(CommonData &commonData, PageData &pageData){}
|
virtual void displayNew(PageData &pageData){}
|
||||||
//return -1 if handled by the page
|
//return -1 if handled by the page
|
||||||
virtual int handleKey(int key){return key;}
|
virtual int handleKey(int key){return key;}
|
||||||
};
|
};
|
||||||
|
|
|
@ -629,12 +629,13 @@ void OBP60Task(GwApi *api){
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if (lastPage != pageNumber){
|
if (lastPage != pageNumber){
|
||||||
currentPage->displayNew(commonData,pages[pageNumber].parameters);
|
if (hasFRAM) fram.write(FRAM_PAGE_NO, pageNumber); // remember page for device restart
|
||||||
|
currentPage->displayNew(pages[pageNumber].parameters);
|
||||||
lastPage=pageNumber;
|
lastPage=pageNumber;
|
||||||
}
|
}
|
||||||
//call the page code
|
//call the page code
|
||||||
LOG_DEBUG(GwLog::DEBUG,"calling page %d",pageNumber);
|
LOG_DEBUG(GwLog::DEBUG,"calling page %d",pageNumber);
|
||||||
currentPage->displayPage(commonData,pages[pageNumber].parameters);
|
currentPage->displayPage(pages[pageNumber].parameters);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue