Code improvements: commonData, config and logger in page class
This commit is contained in:
parent
15ca3614ba
commit
1ada6e5a82
|
@ -19,8 +19,6 @@
|
||||||
class PageAIS : public Page
|
class PageAIS : public Page
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
GwConfigHandler *config;
|
|
||||||
GwLog *logger;
|
|
||||||
bool simulation = false;
|
bool simulation = false;
|
||||||
bool holdvalues = false;
|
bool holdvalues = false;
|
||||||
String flashLED;
|
String flashLED;
|
||||||
|
@ -84,11 +82,8 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageAIS(CommonData &common)
|
PageAIS(CommonData &common) : Page(common)
|
||||||
{
|
{
|
||||||
commonData = &common;
|
|
||||||
config = commonData->config;
|
|
||||||
logger = commonData->logger;
|
|
||||||
logger->logDebug(GwLog::LOG,"Instantiate PageAIS");
|
logger->logDebug(GwLog::LOG,"Instantiate PageAIS");
|
||||||
|
|
||||||
// preload configuration data
|
// preload configuration data
|
||||||
|
|
|
@ -51,8 +51,6 @@ static unsigned char anchor_bits[] = {
|
||||||
class PageAnchor : public Page
|
class PageAnchor : public Page
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
GwConfigHandler *config;
|
|
||||||
GwLog *logger;
|
|
||||||
bool simulation = false;
|
bool simulation = false;
|
||||||
bool holdvalues = false;
|
bool holdvalues = false;
|
||||||
String flashLED;
|
String flashLED;
|
||||||
|
@ -244,11 +242,8 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageAnchor(CommonData &common)
|
PageAnchor(CommonData &common) : Page(common)
|
||||||
{
|
{
|
||||||
commonData = &common;
|
|
||||||
config = commonData->config;
|
|
||||||
logger = commonData->logger;
|
|
||||||
logger->logDebug(GwLog::LOG,"Instantiate PageAnchor");
|
logger->logDebug(GwLog::LOG,"Instantiate PageAnchor");
|
||||||
|
|
||||||
// preload configuration data
|
// preload configuration data
|
||||||
|
|
|
@ -12,8 +12,6 @@
|
||||||
class PageAutopilot : public Page
|
class PageAutopilot : public Page
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
GwConfigHandler *config;
|
|
||||||
GwLog *logger;
|
|
||||||
bool simulation = false;
|
bool simulation = false;
|
||||||
bool holdvalues = false;
|
bool holdvalues = false;
|
||||||
String flashLED;
|
String flashLED;
|
||||||
|
@ -48,11 +46,8 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageAutopilot(CommonData &common)
|
PageAutopilot(CommonData &common) : Page(common)
|
||||||
{
|
{
|
||||||
commonData = &common;
|
|
||||||
config = commonData->config;
|
|
||||||
logger = commonData->logger;
|
|
||||||
logger->logDebug(GwLog::LOG, "Instantiate PageAutopilot");
|
logger->logDebug(GwLog::LOG, "Instantiate PageAutopilot");
|
||||||
|
|
||||||
// preload configuration data
|
// preload configuration data
|
||||||
|
|
|
@ -7,9 +7,9 @@
|
||||||
class PageBME280 : public Page
|
class PageBME280 : public Page
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PageBME280(CommonData &common){
|
PageBME280(CommonData &common) : Page(common)
|
||||||
commonData = &common;
|
{
|
||||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageBME280");
|
logger->logDebug(GwLog::LOG,"Instantiate PageBME280");
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int handleKey(int key){
|
virtual int handleKey(int key){
|
||||||
|
@ -22,8 +22,6 @@ class PageBME280 : public Page
|
||||||
}
|
}
|
||||||
|
|
||||||
int displayPage(PageData &pageData){
|
int displayPage(PageData &pageData){
|
||||||
GwConfigHandler *config = commonData->config;
|
|
||||||
GwLog *logger = commonData->logger;
|
|
||||||
|
|
||||||
double value1 = 0;
|
double value1 = 0;
|
||||||
double value2 = 0;
|
double value2 = 0;
|
||||||
|
|
|
@ -9,9 +9,9 @@ class PageBattery : public Page
|
||||||
int average = 0; // Average type [0...3], 0=off, 1=10s, 2=60s, 3=300s
|
int average = 0; // Average type [0...3], 0=off, 1=10s, 2=60s, 3=300s
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageBattery(CommonData &common){
|
PageBattery(CommonData &common) : Page(common)
|
||||||
commonData = &common;
|
{
|
||||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageBattery");
|
logger->logDebug(GwLog::LOG, "Instantiate PageBattery");
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void setupKeys(){
|
virtual void setupKeys(){
|
||||||
|
@ -36,8 +36,6 @@ class PageBattery : public Page
|
||||||
}
|
}
|
||||||
|
|
||||||
int displayPage(PageData &pageData){
|
int displayPage(PageData &pageData){
|
||||||
GwConfigHandler *config = commonData->config;
|
|
||||||
GwLog *logger = commonData->logger;
|
|
||||||
|
|
||||||
// Old values for hold function
|
// Old values for hold function
|
||||||
double value1 = 0;
|
double value1 = 0;
|
||||||
|
|
|
@ -13,17 +13,17 @@ 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) : Page(common)
|
||||||
commonData = &common;
|
{
|
||||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageBattery2");
|
logger->logDebug(GwLog::LOG, "Instantiate PageBattery2");
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void setupKeys(){
|
void setupKeys(){
|
||||||
Page::setupKeys();
|
Page::setupKeys();
|
||||||
commonData->keydata[0].label = "AVG";
|
commonData->keydata[0].label = "AVG";
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int handleKey(int key){
|
int handleKey(int key) {
|
||||||
// Change average
|
// Change average
|
||||||
if(key == 1){
|
if(key == 1){
|
||||||
average ++;
|
average ++;
|
||||||
|
@ -45,11 +45,7 @@ public:
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
int displayPage(PageData &pageData)
|
int displayPage(PageData &pageData) {
|
||||||
{
|
|
||||||
GwConfigHandler *config = commonData->config;
|
|
||||||
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
|
||||||
float x0[4] = {+3082.5178, +1656.1571, +1316.8766, +14986.9336}; // Offset
|
float x0[4] = {+3082.5178, +1656.1571, +1316.8766, +14986.9336}; // Offset
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
class PageClock : public Page
|
class PageClock : public Page
|
||||||
{
|
{
|
||||||
|
private:
|
||||||
bool simulation = false;
|
bool simulation = false;
|
||||||
int simtime;
|
int simtime;
|
||||||
bool keylock = false;
|
bool keylock = false;
|
||||||
|
@ -29,22 +30,22 @@ double homelon;
|
||||||
bool homevalid = false; // homelat and homelon are valid
|
bool homevalid = false; // homelat and homelon are valid
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageClock(CommonData &common){
|
PageClock(CommonData &common) : Page(common)
|
||||||
commonData = &common;
|
{
|
||||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageClock");
|
logger->logDebug(GwLog::LOG, "Instantiate PageClock");
|
||||||
|
|
||||||
// WIP time source
|
// WIP time source
|
||||||
#ifdef BOARD_OBP60S3
|
#ifdef BOARD_OBP60S3
|
||||||
String use_rtc = common.config->getString(common.config->useRTC);
|
String use_rtc = config->getString(config->useRTC);
|
||||||
if (use_rtc == "off") {
|
if (use_rtc == "off") {
|
||||||
source = 'G';
|
source = 'G';
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
simulation = common.config->getBool(common.config->useSimuData);
|
simulation = config->getBool(config->useSimuData);
|
||||||
timezone = common.config->getString(common.config->timeZone).toDouble();
|
timezone = config->getString(config->timeZone).toDouble();
|
||||||
homelat = common.config->getString(common.config->homeLAT).toDouble();
|
homelat = config->getString(config->homeLAT).toDouble();
|
||||||
homelon = common.config->getString(common.config->homeLON).toDouble();
|
homelon = config->getString(config->homeLON).toDouble();
|
||||||
homevalid = homelat >= -180.0 and homelat <= 180 and homelon >= -90.0 and homelon <= 90.0;
|
homevalid = homelat >= -180.0 and homelat <= 180 and homelon >= -90.0 and homelon <= 90.0;
|
||||||
simtime = 38160; // time value 11:36
|
simtime = 38160; // time value 11:36
|
||||||
}
|
}
|
||||||
|
@ -97,9 +98,6 @@ bool homevalid = false; // homelat and homelon are valid
|
||||||
|
|
||||||
int displayPage(PageData &pageData)
|
int displayPage(PageData &pageData)
|
||||||
{
|
{
|
||||||
GwConfigHandler *config = commonData->config;
|
|
||||||
GwLog *logger = commonData->logger;
|
|
||||||
|
|
||||||
static String svalue1old = "";
|
static String svalue1old = "";
|
||||||
static String unit1old = "";
|
static String unit1old = "";
|
||||||
static String svalue2old = "";
|
static String svalue2old = "";
|
||||||
|
|
|
@ -29,9 +29,9 @@ class PageCompass : public Page
|
||||||
int WhichDataDisplay = ShowHDM;
|
int WhichDataDisplay = ShowHDM;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageCompass(CommonData &common){
|
PageCompass(CommonData &common) : Page(common)
|
||||||
commonData = &common;
|
{
|
||||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageCompass");
|
logger->logDebug(GwLog::LOG, "Instantiate PageCompass");
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void setupKeys(){
|
virtual void setupKeys(){
|
||||||
|
@ -63,8 +63,6 @@ class PageCompass : public Page
|
||||||
}
|
}
|
||||||
|
|
||||||
int displayPage(PageData &pageData){
|
int displayPage(PageData &pageData){
|
||||||
GwConfigHandler *config = commonData->config;
|
|
||||||
GwLog *logger = commonData->logger;
|
|
||||||
|
|
||||||
// Old values for hold function
|
// Old values for hold function
|
||||||
static String OldDataText[HowManyValues] = {"", "", "","", "", ""};
|
static String OldDataText[HowManyValues] = {"", "", "","", "", ""};
|
||||||
|
|
|
@ -7,9 +7,9 @@
|
||||||
class PageDST810 : public Page
|
class PageDST810 : public Page
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PageDST810(CommonData &common){
|
PageDST810(CommonData &common) : Page(common)
|
||||||
commonData = &common;
|
{
|
||||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageDST810");
|
logger->logDebug(GwLog::LOG, "Instantiate PageDST810");
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int handleKey(int key){
|
virtual int handleKey(int key){
|
||||||
|
@ -22,8 +22,6 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
int displayPage(PageData &pageData){
|
int displayPage(PageData &pageData){
|
||||||
GwConfigHandler *config = commonData->config;
|
|
||||||
GwLog *logger = commonData->logger;
|
|
||||||
|
|
||||||
// Old values for hold function
|
// Old values for hold function
|
||||||
static String svalue1old = "";
|
static String svalue1old = "";
|
||||||
|
|
|
@ -12,8 +12,6 @@
|
||||||
class PageEPropulsion : public Page
|
class PageEPropulsion : public Page
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
GwConfigHandler *config;
|
|
||||||
GwLog *logger;
|
|
||||||
bool simulation = false;
|
bool simulation = false;
|
||||||
bool holdvalues = false;
|
bool holdvalues = false;
|
||||||
String flashLED;
|
String flashLED;
|
||||||
|
@ -48,11 +46,8 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageEPropulsion(CommonData &common)
|
PageEPropulsion(CommonData &common) : Page(common)
|
||||||
{
|
{
|
||||||
commonData = &common;
|
|
||||||
config = commonData->config;
|
|
||||||
logger = commonData->logger;
|
|
||||||
logger->logDebug(GwLog::LOG,"Instantiate PageEPropulsion");
|
logger->logDebug(GwLog::LOG,"Instantiate PageEPropulsion");
|
||||||
|
|
||||||
// preload configuration data
|
// preload configuration data
|
||||||
|
|
|
@ -75,11 +75,11 @@ class PageFluid : public Page
|
||||||
int fluidtype;
|
int fluidtype;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageFluid(CommonData &common){
|
PageFluid(CommonData &common) : Page(common)
|
||||||
commonData = &common;
|
{
|
||||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageFluid");
|
logger->logDebug(GwLog::LOG,"Instantiate PageFluid");
|
||||||
simulation = common.config->getBool(common.config->useSimuData);
|
simulation = config->getBool(config->useSimuData);
|
||||||
holdvalues = common.config->getBool(common.config->holdvalues);
|
holdvalues = config->getBool(config->holdvalues);
|
||||||
simval = double(random(0, 100));
|
simval = double(random(0, 100));
|
||||||
simgoto = double(random(0, 100));
|
simgoto = double(random(0, 100));
|
||||||
simstep = (simgoto - simval) / 20.0;
|
simstep = (simgoto - simval) / 20.0;
|
||||||
|
@ -95,13 +95,11 @@ class PageFluid : public Page
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void displayNew(PageData &pageData){
|
virtual void displayNew(PageData &pageData){
|
||||||
fluidtype = commonData->config->getInt("page" + String(pageData.pageNumber) + "fluid", 0);
|
fluidtype = config->getInt("page" + String(pageData.pageNumber) + "fluid", 0);
|
||||||
commonData->logger->logDebug(GwLog::LOG,"New PageFluid: fluidtype=%d", fluidtype);
|
logger->logDebug(GwLog::LOG, "New PageFluid: fluidtype=%d", fluidtype);
|
||||||
}
|
}
|
||||||
|
|
||||||
int displayPage(PageData &pageData){
|
int displayPage(PageData &pageData){
|
||||||
GwConfigHandler *config = commonData->config;
|
|
||||||
GwLog *logger = commonData->logger;
|
|
||||||
|
|
||||||
// Old values for hold function
|
// Old values for hold function
|
||||||
static double value1old;
|
static double value1old;
|
||||||
|
|
|
@ -8,12 +8,12 @@
|
||||||
class PageFourValues : public Page
|
class PageFourValues : public Page
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PageFourValues(CommonData &common){
|
PageFourValues(CommonData &common) : Page(common)
|
||||||
commonData = &common;
|
{
|
||||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageFourValues");
|
logger->logDebug(GwLog::LOG, "Instantiate PageFourValues");
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int handleKey(int key){
|
int handleKey(int key){
|
||||||
// Code for keylock
|
// Code for keylock
|
||||||
if(key == 11){
|
if(key == 11){
|
||||||
commonData->keylock = !commonData->keylock;
|
commonData->keylock = !commonData->keylock;
|
||||||
|
@ -23,8 +23,6 @@ class PageFourValues : public Page
|
||||||
}
|
}
|
||||||
|
|
||||||
int displayPage(PageData &pageData){
|
int displayPage(PageData &pageData){
|
||||||
GwConfigHandler *config = commonData->config;
|
|
||||||
GwLog *logger = commonData->logger;
|
|
||||||
|
|
||||||
// Old values for hold function
|
// Old values for hold function
|
||||||
static String svalue1old = "";
|
static String svalue1old = "";
|
||||||
|
|
|
@ -8,9 +8,9 @@
|
||||||
class PageFourValues2 : public Page
|
class PageFourValues2 : public Page
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PageFourValues2(CommonData &common){
|
PageFourValues2(CommonData &common) : Page(common)
|
||||||
commonData = &common;
|
{
|
||||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageFourValues2");
|
logger->logDebug(GwLog::LOG,"Instantiate PageFourValues2");
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int handleKey(int key){
|
virtual int handleKey(int key){
|
||||||
|
@ -23,8 +23,6 @@ class PageFourValues2 : public Page
|
||||||
}
|
}
|
||||||
|
|
||||||
int displayPage(PageData &pageData){
|
int displayPage(PageData &pageData){
|
||||||
GwConfigHandler *config = commonData->config;
|
|
||||||
GwLog *logger = commonData->logger;
|
|
||||||
|
|
||||||
// Old values for hold function
|
// Old values for hold function
|
||||||
static String svalue1old = "";
|
static String svalue1old = "";
|
||||||
|
|
|
@ -8,11 +8,12 @@
|
||||||
class PageGenerator : public Page
|
class PageGenerator : public Page
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PageGenerator(CommonData &common){
|
PageGenerator(CommonData &common) : Page(common)
|
||||||
commonData = &common;
|
{
|
||||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageGenerator");
|
logger->logDebug(GwLog::LOG, "Instantiate PageGenerator");
|
||||||
}
|
}
|
||||||
virtual int handleKey(int key){
|
|
||||||
|
int handleKey(int key){
|
||||||
// Code for keylock
|
// Code for keylock
|
||||||
if(key == 11){
|
if(key == 11){
|
||||||
commonData->keylock = !commonData->keylock;
|
commonData->keylock = !commonData->keylock;
|
||||||
|
@ -21,10 +22,7 @@ public:
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
int displayPage(PageData &pageData)
|
int displayPage(PageData &pageData) {
|
||||||
{
|
|
||||||
GwConfigHandler *config = commonData->config;
|
|
||||||
GwLog *logger = commonData->logger;
|
|
||||||
|
|
||||||
// Get config data
|
// Get config data
|
||||||
bool simulation = config->getBool(config->useSimuData);
|
bool simulation = config->getBool(config->useSimuData);
|
||||||
|
|
|
@ -7,13 +7,13 @@
|
||||||
class PageKeelPosition : public Page
|
class PageKeelPosition : public Page
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PageKeelPosition(CommonData &common){
|
PageKeelPosition(CommonData &common) : Page(common)
|
||||||
commonData = &common;
|
{
|
||||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageKeelPosition");
|
logger->logDebug(GwLog::LOG, "Instantiate PageKeelPosition");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Key functions
|
// Key functions
|
||||||
virtual int handleKey(int key){
|
int handleKey(int key){
|
||||||
// Code for keylock
|
// Code for keylock
|
||||||
if(key == 11){
|
if(key == 11){
|
||||||
commonData->keylock = !commonData->keylock;
|
commonData->keylock = !commonData->keylock;
|
||||||
|
@ -22,10 +22,7 @@ public:
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
int displayPage(PageData &pageData)
|
int displayPage(PageData &pageData) {
|
||||||
{
|
|
||||||
GwConfigHandler *config = commonData->config;
|
|
||||||
GwLog *logger = commonData->logger;
|
|
||||||
|
|
||||||
double value1 = 0;
|
double value1 = 0;
|
||||||
double value1old = 0;
|
double value1old = 0;
|
||||||
|
|
|
@ -8,12 +8,12 @@
|
||||||
class PageOneValue : public Page
|
class PageOneValue : public Page
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PageOneValue(CommonData &common){
|
PageOneValue(CommonData &common) : Page(common)
|
||||||
commonData = &common;
|
{
|
||||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageOneValue");
|
logger->logDebug(GwLog::LOG, "Instantiate PageOneValue");
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int handleKey(int key){
|
int handleKey(int key) {
|
||||||
// Code for keylock
|
// Code for keylock
|
||||||
if(key == 11){
|
if(key == 11){
|
||||||
commonData->keylock = !commonData->keylock;
|
commonData->keylock = !commonData->keylock;
|
||||||
|
@ -23,8 +23,6 @@ class PageOneValue : public Page
|
||||||
}
|
}
|
||||||
|
|
||||||
int displayPage(PageData &pageData) {
|
int displayPage(PageData &pageData) {
|
||||||
GwConfigHandler *config = commonData->config;
|
|
||||||
GwLog *logger = commonData->logger;
|
|
||||||
|
|
||||||
// Old values for hold function
|
// Old values for hold function
|
||||||
static String svalue1old = "";
|
static String svalue1old = "";
|
||||||
|
|
|
@ -7,13 +7,13 @@
|
||||||
class PageRollPitch : public Page
|
class PageRollPitch : public Page
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PageRollPitch(CommonData &common){
|
PageRollPitch(CommonData &common) : Page(common)
|
||||||
commonData = &common;
|
{
|
||||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageRollPitch");
|
logger->logDebug(GwLog::LOG, "Instantiate PageRollPitch");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Key functions
|
// Key functions
|
||||||
virtual int handleKey(int key){
|
int handleKey(int key){
|
||||||
// Code for keylock
|
// Code for keylock
|
||||||
if(key == 11){
|
if(key == 11){
|
||||||
commonData->keylock = !commonData->keylock;
|
commonData->keylock = !commonData->keylock;
|
||||||
|
@ -23,8 +23,6 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
int displayPage(PageData &pageData) {
|
int displayPage(PageData &pageData) {
|
||||||
GwConfigHandler *config = commonData->config;
|
|
||||||
GwLog *logger = commonData->logger;
|
|
||||||
|
|
||||||
double value1 = 0;
|
double value1 = 0;
|
||||||
double value2 = 0;
|
double value2 = 0;
|
||||||
|
@ -33,7 +31,6 @@ public:
|
||||||
String svalue2 = "";
|
String svalue2 = "";
|
||||||
String svalue2old = "";
|
String svalue2old = "";
|
||||||
|
|
||||||
|
|
||||||
// Get config data
|
// Get config data
|
||||||
String lengthformat = config->getString(config->lengthFormat);
|
String lengthformat = config->getString(config->lengthFormat);
|
||||||
bool simulation = config->getBool(config->useSimuData);
|
bool simulation = config->getBool(config->useSimuData);
|
||||||
|
|
|
@ -8,13 +8,13 @@
|
||||||
class PageRudderPosition : public Page
|
class PageRudderPosition : public Page
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PageRudderPosition(CommonData &common){
|
PageRudderPosition(CommonData &common) : Page(common)
|
||||||
commonData = &common;
|
{
|
||||||
common.logger->logDebug(GwLog::LOG,"Show PageRudderPosition");
|
logger->logDebug(GwLog::LOG, "Show PageRudderPosition");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Key functions
|
// Key functions
|
||||||
virtual int handleKey(int key){
|
int handleKey(int key){
|
||||||
// Code for keylock
|
// Code for keylock
|
||||||
if(key == 11){
|
if(key == 11){
|
||||||
commonData->keylock = !commonData->keylock;
|
commonData->keylock = !commonData->keylock;
|
||||||
|
@ -24,8 +24,6 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
int displayPage(PageData &pageData) {
|
int displayPage(PageData &pageData) {
|
||||||
GwConfigHandler *config = commonData->config;
|
|
||||||
GwLog *logger = commonData->logger;
|
|
||||||
|
|
||||||
static String unit1old = "";
|
static String unit1old = "";
|
||||||
double value1 = 0.1;
|
double value1 = 0.1;
|
||||||
|
|
|
@ -16,9 +16,9 @@ const int HowManyValues = 6;
|
||||||
class PageSixValues : public Page
|
class PageSixValues : public Page
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PageSixValues(CommonData &common){
|
PageSixValues(CommonData &common) : Page(common)
|
||||||
commonData = &common;
|
{
|
||||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageSixValues");
|
logger->logDebug(GwLog::LOG, "Instantiate PageSixValues");
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int handleKey(int key){
|
virtual int handleKey(int key){
|
||||||
|
@ -31,9 +31,6 @@ class PageSixValues : public Page
|
||||||
}
|
}
|
||||||
|
|
||||||
int displayPage(PageData &pageData) {
|
int displayPage(PageData &pageData) {
|
||||||
GwConfigHandler *config = commonData->config;
|
|
||||||
GwLog *logger = commonData->logger;
|
|
||||||
|
|
||||||
|
|
||||||
// Old values for hold function
|
// Old values for hold function
|
||||||
static String OldDataText[HowManyValues] = {"", "", "", "", "", ""};
|
static String OldDataText[HowManyValues] = {"", "", "", "", "", ""};
|
||||||
|
@ -102,8 +99,7 @@ class PageSixValues : public Page
|
||||||
epd->setCursor(x0, y0+72);
|
epd->setCursor(x0, y0+72);
|
||||||
if (holdvalues == false) {
|
if (holdvalues == false) {
|
||||||
epd->print(DataUnits[ValueIndex]); // Unit
|
epd->print(DataUnits[ValueIndex]); // Unit
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
epd->print(OldDataUnits[ValueIndex]);
|
epd->print(OldDataUnits[ValueIndex]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,32 +124,33 @@ class PageSixValues : public Page
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
epd->setFont(&DSEG7Classic_BoldItalic26pt7b);
|
epd->setFont(&DSEG7Classic_BoldItalic26pt7b);
|
||||||
if ( DataText[ValueIndex][0] == '-' )
|
if (DataText[ValueIndex][0] == '-' ) {
|
||||||
epd->setCursor(x0+25, y0+70);
|
epd->setCursor(x0+25, y0+70);
|
||||||
else
|
} else {
|
||||||
epd->setCursor(x0+65, y0+70);
|
epd->setCursor(x0+65, y0+70);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Show bus data
|
// Show bus data
|
||||||
if (holdvalues == false) {
|
if (holdvalues == false) {
|
||||||
epd->print(DataText[ValueIndex]); // Real value as formated string
|
epd->print(DataText[ValueIndex]); // Real value as formated string
|
||||||
}
|
} else{
|
||||||
else{
|
|
||||||
epd->print(OldDataText[ValueIndex]); // Old value as formated string
|
epd->print(OldDataText[ValueIndex]); // Old value as formated string
|
||||||
}
|
}
|
||||||
if (DataValid[ValueIndex] == true) {
|
if (DataValid[ValueIndex] == true) {
|
||||||
OldDataText[ValueIndex] = DataText[ValueIndex]; // Save the old value
|
OldDataText[ValueIndex] = DataText[ValueIndex]; // Save the old value
|
||||||
OldDataUnits[ValueIndex] = DataUnits[ValueIndex]; // Save the old unit
|
OldDataUnits[ValueIndex] = DataUnits[ValueIndex]; // Save the old unit
|
||||||
}
|
}
|
||||||
}
|
} // for j
|
||||||
// Vertical line 3 pix
|
// Vertical line 3 pix
|
||||||
epd->fillRect(SixValues_x1+SixValues_DeltaX-8, SixValues_y1+i*SixValues_DeltaY, 3, SixValues_DeltaY, commonData->fgcolor);
|
epd->fillRect(SixValues_x1+SixValues_DeltaX-8, SixValues_y1+i*SixValues_DeltaY, 3, SixValues_DeltaY, commonData->fgcolor);
|
||||||
}
|
} // for i
|
||||||
|
|
||||||
return PAGE_UPDATE;
|
return PAGE_UPDATE;
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static Page *createPage(CommonData &common){
|
static Page *createPage(CommonData &common){
|
||||||
return new PageSixValues(common);
|
return new PageSixValues(common);
|
||||||
}/**
|
}/**
|
||||||
|
|
|
@ -11,9 +11,9 @@
|
||||||
class PageSkyView : public Page
|
class PageSkyView : public Page
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PageSkyView(CommonData &common){
|
PageSkyView(CommonData &common) : Page(common)
|
||||||
commonData = &common;
|
{
|
||||||
common.logger->logDebug(GwLog::LOG,"Show PageSkyView");
|
logger->logDebug(GwLog::LOG,"Instantiate PageSkyView");
|
||||||
}
|
}
|
||||||
|
|
||||||
int handleKey(int key){
|
int handleKey(int key){
|
||||||
|
@ -26,8 +26,6 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
int displayPage(PageData &pageData) {
|
int displayPage(PageData &pageData) {
|
||||||
GwConfigHandler *config = commonData->config;
|
|
||||||
GwLog *logger = commonData->logger;
|
|
||||||
|
|
||||||
// Get config data
|
// Get config data
|
||||||
String flashLED = config->getString(config->flashLED);
|
String flashLED = config->getString(config->flashLED);
|
||||||
|
@ -41,7 +39,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Logging boat values
|
// Logging boat values
|
||||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageSkyView");
|
logger->logDebug(GwLog::LOG, "Drawing at PageSkyView");
|
||||||
|
|
||||||
// Draw page
|
// Draw page
|
||||||
//***********************************************************
|
//***********************************************************
|
||||||
|
|
|
@ -8,11 +8,12 @@
|
||||||
class PageSolar : public Page
|
class PageSolar : public Page
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PageSolar(CommonData &common){
|
PageSolar(CommonData &common) : Page(common)
|
||||||
commonData = &common;
|
{
|
||||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageSolar");
|
logger->logDebug(GwLog::LOG,"Instantiate PageSolar");
|
||||||
}
|
}
|
||||||
virtual int handleKey(int key){
|
|
||||||
|
int handleKey(int key){
|
||||||
// Code for keylock
|
// Code for keylock
|
||||||
if(key == 11){
|
if(key == 11){
|
||||||
commonData->keylock = !commonData->keylock;
|
commonData->keylock = !commonData->keylock;
|
||||||
|
@ -22,8 +23,6 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
int displayPage(PageData &pageData) {
|
int displayPage(PageData &pageData) {
|
||||||
GwConfigHandler *config = commonData->config;
|
|
||||||
GwLog *logger = commonData->logger;
|
|
||||||
|
|
||||||
// Get config data
|
// Get config data
|
||||||
bool simulation = config->getBool(config->useSimuData);
|
bool simulation = config->getBool(config->useSimuData);
|
||||||
|
|
|
@ -267,7 +267,7 @@ private:
|
||||||
for (int i = 0 ; i < menu->getItemCount(); i++) {
|
for (int i = 0 ; i < menu->getItemCount(); i++) {
|
||||||
ConfigMenuItem *itm = menu->getItemByIndex(i);
|
ConfigMenuItem *itm = menu->getItemByIndex(i);
|
||||||
if (!itm) {
|
if (!itm) {
|
||||||
LOG_DEBUG(GwLog::ERROR, "Menu item not found: %d", i);
|
logger->logDebug(GwLog::ERROR, "Menu item not found: %d", i);
|
||||||
} else {
|
} else {
|
||||||
Rect r = menu->getItemRect(i);
|
Rect r = menu->getItemRect(i);
|
||||||
bool inverted = (i == menu->getActiveIndex());
|
bool inverted = (i == menu->getActiveIndex());
|
||||||
|
@ -416,36 +416,33 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageSystem(CommonData &common){
|
PageSystem(CommonData &common) : Page(common)
|
||||||
commonData = &common;
|
{
|
||||||
config = commonData->config;
|
|
||||||
logger = commonData->logger;
|
|
||||||
|
|
||||||
logger->logDebug(GwLog::LOG, "Instantiate PageSystem");
|
logger->logDebug(GwLog::LOG, "Instantiate PageSystem");
|
||||||
if (hasFRAM) {
|
if (hasFRAM) {
|
||||||
mode = fram.read(FRAM_SYSTEM_MODE);
|
mode = fram.read(FRAM_SYSTEM_MODE);
|
||||||
logger->logDebug(GwLog::LOG, "Loaded mode '%c' from FRAM", mode);
|
logger->logDebug(GwLog::LOG, "Loaded mode '%c' from FRAM", mode);
|
||||||
}
|
}
|
||||||
flashLED = common.config->getString(common.config->flashLED);
|
flashLED = config->getString(config->flashLED);
|
||||||
|
|
||||||
chipid = ESP.getEfuseMac();
|
chipid = ESP.getEfuseMac();
|
||||||
simulation = common.config->getBool(common.config->useSimuData);
|
simulation = config->getBool(config->useSimuData);
|
||||||
#ifdef BOARD_OBP40S3
|
#ifdef BOARD_OBP40S3
|
||||||
sdcard = common.config->getBool(common.config->useSDCard);
|
sdcard = config->getBool(config->useSDCard);
|
||||||
#endif
|
#endif
|
||||||
buzzer_mode = common.config->getString(common.config->buzzerMode);
|
buzzer_mode = config->getString(config->buzzerMode);
|
||||||
buzzer_mode.toLowerCase();
|
buzzer_mode.toLowerCase();
|
||||||
buzzer_power = common.config->getInt(common.config->buzzerPower);
|
buzzer_power = config->getInt(config->buzzerPower);
|
||||||
cpuspeed = common.config->getString(common.config->cpuSpeed);
|
cpuspeed = config->getString(config->cpuSpeed);
|
||||||
env_module = common.config->getString(common.config->useEnvSensor);
|
env_module = config->getString(config->useEnvSensor);
|
||||||
rtc_module = common.config->getString(common.config->useRTC);
|
rtc_module = config->getString(config->useRTC);
|
||||||
gps_module = common.config->getString(common.config->useGPS);
|
gps_module = config->getString(config->useGPS);
|
||||||
batt_sensor = common.config->getString(common.config->usePowSensor1);
|
batt_sensor = config->getString(config->usePowSensor1);
|
||||||
solar_sensor = common.config->getString(common.config->usePowSensor2);
|
solar_sensor = config->getString(config->usePowSensor2);
|
||||||
gen_sensor = common.config->getString(common.config->usePowSensor3);
|
gen_sensor = config->getString(config->usePowSensor3);
|
||||||
rot_sensor = common.config->getString(common.config->useRotSensor);
|
rot_sensor = config->getString(config->useRotSensor);
|
||||||
homelat = common.config->getString(common.config->homeLAT).toDouble();
|
homelat = config->getString(config->homeLAT).toDouble();
|
||||||
homelon = common.config->getString(common.config->homeLON).toDouble();
|
homelon = config->getString(config->homeLON).toDouble();
|
||||||
|
|
||||||
// CPU speed: 80 | 160 | 240
|
// CPU speed: 80 | 160 | 240
|
||||||
// Power mode: Max | 5V | Min
|
// Power mode: Max | 5V | Min
|
||||||
|
@ -478,7 +475,7 @@ public:
|
||||||
virtual int handleKey(int key){
|
virtual int handleKey(int key){
|
||||||
// do *NOT* handle key #1 this handled by obp60task as exit
|
// do *NOT* handle key #1 this handled by obp60task as exit
|
||||||
// Switch display mode
|
// Switch display mode
|
||||||
commonData->logger->logDebug(GwLog::LOG, "System keyboard handler");
|
logger->logDebug(GwLog::LOG, "System keyboard handler");
|
||||||
if (key == 2) {
|
if (key == 2) {
|
||||||
incMode();
|
incMode();
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -547,14 +544,12 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void displayNew(PageData &pageData){
|
void displayNew(PageData &pageData){
|
||||||
|
// Get references from API
|
||||||
|
NMEA2000 = pageData.api->getNMEA2000();
|
||||||
};
|
};
|
||||||
|
|
||||||
int displayPage(PageData &pageData){
|
int displayPage(PageData &pageData){
|
||||||
// GwConfigHandler *config = commonData->config;
|
|
||||||
// GwLog *logger = commonData->logger;
|
|
||||||
|
|
||||||
NMEA2000 = pageData.api->getNMEA2000();
|
|
||||||
logger->logDebug(GwLog::LOG, "PageSystem: N2k source address=%d", NMEA2000->GetN2kSource());
|
|
||||||
|
|
||||||
// Optical warning by limit violation (unused)
|
// Optical warning by limit violation (unused)
|
||||||
if(flashLED == "Limit Violation"){
|
if(flashLED == "Limit Violation"){
|
||||||
|
@ -565,10 +560,6 @@ public:
|
||||||
// Logging page information
|
// Logging page information
|
||||||
logger->logDebug(GwLog::LOG, "Drawing at PageSystem, Mode=%c", mode);
|
logger->logDebug(GwLog::LOG, "Drawing at PageSystem, Mode=%c", mode);
|
||||||
|
|
||||||
// Get references from API
|
|
||||||
// NMEA2000 = pageData.api->getNMEA2000();
|
|
||||||
// LOG_DEBUG(GwLog::LOG,"N2k source address=%d", NMEA2000->GetN2kSource());
|
|
||||||
|
|
||||||
// Set display in partial refresh mode
|
// Set display in partial refresh mode
|
||||||
epd->setPartialWindow(0, 0, epd->width(), epd->height());
|
epd->setPartialWindow(0, 0, epd->width(), epd->height());
|
||||||
|
|
||||||
|
|
|
@ -8,12 +8,12 @@
|
||||||
class PageThreeValues : public Page
|
class PageThreeValues : public Page
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PageThreeValues(CommonData &common){
|
PageThreeValues(CommonData &common) : Page(common)
|
||||||
commonData = &common;
|
{
|
||||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageThreeValue");
|
logger->logDebug(GwLog::LOG, "Instantiate PageThreeValue");
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int handleKey(int key){
|
int handleKey(int key){
|
||||||
// Code for keylock
|
// Code for keylock
|
||||||
if(key == 11){
|
if(key == 11){
|
||||||
commonData->keylock = !commonData->keylock;
|
commonData->keylock = !commonData->keylock;
|
||||||
|
@ -23,8 +23,6 @@ class PageThreeValues : public Page
|
||||||
}
|
}
|
||||||
|
|
||||||
int displayPage(PageData &pageData) {
|
int displayPage(PageData &pageData) {
|
||||||
GwConfigHandler *config = commonData->config;
|
|
||||||
GwLog *logger = commonData->logger;
|
|
||||||
|
|
||||||
// Old values for hold function
|
// Old values for hold function
|
||||||
static String svalue1old = "";
|
static String svalue1old = "";
|
||||||
|
|
|
@ -8,12 +8,12 @@
|
||||||
class PageTwoValues : public Page
|
class PageTwoValues : public Page
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PageTwoValues(CommonData &common){
|
PageTwoValues(CommonData &common) : Page(common)
|
||||||
commonData = &common;
|
{
|
||||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageTwoValue");
|
logger->logDebug(GwLog::LOG, "Instantiate PageTwoValue");
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int handleKey(int key){
|
int handleKey(int key){
|
||||||
// Code for keylock
|
// Code for keylock
|
||||||
if(key == 11){
|
if(key == 11){
|
||||||
commonData->keylock = !commonData->keylock;
|
commonData->keylock = !commonData->keylock;
|
||||||
|
@ -23,8 +23,6 @@ class PageTwoValues : public Page
|
||||||
}
|
}
|
||||||
|
|
||||||
int displayPage(PageData &pageData) {
|
int displayPage(PageData &pageData) {
|
||||||
GwConfigHandler *config = commonData->config;
|
|
||||||
GwLog *logger = commonData->logger;
|
|
||||||
|
|
||||||
// Old values for hold function
|
// Old values for hold function
|
||||||
static String svalue1old = "";
|
static String svalue1old = "";
|
||||||
|
|
|
@ -15,11 +15,8 @@ private:
|
||||||
char mode = 'D'; // display mode (A)nalog | (D)igital
|
char mode = 'D'; // display mode (A)nalog | (D)igital
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageVoltage(CommonData &common){
|
PageVoltage(CommonData &common) : Page(common)
|
||||||
commonData = &common;
|
{
|
||||||
config = commonData->config;
|
|
||||||
logger = commonData->logger;
|
|
||||||
|
|
||||||
logger->logDebug(GwLog::LOG, "Instantiate PageVoltage");
|
logger->logDebug(GwLog::LOG, "Instantiate PageVoltage");
|
||||||
if (hasFRAM) {
|
if (hasFRAM) {
|
||||||
average = fram.read(FRAM_VOLTAGE_AVG);
|
average = fram.read(FRAM_VOLTAGE_AVG);
|
||||||
|
@ -32,14 +29,14 @@ public:
|
||||||
logger->logDebug(GwLog::LOG, "Destroy PageVoltage");
|
logger->logDebug(GwLog::LOG, "Destroy PageVoltage");
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void setupKeys(){
|
void setupKeys(){
|
||||||
Page::setupKeys();
|
Page::setupKeys();
|
||||||
commonData->keydata[0].label = "AVG";
|
commonData->keydata[0].label = "AVG";
|
||||||
commonData->keydata[1].label = "MODE";
|
commonData->keydata[1].label = "MODE";
|
||||||
commonData->keydata[4].label = "TRD";
|
commonData->keydata[4].label = "TRD";
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int handleKey(int key){
|
int handleKey(int key){
|
||||||
// Change average
|
// Change average
|
||||||
if(key == 1){
|
if(key == 1){
|
||||||
average ++;
|
average ++;
|
||||||
|
@ -110,8 +107,6 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
int displayPage(PageData &pageData) {
|
int displayPage(PageData &pageData) {
|
||||||
GwConfigHandler *config = commonData->config;
|
|
||||||
GwLog *logger = commonData->logger;
|
|
||||||
|
|
||||||
// Get config data
|
// Get config data
|
||||||
bool simulation = config->getBool(config->useSimuData);
|
bool simulation = config->getBool(config->useSimuData);
|
||||||
|
|
|
@ -17,9 +17,9 @@ class PageWhite : public Page
|
||||||
char mode = 'W'; // display mode (W)hite | (L)ogo | (M)FD logo
|
char mode = 'W'; // display mode (W)hite | (L)ogo | (M)FD logo
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageWhite(CommonData &common){
|
PageWhite(CommonData &common) : Page(common)
|
||||||
commonData = &common;
|
{
|
||||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageWhite");
|
logger->logDebug(GwLog::LOG, "Instantiate PageWhite");
|
||||||
refreshtime = 15000;
|
refreshtime = 15000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,8 +39,6 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
int displayPage(PageData &pageData){
|
int displayPage(PageData &pageData){
|
||||||
GwConfigHandler *config = commonData->config;
|
|
||||||
GwLog *logger = commonData->logger;
|
|
||||||
|
|
||||||
// Get config data
|
// Get config data
|
||||||
String flashLED = config->getString(config->flashLED);
|
String flashLED = config->getString(config->flashLED);
|
||||||
|
|
|
@ -221,9 +221,9 @@ char mode = 'N'; // page mode (N)ormal | (L)ens | e(X)ample
|
||||||
char source = 'A'; // data source (A)pparent | (T)rue
|
char source = 'A'; // data source (A)pparent | (T)rue
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageWind(CommonData &common){
|
PageWind(CommonData &common) : Page(common)
|
||||||
commonData = &common;
|
{
|
||||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageWind");
|
logger->logDebug(GwLog::LOG, "Instantiate PageWind");
|
||||||
if (hasFRAM) {
|
if (hasFRAM) {
|
||||||
lp = fram.read(FRAM_WIND_SIZE);
|
lp = fram.read(FRAM_WIND_SIZE);
|
||||||
source = fram.read(FRAM_WIND_SRC);
|
source = fram.read(FRAM_WIND_SRC);
|
||||||
|
@ -231,7 +231,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void setupKeys(){
|
void setupKeys(){
|
||||||
Page::setupKeys();
|
Page::setupKeys();
|
||||||
commonData->keydata[0].label = "MODE";
|
commonData->keydata[0].label = "MODE";
|
||||||
if (mode == 'X') {
|
if (mode == 'X') {
|
||||||
|
@ -243,7 +243,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Key functions
|
// Key functions
|
||||||
virtual int handleKey(int key){
|
int handleKey(int key){
|
||||||
|
|
||||||
if(key == 1){ // Mode switch
|
if(key == 1){ // Mode switch
|
||||||
if(mode == 'N'){
|
if(mode == 'N'){
|
||||||
|
@ -297,10 +297,7 @@ public:
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
int displayPage(PageData &pageData)
|
int displayPage(PageData &pageData) {
|
||||||
{
|
|
||||||
GwConfigHandler *config = commonData->config;
|
|
||||||
GwLog *logger = commonData->logger;
|
|
||||||
|
|
||||||
static String svalue1old = "";
|
static String svalue1old = "";
|
||||||
static String unit1old = "";
|
static String unit1old = "";
|
||||||
|
|
|
@ -57,13 +57,12 @@ class PageWindPlot : public Page {
|
||||||
bool showTWS = true; // Show TWS value in chart area
|
bool showTWS = true; // Show TWS value in chart area
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageWindPlot(CommonData& common)
|
PageWindPlot(CommonData& common) : Page(common)
|
||||||
{
|
{
|
||||||
commonData = &common;
|
logger->logDebug(GwLog::LOG, "Instantiate PageWindPlot");
|
||||||
common.logger->logDebug(GwLog::LOG, "Instantiate PageWindPlot");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void setupKeys()
|
void setupKeys()
|
||||||
{
|
{
|
||||||
Page::setupKeys();
|
Page::setupKeys();
|
||||||
// commonData->keydata[0].label = "MODE";
|
// commonData->keydata[0].label = "MODE";
|
||||||
|
@ -72,7 +71,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Key functions
|
// Key functions
|
||||||
virtual int handleKey(int key)
|
int handleKey(int key)
|
||||||
{
|
{
|
||||||
// Set chart mode TWD | TWS -> to be implemented
|
// Set chart mode TWD | TWS -> to be implemented
|
||||||
if (key == 1) {
|
if (key == 1) {
|
||||||
|
@ -114,10 +113,7 @@ public:
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
int displayPage(PageData& pageData)
|
int displayPage(PageData& pageData) {
|
||||||
{
|
|
||||||
GwConfigHandler* config = commonData->config;
|
|
||||||
GwLog* logger = commonData->logger;
|
|
||||||
|
|
||||||
float twsValue; // TWS value in chart area
|
float twsValue; // TWS value in chart area
|
||||||
static String twdName, twdUnit; // TWD name and unit
|
static String twdName, twdUnit; // TWD name and unit
|
||||||
|
|
|
@ -10,13 +10,13 @@ class PageWindRose : public Page
|
||||||
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,"Instantiate PageWindRose");
|
logger->logDebug(GwLog::LOG, "Instantiate PageWindRose");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Key functions
|
// Key functions
|
||||||
virtual int handleKey(int key){
|
int handleKey(int key){
|
||||||
// Code for keylock
|
// Code for keylock
|
||||||
if(key == 11){
|
if(key == 11){
|
||||||
commonData->keylock = !commonData->keylock;
|
commonData->keylock = !commonData->keylock;
|
||||||
|
@ -26,8 +26,6 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
int displayPage(PageData &pageData) {
|
int displayPage(PageData &pageData) {
|
||||||
GwConfigHandler *config = commonData->config;
|
|
||||||
GwLog *logger = commonData->logger;
|
|
||||||
|
|
||||||
static String svalue1old = "";
|
static String svalue1old = "";
|
||||||
static String unit1old = "";
|
static String unit1old = "";
|
||||||
|
|
|
@ -10,13 +10,13 @@ class PageWindRoseFlex : public Page
|
||||||
int16_t lp = 80; // Pointer length
|
int16_t lp = 80; // Pointer length
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageWindRoseFlex(CommonData &common){
|
PageWindRoseFlex(CommonData &common) : Page(common)
|
||||||
commonData = &common;
|
{
|
||||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageWindRoseFlex");
|
logger->logDebug(GwLog::LOG, "Instantiate PageWindRoseFlex");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Key functions
|
// Key functions
|
||||||
virtual int handleKey(int key){
|
int handleKey(int key){
|
||||||
// Code for keylock
|
// Code for keylock
|
||||||
if(key == 11){
|
if(key == 11){
|
||||||
commonData->keylock = !commonData->keylock;
|
commonData->keylock = !commonData->keylock;
|
||||||
|
@ -26,8 +26,6 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
int displayPage(PageData &pageData){
|
int displayPage(PageData &pageData){
|
||||||
GwConfigHandler *config = commonData->config;
|
|
||||||
GwLog *logger = commonData->logger;
|
|
||||||
|
|
||||||
static String svalue1old = "";
|
static String svalue1old = "";
|
||||||
static String unit1old = "";
|
static String unit1old = "";
|
||||||
|
|
|
@ -33,11 +33,11 @@ class PageXTETrack : public Page
|
||||||
bool holdvalues = false;
|
bool holdvalues = false;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageXTETrack(CommonData &common){
|
PageXTETrack(CommonData &common) : Page(common)
|
||||||
commonData = &common;
|
{
|
||||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageXTETrack");
|
logger->logDebug(GwLog::LOG, "Instantiate PageXTETrack");
|
||||||
simulation = common.config->getBool(common.config->useSimuData);
|
simulation = config->getBool(config->useSimuData);
|
||||||
holdvalues = common.config->getBool(common.config->holdvalues);
|
holdvalues = config->getBool(config->holdvalues);
|
||||||
}
|
}
|
||||||
|
|
||||||
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,
|
||||||
|
|
|
@ -130,6 +130,12 @@ protected:
|
||||||
GwConfigHandler *config;
|
GwConfigHandler *config;
|
||||||
GwLog *logger;
|
GwLog *logger;
|
||||||
public:
|
public:
|
||||||
|
Page(){}
|
||||||
|
Page(CommonData &common) {
|
||||||
|
commonData = &common;
|
||||||
|
config = commonData->config;
|
||||||
|
logger = commonData->logger;
|
||||||
|
}
|
||||||
int refreshtime = 1000;
|
int refreshtime = 1000;
|
||||||
virtual int displayPage(PageData &pageData)=0;
|
virtual int displayPage(PageData &pageData)=0;
|
||||||
virtual void displayNew(PageData &pageData){}
|
virtual void displayNew(PageData &pageData){}
|
||||||
|
|
Loading…
Reference in New Issue