Move things to pagedata
This commit is contained in:
parent
15ca3614ba
commit
35c89dce42
|
@ -19,8 +19,6 @@
|
|||
class PageAIS : public Page
|
||||
{
|
||||
private:
|
||||
GwConfigHandler *config;
|
||||
GwLog *logger;
|
||||
bool simulation = false;
|
||||
bool holdvalues = false;
|
||||
String flashLED;
|
||||
|
@ -38,7 +36,7 @@ private:
|
|||
|
||||
// TBD Boatvalues: ...
|
||||
|
||||
LOG_DEBUG(GwLog::DEBUG,"Drawing at PageAIS");
|
||||
logger->logDebug(GwLog::DEBUG,"Drawing at PageAIS");
|
||||
|
||||
Point c = {200, 150}; // center = current boat position
|
||||
uint16_t r = 125;
|
||||
|
@ -84,12 +82,9 @@ private:
|
|||
}
|
||||
|
||||
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
|
||||
simulation = config->getBool(config->useSimuData);
|
||||
|
@ -148,7 +143,7 @@ public:
|
|||
int displayPage(PageData &pageData){
|
||||
|
||||
// Logging boat values
|
||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageAIS; Mode=%c", mode);
|
||||
logger->logDebug(GwLog::LOG, "Drawing at PageAIS; Mode=%c", mode);
|
||||
|
||||
// Set display in partial refresh mode
|
||||
epd->setPartialWindow(0, 0, epd->width(), epd->height());
|
||||
|
|
|
@ -100,7 +100,7 @@ private:
|
|||
String sval_hdop = formatValue(bv_hdop, *commonData).svalue;
|
||||
String sunit_hdop = formatValue(bv_hdop, *commonData).unit;
|
||||
|
||||
LOG_DEBUG(GwLog::DEBUG,"Drawing at PageAnchor; DBS=%f, HDT=%f, AWS=%f", bv_dbs->value, bv_hdt->value, bv_aws->value);
|
||||
logger->logDebug(GwLog::DEBUG, "Drawing at PageAnchor; DBS=%f, HDT=%f, AWS=%f", bv_dbs->value, bv_hdt->value, bv_aws->value);
|
||||
|
||||
Point c = {200, 150}; // center = anchor position
|
||||
uint16_t r = 125;
|
||||
|
@ -196,7 +196,7 @@ private:
|
|||
// alarm range in meter has to be smaller than the scale in meter
|
||||
// r and r_range are pixel values
|
||||
uint16_t r_range = int(alarm_range * r / scale);
|
||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageAnchor; Alarm range = %d", r_range);
|
||||
logger->logDebug(GwLog::LOG, "Drawing at PageAnchor; Alarm range = %d", r_range);
|
||||
epd->drawCircle(c.x, c.y, r_range, commonData->fgcolor);
|
||||
}
|
||||
|
||||
|
@ -222,7 +222,7 @@ private:
|
|||
for (int i = 0 ; i < menu->getItemCount(); i++) {
|
||||
ConfigMenuItem *itm = menu->getItemByIndex(i);
|
||||
if (!itm) {
|
||||
LOG_DEBUG(GwLog::ERROR, "Menu item not found: %d", i);
|
||||
logger->logDebug(GwLog::ERROR, "Menu item not found: %d", i);
|
||||
} else {
|
||||
Rect r = menu->getItemRect(i);
|
||||
bool inverted = (i == menu->getActiveIndex());
|
||||
|
@ -244,12 +244,9 @@ private:
|
|||
}
|
||||
|
||||
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
|
||||
simulation = config->getBool(config->useSimuData);
|
||||
|
@ -271,7 +268,7 @@ public:
|
|||
newitem = menu->addItem("chain", "Chain out", "int", 0, "m");
|
||||
if (! newitem) {
|
||||
// Demo: in case of failure exit here, should never be happen
|
||||
logger->logDebug(GwLog::ERROR,"Menu item creation failed");
|
||||
logger->logDebug(GwLog::ERROR, "Menu item creation failed");
|
||||
return;
|
||||
}
|
||||
newitem->setRange(0, 200, {1, 5, 10});
|
||||
|
@ -397,7 +394,7 @@ public:
|
|||
int displayPage(PageData &pageData){
|
||||
|
||||
// Logging boat values
|
||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageAnchor; Mode=%c", mode);
|
||||
logger->logDebug(GwLog::LOG, "Drawing at PageAnchor; Mode=%c", mode);
|
||||
|
||||
// Set display in partial refresh mode
|
||||
epd->setPartialWindow(0, 0, epd->width(), epd->height()); // Set partial update
|
||||
|
|
|
@ -25,7 +25,7 @@ private:
|
|||
|
||||
// TBD Boatvalues: ...
|
||||
|
||||
LOG_DEBUG(GwLog::DEBUG,"Drawing at PageAutopilot");
|
||||
logger->logDebug(GwLog::DEBUG, "Drawing at PageAutopilot");
|
||||
|
||||
// Title and corner value headings
|
||||
epd->setTextColor(commonData->fgcolor);
|
||||
|
@ -48,12 +48,9 @@ private:
|
|||
}
|
||||
|
||||
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
|
||||
simulation = config->getBool(config->useSimuData);
|
||||
|
@ -111,7 +108,7 @@ public:
|
|||
int displayPage(PageData &pageData){
|
||||
|
||||
// Logging boat values
|
||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageAutopilot; Mode=%c", mode);
|
||||
logger->logDebug(GwLog::LOG, "Drawing at PageAutopilot; Mode=%c", mode);
|
||||
|
||||
// Set display in partial refresh mode
|
||||
epd->setPartialWindow(0, 0, epd->width(), epd->height());
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
class PageBME280 : public Page
|
||||
{
|
||||
public:
|
||||
PageBME280(CommonData &common){
|
||||
commonData = &common;
|
||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageBME280");
|
||||
PageBME280(CommonData &common) : Page(common)
|
||||
{
|
||||
logger->logDebug(GwLog::LOG, "Instantiate PageBME280");
|
||||
}
|
||||
|
||||
virtual int handleKey(int key){
|
||||
|
@ -100,7 +100,7 @@ class PageBME280 : public Page
|
|||
}
|
||||
|
||||
// Logging boat values
|
||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageBME280, %s: %f, %s: %f, %s: %f", name1.c_str(), value1, name2.c_str(), value2, name3.c_str(), value3);
|
||||
logger->logDebug(GwLog::LOG, "Drawing at PageBME280, %s: %f, %s: %f, %s: %f", name1.c_str(), value1, name2.c_str(), value2, name3.c_str(), value3);
|
||||
|
||||
// Draw page
|
||||
//***********************************************************
|
||||
|
|
|
@ -9,9 +9,9 @@ class PageBattery : public Page
|
|||
int average = 0; // Average type [0...3], 0=off, 1=10s, 2=60s, 3=300s
|
||||
|
||||
public:
|
||||
PageBattery(CommonData &common){
|
||||
commonData = &common;
|
||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageBattery");
|
||||
PageBattery(CommonData &common) : Page(common)
|
||||
{
|
||||
logger->logDebug(GwLog::LOG, "Instantiate PageBattery");
|
||||
}
|
||||
|
||||
virtual void setupKeys(){
|
||||
|
@ -36,9 +36,7 @@ class PageBattery : public Page
|
|||
}
|
||||
|
||||
int displayPage(PageData &pageData){
|
||||
GwConfigHandler *config = commonData->config;
|
||||
GwLog *logger = commonData->logger;
|
||||
|
||||
|
||||
// Old values for hold function
|
||||
double value1 = 0;
|
||||
static String svalue1old = "";
|
||||
|
@ -153,7 +151,7 @@ class PageBattery : public Page
|
|||
}
|
||||
|
||||
// Logging boat values
|
||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageBattery, %s: %f, %s: %f, %s: %f, Avg: %d", name1.c_str(), value1, name2.c_str(), value2, name3.c_str(), value3, average);
|
||||
logger->logDebug(GwLog::LOG, "Drawing at PageBattery, %s: %f, %s: %f, %s: %f, Avg: %d", name1.c_str(), value1, name2.c_str(), value2, name3.c_str(), value3, average);
|
||||
|
||||
// Draw page
|
||||
//***********************************************************
|
||||
|
|
|
@ -13,9 +13,9 @@ bool trend = true; // Trend indicator [0|1], 0=off, 1=on
|
|||
double raw = 0;
|
||||
|
||||
public:
|
||||
PageBattery2(CommonData &common){
|
||||
commonData = &common;
|
||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageBattery2");
|
||||
PageBattery2(CommonData &common) : Page(common)
|
||||
{
|
||||
logger->logDebug(GwLog::LOG, "Instantiate PageBattery2");
|
||||
}
|
||||
|
||||
virtual void setupKeys(){
|
||||
|
@ -47,9 +47,6 @@ public:
|
|||
|
||||
int displayPage(PageData &pageData)
|
||||
{
|
||||
GwConfigHandler *config = commonData->config;
|
||||
GwLog *logger = commonData->logger;
|
||||
|
||||
// Polynominal coefficients second order for battery energy level calculation
|
||||
// index 0 = Pb, 1 = Gel, 2 = AGM, 3 = LiFePo4
|
||||
float x0[4] = {+3082.5178, +1656.1571, +1316.8766, +14986.9336}; // Offset
|
||||
|
@ -179,7 +176,7 @@ public:
|
|||
}
|
||||
|
||||
// Logging voltage value
|
||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageBattery2, Type:%s %s:=%f", batType.c_str(), name1.c_str(), raw);
|
||||
logger->logDebug(GwLog::LOG, "Drawing at PageBattery2, Type:%s %s:=%f", batType.c_str(), name1.c_str(), raw);
|
||||
|
||||
// Draw page
|
||||
//***********************************************************
|
||||
|
|
|
@ -29,22 +29,22 @@ double homelon;
|
|||
bool homevalid = false; // homelat and homelon are valid
|
||||
|
||||
public:
|
||||
PageClock(CommonData &common){
|
||||
commonData = &common;
|
||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageClock");
|
||||
PageClock(CommonData &common) : Page(common)
|
||||
{
|
||||
logger->logDebug(GwLog::LOG, "Instantiate PageClock");
|
||||
|
||||
// WIP time source
|
||||
#ifdef BOARD_OBP60S3
|
||||
String use_rtc = common.config->getString(common.config->useRTC);
|
||||
String use_rtc = config->getString(config->useRTC);
|
||||
if (use_rtc == "off") {
|
||||
source = 'G';
|
||||
}
|
||||
#endif
|
||||
|
||||
simulation = common.config->getBool(common.config->useSimuData);
|
||||
timezone = common.config->getString(common.config->timeZone).toDouble();
|
||||
homelat = common.config->getString(common.config->homeLAT).toDouble();
|
||||
homelon = common.config->getString(common.config->homeLON).toDouble();
|
||||
simulation = config->getBool(config->useSimuData);
|
||||
timezone = config->getString(config->timeZone).toDouble();
|
||||
homelat = config->getString(config->homeLAT).toDouble();
|
||||
homelon = config->getString(config->homeLON).toDouble();
|
||||
homevalid = homelat >= -180.0 and homelat <= 180 and homelon >= -90.0 and homelon <= 90.0;
|
||||
simtime = 38160; // time value 11:36
|
||||
}
|
||||
|
@ -97,9 +97,6 @@ bool homevalid = false; // homelat and homelon are valid
|
|||
|
||||
int displayPage(PageData &pageData)
|
||||
{
|
||||
GwConfigHandler *config = commonData->config;
|
||||
GwLog *logger = commonData->logger;
|
||||
|
||||
static String svalue1old = "";
|
||||
static String unit1old = "";
|
||||
static String svalue2old = "";
|
||||
|
@ -177,7 +174,7 @@ bool homevalid = false; // homelat and homelon are valid
|
|||
|
||||
// Logging boat values
|
||||
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
|
||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageClock, %s:%f, %s:%f, %s:%f", name1.c_str(), value1, name2.c_str(), value2, name3.c_str(), value3);
|
||||
logger->logDebug(GwLog::LOG, "Drawing at PageClock, %s:%f, %s:%f, %s:%f", name1.c_str(), value1, name2.c_str(), value2, name3.c_str(), value3);
|
||||
|
||||
// Draw page
|
||||
//***********************************************************
|
||||
|
@ -394,7 +391,7 @@ bool homevalid = false; // homelat and homelon are valid
|
|||
if (hour > 12) {
|
||||
hour -= 12.0;
|
||||
}
|
||||
LOG_DEBUG(GwLog::DEBUG,"... PageClock, value1: %f hour: %f minute:%f", value1, hour, minute);
|
||||
logger->logDebug(GwLog::DEBUG, "... PageClock, value1: %f hour: %f minute:%f", value1, hour, minute);
|
||||
|
||||
// Draw hour pointer
|
||||
float startwidth = 8; // Start width of pointer
|
||||
|
|
|
@ -29,9 +29,9 @@ class PageCompass : public Page
|
|||
int WhichDataDisplay = ShowHDM;
|
||||
|
||||
public:
|
||||
PageCompass(CommonData &common){
|
||||
commonData = &common;
|
||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageCompass");
|
||||
PageCompass(CommonData &common) : Page(common)
|
||||
{
|
||||
logger->logDebug(GwLog::LOG, "Instantiate PageCompass");
|
||||
}
|
||||
|
||||
virtual void setupKeys(){
|
||||
|
@ -63,8 +63,6 @@ class PageCompass : public Page
|
|||
}
|
||||
|
||||
int displayPage(PageData &pageData){
|
||||
GwConfigHandler *config = commonData->config;
|
||||
GwLog *logger = commonData->logger;
|
||||
|
||||
// Old values for hold function
|
||||
static String OldDataText[HowManyValues] = {"", "", "","", "", ""};
|
||||
|
@ -96,7 +94,7 @@ class PageCompass : public Page
|
|||
DataValue[i] = TheFormattedData.value; // Value as double in SI unit
|
||||
DataValid[i] = bvalue->valid;
|
||||
DataFormat[i] = bvalue->getFormat(); // Unit of value
|
||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageCompass: %d %s %f %s %s", i, DataName[i], DataValue[i], DataFormat[i], DataText[i] );
|
||||
logger->logDebug(GwLog::LOG, "Drawing at PageCompass: %d %s %f %s %s", i, DataName[i], DataValue[i], DataFormat[i], DataText[i] );
|
||||
}
|
||||
|
||||
// Optical warning by limit violation (unused)
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
class PageDST810 : public Page
|
||||
{
|
||||
public:
|
||||
PageDST810(CommonData &common){
|
||||
commonData = &common;
|
||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageDST810");
|
||||
PageDST810(CommonData &common) : Page(common)
|
||||
{
|
||||
logger->logDebug(GwLog::LOG, "Instantiate PageDST810");
|
||||
}
|
||||
|
||||
virtual int handleKey(int key){
|
||||
|
@ -22,8 +22,6 @@ public:
|
|||
}
|
||||
|
||||
int displayPage(PageData &pageData){
|
||||
GwConfigHandler *config = commonData->config;
|
||||
GwLog *logger = commonData->logger;
|
||||
|
||||
// Old values for hold function
|
||||
static String svalue1old = "";
|
||||
|
@ -86,7 +84,7 @@ public:
|
|||
|
||||
// Logging boat values
|
||||
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
|
||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageDST810, %s: %f, %s: %f, %s: %f, %s: %f", name1.c_str(), value1, name2.c_str(), value2, name3.c_str(), value3, name4.c_str(), value4);
|
||||
logger->logDebug(GwLog::LOG, "Drawing at PageDST810, %s: %f, %s: %f, %s: %f, %s: %f", name1.c_str(), value1, name2.c_str(), value2, name3.c_str(), value3, name4.c_str(), value4);
|
||||
|
||||
// Draw page
|
||||
//***********************************************************
|
||||
|
|
|
@ -25,7 +25,7 @@ private:
|
|||
|
||||
// TBD Boatvalues: ...
|
||||
|
||||
LOG_DEBUG(GwLog::DEBUG,"Drawing at PageEPropulsion");
|
||||
logger->logDebug(GwLog::DEBUG, "Drawing at PageEPropulsion");
|
||||
|
||||
// Title and corner value headings
|
||||
epd->setTextColor(commonData->fgcolor);
|
||||
|
@ -48,11 +48,8 @@ private:
|
|||
}
|
||||
|
||||
public:
|
||||
PageEPropulsion(CommonData &common)
|
||||
PageEPropulsion(CommonData &common) : Page(common)
|
||||
{
|
||||
commonData = &common;
|
||||
config = commonData->config;
|
||||
logger = commonData->logger;
|
||||
logger->logDebug(GwLog::LOG,"Instantiate PageEPropulsion");
|
||||
|
||||
// preload configuration data
|
||||
|
@ -110,7 +107,7 @@ public:
|
|||
int displayPage(PageData &pageData){
|
||||
|
||||
// Logging boat values
|
||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageEPropulsion; Mode=%c", mode);
|
||||
logger->logDebug(GwLog::LOG,"Drawing at PageEPropulsion; Mode=%c", mode);
|
||||
|
||||
// Set display in partial refresh mode
|
||||
epd->setPartialWindow(0, 0, epd->width(), epd->height());
|
||||
|
|
|
@ -75,11 +75,11 @@ class PageFluid : public Page
|
|||
int fluidtype;
|
||||
|
||||
public:
|
||||
PageFluid(CommonData &common){
|
||||
commonData = &common;
|
||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageFluid");
|
||||
simulation = common.config->getBool(common.config->useSimuData);
|
||||
holdvalues = common.config->getBool(common.config->holdvalues);
|
||||
PageFluid(CommonData &common) : Page(common)
|
||||
{
|
||||
logger->logDebug(GwLog::LOG, "Instantiate PageFluid");
|
||||
simulation = config->getBool(config->useSimuData);
|
||||
holdvalues = config->getBool(config->holdvalues);
|
||||
simval = double(random(0, 100));
|
||||
simgoto = double(random(0, 100));
|
||||
simstep = (simgoto - simval) / 20.0;
|
||||
|
@ -96,12 +96,10 @@ class PageFluid : public Page
|
|||
|
||||
virtual void displayNew(PageData &pageData){
|
||||
fluidtype = commonData->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){
|
||||
GwConfigHandler *config = commonData->config;
|
||||
GwLog *logger = commonData->logger;
|
||||
|
||||
// Old values for hold function
|
||||
static double value1old;
|
||||
|
@ -133,7 +131,7 @@ class PageFluid : public Page
|
|||
}
|
||||
|
||||
// Logging boat values
|
||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageFluid: value=%f", bvalue1->value);
|
||||
logger->logDebug(GwLog::LOG, "Drawing at PageFluid: value=%f", bvalue1->value);
|
||||
|
||||
// Draw page
|
||||
//***********************************************************
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
class PageFourValues : public Page
|
||||
{
|
||||
public:
|
||||
PageFourValues(CommonData &common){
|
||||
commonData = &common;
|
||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageFourValues");
|
||||
PageFourValues(CommonData &common) : Page(common)
|
||||
{
|
||||
logger->logDebug(GwLog::LOG, "Instantiate PageFourValues");
|
||||
}
|
||||
|
||||
virtual int handleKey(int key){
|
||||
|
@ -23,8 +23,6 @@ class PageFourValues : public Page
|
|||
}
|
||||
|
||||
int displayPage(PageData &pageData){
|
||||
GwConfigHandler *config = commonData->config;
|
||||
GwLog *logger = commonData->logger;
|
||||
|
||||
// Old values for hold function
|
||||
static String svalue1old = "";
|
||||
|
@ -91,7 +89,7 @@ class PageFourValues : public Page
|
|||
|
||||
// Logging boat values
|
||||
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
|
||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageFourValues, %s: %f, %s: %f, %s: %f, %s: %f", name1.c_str(), value1, name2.c_str(), value2, name3.c_str(), value3, name4.c_str(), value4);
|
||||
logger->logDebug(GwLog::LOG, "Drawing at PageFourValues, %s: %f, %s: %f, %s: %f, %s: %f", name1.c_str(), value1, name2.c_str(), value2, name3.c_str(), value3, name4.c_str(), value4);
|
||||
|
||||
// Draw page
|
||||
//***********************************************************
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
class PageFourValues2 : public Page
|
||||
{
|
||||
public:
|
||||
PageFourValues2(CommonData &common){
|
||||
commonData = &common;
|
||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageFourValues2");
|
||||
PageFourValues2(CommonData &common) : Page(common)
|
||||
{
|
||||
logger->logDebug(GwLog::LOG, "Instantiate PageFourValues2");
|
||||
}
|
||||
|
||||
virtual int handleKey(int key){
|
||||
|
@ -23,8 +23,6 @@ class PageFourValues2 : public Page
|
|||
}
|
||||
|
||||
int displayPage(PageData &pageData){
|
||||
GwConfigHandler *config = commonData->config;
|
||||
GwLog *logger = commonData->logger;
|
||||
|
||||
// Old values for hold function
|
||||
static String svalue1old = "";
|
||||
|
@ -91,7 +89,7 @@ class PageFourValues2 : public Page
|
|||
|
||||
// Logging boat values
|
||||
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
|
||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageFourValues2, %s: %f, %s: %f, %s: %f, %s: %f", name1.c_str(), value1, name2.c_str(), value2, name3.c_str(), value3, name4.c_str(), value4);
|
||||
logger->logDebug(GwLog::LOG, "Drawing at PageFourValues2, %s: %f, %s: %f, %s: %f, %s: %f", name1.c_str(), value1, name2.c_str(), value2, name3.c_str(), value3, name4.c_str(), value4);
|
||||
|
||||
// Draw page
|
||||
//***********************************************************
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
class PageGenerator : public Page
|
||||
{
|
||||
public:
|
||||
PageGenerator(CommonData &common){
|
||||
commonData = &common;
|
||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageGenerator");
|
||||
PageGenerator(CommonData &common) : Page(common)
|
||||
{
|
||||
logger->logDebug(GwLog::LOG, "Instantiate PageGenerator");
|
||||
}
|
||||
virtual int handleKey(int key){
|
||||
// Code for keylock
|
||||
|
@ -21,11 +21,8 @@ public:
|
|||
return key;
|
||||
}
|
||||
|
||||
int displayPage(PageData &pageData)
|
||||
{
|
||||
GwConfigHandler *config = commonData->config;
|
||||
GwLog *logger = commonData->logger;
|
||||
|
||||
int displayPage(PageData &pageData) {
|
||||
|
||||
// Get config data
|
||||
bool simulation = config->getBool(config->useSimuData);
|
||||
bool holdvalues = config->getBool(config->holdvalues);
|
||||
|
@ -78,7 +75,7 @@ public:
|
|||
}
|
||||
|
||||
// Logging voltage value
|
||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageGenerator, Type:%iW %s:=%f", genPower, name1.c_str(), value1);
|
||||
logger->logDebug(GwLog::LOG, "Drawing at PageGenerator, Type:%iW %s:=%f", genPower, name1.c_str(), value1);
|
||||
|
||||
// Draw page
|
||||
//***********************************************************
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
class PageKeelPosition : public Page
|
||||
{
|
||||
public:
|
||||
PageKeelPosition(CommonData &common){
|
||||
commonData = &common;
|
||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageKeelPosition");
|
||||
PageKeelPosition(CommonData &common) : Page(common)
|
||||
{
|
||||
logger->logDebug(GwLog::LOG, "Instantiate PageKeelPosition");
|
||||
}
|
||||
|
||||
// Key functions
|
||||
|
@ -24,9 +24,6 @@ public:
|
|||
|
||||
int displayPage(PageData &pageData)
|
||||
{
|
||||
GwConfigHandler *config = commonData->config;
|
||||
GwLog *logger = commonData->logger;
|
||||
|
||||
double value1 = 0;
|
||||
double value1old = 0;
|
||||
|
||||
|
@ -63,7 +60,7 @@ public:
|
|||
}
|
||||
|
||||
// Logging boat values
|
||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageKeelPosition, Keel:%f", value1);
|
||||
logger->logDebug(GwLog::LOG, "Drawing at PageKeelPosition, Keel:%f", value1);
|
||||
|
||||
// Draw page
|
||||
//***********************************************************
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
class PageOneValue : public Page
|
||||
{
|
||||
public:
|
||||
PageOneValue(CommonData &common){
|
||||
commonData = &common;
|
||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageOneValue");
|
||||
PageOneValue(CommonData &common) : Page(common)
|
||||
{
|
||||
logger->logDebug(GwLog::LOG, "Instantiate PageOneValue");
|
||||
}
|
||||
|
||||
virtual int handleKey(int key){
|
||||
|
@ -23,8 +23,6 @@ class PageOneValue : public Page
|
|||
}
|
||||
|
||||
int displayPage(PageData &pageData){
|
||||
GwConfigHandler *config = commonData->config;
|
||||
GwLog *logger = commonData->logger;
|
||||
|
||||
// Old values for hold function
|
||||
static String svalue1old = "";
|
||||
|
@ -55,7 +53,7 @@ class PageOneValue : public Page
|
|||
|
||||
// Logging boat values
|
||||
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
|
||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageOneValue, %s: %f", name1.c_str(), value1);
|
||||
logger->logDebug(GwLog::LOG, "Drawing at PageOneValue, %s: %f", name1.c_str(), value1);
|
||||
|
||||
// Draw page
|
||||
//***********************************************************
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
class PageRollPitch : public Page
|
||||
{
|
||||
public:
|
||||
PageRollPitch(CommonData &common){
|
||||
commonData = &common;
|
||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageRollPitch");
|
||||
PageRollPitch(CommonData &common) : Page(common)
|
||||
{
|
||||
logger->logDebug(GwLog::LOG,"Instantiate PageRollPitch");
|
||||
}
|
||||
|
||||
// Key functions
|
||||
|
@ -23,8 +23,6 @@ public:
|
|||
}
|
||||
|
||||
int displayPage(PageData &pageData){
|
||||
GwConfigHandler *config = commonData->config;
|
||||
GwLog *logger = commonData->logger;
|
||||
|
||||
double value1 = 0;
|
||||
double value2 = 0;
|
||||
|
@ -111,7 +109,7 @@ public:
|
|||
|
||||
// Logging boat values
|
||||
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
|
||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageRollPitch, %s:%f, %s:%f", name1.c_str(), value1, name2.c_str(), value2);
|
||||
logger->logDebug(GwLog::LOG, "Drawing at PageRollPitch, %s:%f, %s:%f", name1.c_str(), value1, name2.c_str(), value2);
|
||||
|
||||
// Draw page
|
||||
//***********************************************************
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
class PageRudderPosition : public Page
|
||||
{
|
||||
public:
|
||||
PageRudderPosition(CommonData &common){
|
||||
commonData = &common;
|
||||
common.logger->logDebug(GwLog::LOG,"Show PageRudderPosition");
|
||||
PageRudderPosition(CommonData &common) : Page(common)
|
||||
{
|
||||
logger->logDebug(GwLog::LOG, "Instantiate PageRudderPosition");
|
||||
}
|
||||
|
||||
// Key functions
|
||||
|
@ -24,8 +24,6 @@ public:
|
|||
}
|
||||
|
||||
int displayPage(PageData &pageData){
|
||||
GwConfigHandler *config = commonData->config;
|
||||
GwLog *logger = commonData->logger;
|
||||
|
||||
static String unit1old = "";
|
||||
double value1 = 0.1;
|
||||
|
@ -69,7 +67,7 @@ public:
|
|||
|
||||
// Logging boat values
|
||||
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
|
||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageRudderPosition, %s:%f", name1.c_str(), value1);
|
||||
logger->logDebug(GwLog::LOG, "Drawing at PageRudderPosition, %s:%f", name1.c_str(), value1);
|
||||
|
||||
// Draw page
|
||||
//***********************************************************
|
||||
|
|
|
@ -16,9 +16,9 @@ const int HowManyValues = 6;
|
|||
class PageSixValues : public Page
|
||||
{
|
||||
public:
|
||||
PageSixValues(CommonData &common){
|
||||
commonData = &common;
|
||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageSixValues");
|
||||
PageSixValues(CommonData &common) : Page(common)
|
||||
{
|
||||
logger->logDebug(GwLog::LOG, "Instantiate PageSixValues");
|
||||
}
|
||||
|
||||
virtual int handleKey(int key){
|
||||
|
@ -31,9 +31,6 @@ class PageSixValues : public Page
|
|||
}
|
||||
|
||||
int displayPage(PageData &pageData){
|
||||
GwConfigHandler *config = commonData->config;
|
||||
GwLog *logger = commonData->logger;
|
||||
|
||||
|
||||
// Old values for hold function
|
||||
static String OldDataText[HowManyValues] = {"", "", "", "", "", ""};
|
||||
|
@ -90,7 +87,7 @@ class PageSixValues : public Page
|
|||
int ValueIndex = i * 2 + j;
|
||||
int x0 = SixValues_x1 + j * SixValues_DeltaX;
|
||||
int y0 = SixValues_y1 + i * SixValues_DeltaY;
|
||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageSixValue: %d %s %f %s", ValueIndex, DataName[ValueIndex], DataValue[ValueIndex], DataFormat[ValueIndex] );
|
||||
logger->logDebug(GwLog::LOG,"Drawing at PageSixValue: %d %s %f %s", ValueIndex, DataName[ValueIndex], DataValue[ValueIndex], DataFormat[ValueIndex] );
|
||||
|
||||
// Show name
|
||||
epd->setFont(&Ubuntu_Bold12pt8b);
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
class PageSkyView : public Page
|
||||
{
|
||||
public:
|
||||
PageSkyView(CommonData &common){
|
||||
commonData = &common;
|
||||
common.logger->logDebug(GwLog::LOG,"Show PageSkyView");
|
||||
PageSkyView(CommonData &common) : Page(common)
|
||||
{
|
||||
logger->logDebug(GwLog::LOG, "Instantiate PageSkyView");
|
||||
}
|
||||
|
||||
int handleKey(int key){
|
||||
|
@ -26,8 +26,6 @@ public:
|
|||
}
|
||||
|
||||
int displayPage(PageData &pageData) {
|
||||
GwConfigHandler *config = commonData->config;
|
||||
GwLog *logger = commonData->logger;
|
||||
|
||||
// Get config data
|
||||
String flashLED = config->getString(config->flashLED);
|
||||
|
@ -41,7 +39,7 @@ public:
|
|||
}
|
||||
|
||||
// Logging boat values
|
||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageSkyView");
|
||||
logger->logDebug(GwLog::LOG, "Drawing at PageSkyView");
|
||||
|
||||
// Draw page
|
||||
//***********************************************************
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
class PageSolar : public Page
|
||||
{
|
||||
public:
|
||||
PageSolar(CommonData &common){
|
||||
commonData = &common;
|
||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageSolar");
|
||||
PageSolar(CommonData &common) : Page(common)
|
||||
{
|
||||
logger->logDebug(GwLog::LOG, "Instantiate PageSolar");
|
||||
}
|
||||
virtual int handleKey(int key){
|
||||
// Code for keylock
|
||||
|
@ -22,8 +22,6 @@ public:
|
|||
}
|
||||
|
||||
int displayPage(PageData &pageData){
|
||||
GwConfigHandler *config = commonData->config;
|
||||
GwLog *logger = commonData->logger;
|
||||
|
||||
// Get config data
|
||||
bool simulation = config->getBool(config->useSimuData);
|
||||
|
@ -77,7 +75,7 @@ public:
|
|||
}
|
||||
|
||||
// Logging voltage value
|
||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageSolar, Type:%iW %s:=%f", solPower, name1.c_str(), value1);
|
||||
logger->logDebug(GwLog::LOG, "Drawing at PageSolar, Type:%iW %s:=%f", solPower, name1.c_str(), value1);
|
||||
|
||||
// Draw page
|
||||
//***********************************************************
|
||||
|
|
|
@ -1,27 +1,6 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
#if defined BOARD_OBP60S3 || defined BOARD_OBP40S3
|
||||
|
||||
#include "Pagedata.h"
|
||||
#include "OBP60Extensions.h"
|
||||
#include "ConfigMenu.h"
|
||||
#include "images/logo64.xbm"
|
||||
#include <esp32/clk.h>
|
||||
#include "qrcode.h"
|
||||
#include "Nmea2kTwai.h"
|
||||
|
||||
#ifdef BOARD_OBP40S3
|
||||
#include <SD.h>
|
||||
#include <FS.h>
|
||||
#endif
|
||||
|
||||
#define STRINGIZE_IMPL(x) #x
|
||||
#define STRINGIZE(x) STRINGIZE_IMPL(x)
|
||||
#define VERSINFO STRINGIZE(GWDEVVERSION)
|
||||
#define BOARDINFO STRINGIZE(BOARD)
|
||||
#define PCBINFO STRINGIZE(PCBVERS)
|
||||
#define DISPLAYINFO STRINGIZE(EPDTYPE)
|
||||
#define GXEPD2INFO STRINGIZE(GXEPD2VERS)
|
||||
|
||||
/*
|
||||
* Special system page, called directly with fast key sequence 5,4
|
||||
* Out of normal page order.
|
||||
|
@ -44,6 +23,27 @@
|
|||
* powerInit(powermode);
|
||||
*/
|
||||
|
||||
#include "Pagedata.h"
|
||||
#include "OBP60Extensions.h"
|
||||
#include "ConfigMenu.h"
|
||||
#include "images/logo64.xbm"
|
||||
#include <esp32/clk.h>
|
||||
#include "qrcode.h"
|
||||
#include "Nmea2kTwai.h"
|
||||
|
||||
#ifdef BOARD_OBP40S3
|
||||
#include <SD.h>
|
||||
#include <FS.h>
|
||||
#endif
|
||||
|
||||
#define STRINGIZE_IMPL(x) #x
|
||||
#define STRINGIZE(x) STRINGIZE_IMPL(x)
|
||||
#define VERSINFO STRINGIZE(GWDEVVERSION)
|
||||
#define BOARDINFO STRINGIZE(BOARD)
|
||||
#define PCBINFO STRINGIZE(PCBVERS)
|
||||
#define DISPLAYINFO STRINGIZE(EPDTYPE)
|
||||
#define GXEPD2INFO STRINGIZE(GXEPD2VERS)
|
||||
|
||||
class PageSystem : public Page
|
||||
{
|
||||
private:
|
||||
|
@ -267,7 +267,7 @@ private:
|
|||
for (int i = 0 ; i < menu->getItemCount(); i++) {
|
||||
ConfigMenuItem *itm = menu->getItemByIndex(i);
|
||||
if (!itm) {
|
||||
LOG_DEBUG(GwLog::ERROR, "Menu item not found: %d", i);
|
||||
logger->logDebug(GwLog::ERROR, "Menu item not found: %d", i);
|
||||
} else {
|
||||
Rect r = menu->getItemRect(i);
|
||||
bool inverted = (i == menu->getActiveIndex());
|
||||
|
@ -416,36 +416,33 @@ private:
|
|||
}
|
||||
|
||||
public:
|
||||
PageSystem(CommonData &common){
|
||||
commonData = &common;
|
||||
config = commonData->config;
|
||||
logger = commonData->logger;
|
||||
|
||||
PageSystem(CommonData &common) : Page(common)
|
||||
{
|
||||
logger->logDebug(GwLog::LOG, "Instantiate PageSystem");
|
||||
if (hasFRAM) {
|
||||
mode = fram.read(FRAM_SYSTEM_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();
|
||||
simulation = common.config->getBool(common.config->useSimuData);
|
||||
simulation = config->getBool(config->useSimuData);
|
||||
#ifdef BOARD_OBP40S3
|
||||
sdcard = common.config->getBool(common.config->useSDCard);
|
||||
sdcard = config->getBool(config->useSDCard);
|
||||
#endif
|
||||
buzzer_mode = common.config->getString(common.config->buzzerMode);
|
||||
buzzer_mode = config->getString(config->buzzerMode);
|
||||
buzzer_mode.toLowerCase();
|
||||
buzzer_power = common.config->getInt(common.config->buzzerPower);
|
||||
cpuspeed = common.config->getString(common.config->cpuSpeed);
|
||||
env_module = common.config->getString(common.config->useEnvSensor);
|
||||
rtc_module = common.config->getString(common.config->useRTC);
|
||||
gps_module = common.config->getString(common.config->useGPS);
|
||||
batt_sensor = common.config->getString(common.config->usePowSensor1);
|
||||
solar_sensor = common.config->getString(common.config->usePowSensor2);
|
||||
gen_sensor = common.config->getString(common.config->usePowSensor3);
|
||||
rot_sensor = common.config->getString(common.config->useRotSensor);
|
||||
homelat = common.config->getString(common.config->homeLAT).toDouble();
|
||||
homelon = common.config->getString(common.config->homeLON).toDouble();
|
||||
buzzer_power = config->getInt(config->buzzerPower);
|
||||
cpuspeed = config->getString(config->cpuSpeed);
|
||||
env_module = config->getString(config->useEnvSensor);
|
||||
rtc_module = config->getString(config->useRTC);
|
||||
gps_module = config->getString(config->useGPS);
|
||||
batt_sensor = config->getString(config->usePowSensor1);
|
||||
solar_sensor = config->getString(config->usePowSensor2);
|
||||
gen_sensor = config->getString(config->usePowSensor3);
|
||||
rot_sensor = config->getString(config->useRotSensor);
|
||||
homelat = config->getString(config->homeLAT).toDouble();
|
||||
homelon = config->getString(config->homeLON).toDouble();
|
||||
|
||||
// CPU speed: 80 | 160 | 240
|
||||
// Power mode: Max | 5V | Min
|
||||
|
@ -478,7 +475,7 @@ public:
|
|||
virtual int handleKey(int key){
|
||||
// do *NOT* handle key #1 this handled by obp60task as exit
|
||||
// Switch display mode
|
||||
commonData->logger->logDebug(GwLog::LOG, "System keyboard handler");
|
||||
logger->logDebug(GwLog::LOG, "System keyboard handler");
|
||||
if (key == 2) {
|
||||
incMode();
|
||||
return 0;
|
||||
|
@ -550,10 +547,9 @@ public:
|
|||
};
|
||||
|
||||
int displayPage(PageData &pageData){
|
||||
// GwConfigHandler *config = commonData->config;
|
||||
// GwLog *logger = commonData->logger;
|
||||
|
||||
NMEA2000 = pageData.api->getNMEA2000();
|
||||
// Get references from API
|
||||
NMEA2000 = pageData.api->getNMEA2000(); // TODO this should go to page initialization!
|
||||
logger->logDebug(GwLog::LOG, "PageSystem: N2k source address=%d", NMEA2000->GetN2kSource());
|
||||
|
||||
// Optical warning by limit violation (unused)
|
||||
|
@ -565,10 +561,6 @@ public:
|
|||
// Logging page information
|
||||
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
|
||||
epd->setPartialWindow(0, 0, epd->width(), epd->height());
|
||||
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
class PageThreeValues : public Page
|
||||
{
|
||||
public:
|
||||
PageThreeValues(CommonData &common){
|
||||
commonData = &common;
|
||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageThreeValue");
|
||||
PageThreeValues(CommonData &common) : Page(common)
|
||||
{
|
||||
logger->logDebug(GwLog::LOG,"Instantiate PageThreeValue");
|
||||
}
|
||||
|
||||
virtual int handleKey(int key){
|
||||
|
@ -23,8 +23,6 @@ class PageThreeValues : public Page
|
|||
}
|
||||
|
||||
int displayPage(PageData &pageData){
|
||||
GwConfigHandler *config = commonData->config;
|
||||
GwLog *logger = commonData->logger;
|
||||
|
||||
// Old values for hold function
|
||||
static String svalue1old = "";
|
||||
|
@ -79,7 +77,7 @@ class PageThreeValues : public Page
|
|||
|
||||
// Logging boat values
|
||||
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
|
||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageThreeValues, %s: %f, %s: %f, %s: %f", name1.c_str(), value1, name2.c_str(), value2, name3.c_str(), value3);
|
||||
logger->logDebug(GwLog::LOG, "Drawing at PageThreeValues, %s: %f, %s: %f, %s: %f", name1.c_str(), value1, name2.c_str(), value2, name3.c_str(), value3);
|
||||
|
||||
// Draw page
|
||||
//***********************************************************
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
class PageTwoValues : public Page
|
||||
{
|
||||
public:
|
||||
PageTwoValues(CommonData &common){
|
||||
commonData = &common;
|
||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageTwoValue");
|
||||
PageTwoValues(CommonData &common) : Page(common)
|
||||
{
|
||||
logger->logDebug(GwLog::LOG,"Instantiate PageTwoValue");
|
||||
}
|
||||
|
||||
virtual int handleKey(int key){
|
||||
|
@ -67,7 +67,7 @@ class PageTwoValues : public Page
|
|||
|
||||
// Logging boat values
|
||||
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
|
||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageTwoValues, %s: %f, %s: %f", name1.c_str(), value1, name2.c_str(), value2);
|
||||
logger->logDebug(GwLog::LOG, "Drawing at PageTwoValues, %s: %f, %s: %f", name1.c_str(), value1, name2.c_str(), value2);
|
||||
|
||||
// Draw page
|
||||
//***********************************************************
|
||||
|
|
|
@ -15,12 +15,9 @@ private:
|
|||
char mode = 'D'; // display mode (A)nalog | (D)igital
|
||||
|
||||
public:
|
||||
PageVoltage(CommonData &common){
|
||||
commonData = &common;
|
||||
config = commonData->config;
|
||||
logger = commonData->logger;
|
||||
|
||||
logger->logDebug(GwLog::LOG,"Instantiate PageVoltage");
|
||||
PageVoltage(CommonData &common) : Page(common)
|
||||
{
|
||||
logger->logDebug(GwLog::LOG, "Instantiate PageVoltage");
|
||||
if (hasFRAM) {
|
||||
average = fram.read(FRAM_VOLTAGE_AVG);
|
||||
trend = fram.read(FRAM_VOLTAGE_TREND);
|
||||
|
@ -29,7 +26,7 @@ public:
|
|||
}
|
||||
|
||||
~PageVoltage(){
|
||||
logger->logDebug(GwLog::LOG,"Destroy PageVoltage");
|
||||
logger->logDebug(GwLog::LOG, "Destroy PageVoltage");
|
||||
}
|
||||
|
||||
virtual void setupKeys(){
|
||||
|
@ -110,9 +107,7 @@ public:
|
|||
}
|
||||
|
||||
int displayPage(PageData &pageData){
|
||||
GwConfigHandler *config = commonData->config;
|
||||
GwLog *logger = commonData->logger;
|
||||
|
||||
|
||||
// Get config data
|
||||
bool simulation = config->getBool(config->useSimuData);
|
||||
bool holdvalues = config->getBool(config->holdvalues);
|
||||
|
@ -196,7 +191,7 @@ public:
|
|||
}
|
||||
|
||||
// Logging voltage value
|
||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageVoltage, Type:%s %s:=%f", batType, name1.c_str(), raw);
|
||||
logger->logDebug(GwLog::LOG, "Drawing at PageVoltage, Type:%s %s:=%f", batType, name1.c_str(), raw);
|
||||
|
||||
// Draw page
|
||||
//***********************************************************
|
||||
|
|
|
@ -17,9 +17,9 @@ class PageWhite : public Page
|
|||
char mode = 'W'; // display mode (W)hite | (L)ogo | (M)FD logo
|
||||
|
||||
public:
|
||||
PageWhite(CommonData &common){
|
||||
commonData = &common;
|
||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageWhite");
|
||||
PageWhite(CommonData &common) : Page(common)
|
||||
{
|
||||
logger->logDebug(GwLog::LOG, "Instantiate PageWhite");
|
||||
refreshtime = 15000;
|
||||
}
|
||||
|
||||
|
@ -39,8 +39,6 @@ public:
|
|||
}
|
||||
|
||||
int displayPage(PageData &pageData){
|
||||
GwConfigHandler *config = commonData->config;
|
||||
GwLog *logger = commonData->logger;
|
||||
|
||||
// Get config data
|
||||
String flashLED = config->getString(config->flashLED);
|
||||
|
@ -52,7 +50,7 @@ public:
|
|||
}
|
||||
|
||||
// Logging boat values
|
||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageWhite");
|
||||
logger->logDebug(GwLog::LOG, "Drawing at PageWhite");
|
||||
|
||||
// Draw page
|
||||
//***********************************************************
|
||||
|
|
|
@ -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
|
||||
|
||||
public:
|
||||
PageWind(CommonData &common){
|
||||
commonData = &common;
|
||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageWind");
|
||||
PageWind(CommonData &common) : Page(common)
|
||||
{
|
||||
logger->logDebug(GwLog::LOG, "Instantiate PageWind");
|
||||
if (hasFRAM) {
|
||||
lp = fram.read(FRAM_WIND_SIZE);
|
||||
source = fram.read(FRAM_WIND_SRC);
|
||||
|
@ -299,8 +299,6 @@ public:
|
|||
|
||||
int displayPage(PageData &pageData)
|
||||
{
|
||||
GwConfigHandler *config = commonData->config;
|
||||
GwLog *logger = commonData->logger;
|
||||
|
||||
static String svalue1old = "";
|
||||
static String unit1old = "";
|
||||
|
@ -356,7 +354,7 @@ public:
|
|||
|
||||
// Logging boat values
|
||||
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
|
||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageWind, %s:%f, %s:%f", name1.c_str(), value1, name2.c_str(), value2);
|
||||
logger->logDebug(GwLog::LOG, "Drawing at PageWind, %s:%f, %s:%f", name1.c_str(), value1, name2.c_str(), value2);
|
||||
|
||||
// Draw page
|
||||
//***********************************************************
|
||||
|
|
|
@ -57,10 +57,9 @@ class PageWindPlot : public Page {
|
|||
bool showTWS = true; // Show TWS value in chart area
|
||||
|
||||
public:
|
||||
PageWindPlot(CommonData& common)
|
||||
PageWindPlot(CommonData& common) : Page(common)
|
||||
{
|
||||
commonData = &common;
|
||||
common.logger->logDebug(GwLog::LOG, "Instantiate PageWindPlot");
|
||||
logger->logDebug(GwLog::LOG, "Instantiate PageWindPlot");
|
||||
}
|
||||
|
||||
virtual void setupKeys()
|
||||
|
@ -116,9 +115,6 @@ public:
|
|||
|
||||
int displayPage(PageData& pageData)
|
||||
{
|
||||
GwConfigHandler* config = commonData->config;
|
||||
GwLog* logger = commonData->logger;
|
||||
|
||||
float twsValue; // TWS value in chart area
|
||||
static String twdName, twdUnit; // TWD name and unit
|
||||
static int updFreq; // Update frequency for TWD
|
||||
|
@ -173,7 +169,7 @@ public:
|
|||
int chrtVal; // Current wind value
|
||||
static int chrtPrevVal; // Last wind value in chart area for check if value crosses 180 degree line
|
||||
|
||||
LOG_DEBUG(GwLog::LOG, "Display page WindPlot");
|
||||
logger->logDebug(GwLog::LOG, "Display page WindPlot");
|
||||
|
||||
// Get config data
|
||||
simulation = config->getBool(config->useSimuData);
|
||||
|
@ -241,7 +237,7 @@ public:
|
|||
bufStart = max(0, bufStart - numAddedBufVals);
|
||||
}
|
||||
}
|
||||
LOG_DEBUG(GwLog::DEBUG, "PageWindPlot Dataset: count: %d, TWD: %.0f, TWS: %.1f, TWD_valid? %d, intvBufSize: %d, numWndVals: %d, bufStart: %d, numAddedBufVals: %d, lastIdx: %d, old: %d, act: %d",
|
||||
logger->logDebug(GwLog::DEBUG, "PageWindPlot Dataset: count: %d, TWD: %.0f, TWS: %.1f, TWD_valid? %d, intvBufSize: %d, numWndVals: %d, bufStart: %d, numAddedBufVals: %d, lastIdx: %d, old: %d, act: %d",
|
||||
count, pageData.boatHstry.twdHstry->getLast() / 1000.0 * radToDeg, pageData.boatHstry.twsHstry->getLast() / 10.0 * 1.94384, BDataValid[0],
|
||||
intvBufSize, numWndVals, bufStart, numAddedBufVals, pageData.boatHstry.twdHstry->getLastIdx(), oldDataIntv, dataIntv);
|
||||
|
||||
|
@ -254,7 +250,7 @@ public:
|
|||
} else {
|
||||
wndCenter = 0;
|
||||
}
|
||||
LOG_DEBUG(GwLog::DEBUG, "PageWindPlot Range Init: count: %d, TWD: %.0f, wndCenter: %d, diffRng: %d, chrtRng: %d", count, pageData.boatHstry.twdHstry->getLast() / 1000.0 * radToDeg,
|
||||
logger->logDebug(GwLog::DEBUG, "PageWindPlot Range Init: count: %d, TWD: %.0f, wndCenter: %d, diffRng: %d, chrtRng: %d", count, pageData.boatHstry.twdHstry->getLast() / 1000.0 * radToDeg,
|
||||
wndCenter, diffRng, chrtRng);
|
||||
} else {
|
||||
// check and adjust range between left, center, and right chart limit
|
||||
|
@ -334,7 +330,7 @@ public:
|
|||
|
||||
// if (i >= (numWndVals / dataIntv) - 10)
|
||||
if (i >= (numWndVals / dataIntv) - 1)
|
||||
LOG_DEBUG(GwLog::DEBUG, "PageWindPlot Chart: i: %d, chrtVal: %d, bufStart: %d, count: %d, linesToShow: %d", i, chrtVal, bufStart, count, (numWndVals / dataIntv));
|
||||
logger->logDebug(GwLog::DEBUG, "PageWindPlot Chart: i: %d, chrtVal: %d, bufStart: %d, count: %d, linesToShow: %d", i, chrtVal, bufStart, count, (numWndVals / dataIntv));
|
||||
|
||||
if ((i == 0) || (chrtPrevVal == INT16_MIN)) {
|
||||
// just a dot for 1st chart point or after some invalid values
|
||||
|
@ -367,7 +363,7 @@ public:
|
|||
|
||||
int minWndDir = pageData.boatHstry.twdHstry->getMin(numWndVals) / 1000.0 * radToDeg;
|
||||
int maxWndDir = pageData.boatHstry.twdHstry->getMax(numWndVals) / 1000.0 * radToDeg;
|
||||
LOG_DEBUG(GwLog::DEBUG, "PageWindPlot FreeTop: Minimum: %d, Maximum: %d, OldwndCenter: %d", minWndDir, maxWndDir, wndCenter);
|
||||
logger->logDebug(GwLog::DEBUG, "PageWindPlot FreeTop: Minimum: %d, Maximum: %d, OldwndCenter: %d", minWndDir, maxWndDir, wndCenter);
|
||||
// if ((minWndDir + 540 >= wndCenter + 540) || (maxWndDir + 540 <= wndCenter + 540)) {
|
||||
if (((minWndDir - wndCenter >= 0) && (minWndDir - wndCenter < 180)) || ((maxWndDir - wndCenter <= 0) && (maxWndDir - wndCenter >=180))) {
|
||||
// Check if all wind value are left or right of center value -> optimize chart range
|
||||
|
@ -376,14 +372,14 @@ public:
|
|||
wndCenter = int((midWndDir + (midWndDir >= 0 ? 5 : -5)) / 10) * 10; // Set new center value; round to nearest 10 degree value
|
||||
}
|
||||
}
|
||||
LOG_DEBUG(GwLog::DEBUG, "PageWindPlot FreeTop: cHeight: %d, bufStart: %d, numWndVals: %d, wndCenter: %d", cHeight, bufStart, numWndVals, wndCenter);
|
||||
logger->logDebug(GwLog::DEBUG, "PageWindPlot FreeTop: cHeight: %d, bufStart: %d, numWndVals: %d, wndCenter: %d", cHeight, bufStart, numWndVals, wndCenter);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
// No valid data available
|
||||
LOG_DEBUG(GwLog::LOG, "PageWindPlot: No valid data available");
|
||||
logger->logDebug(GwLog::LOG, "PageWindPlot: No valid data available");
|
||||
epd->setFont(&Ubuntu_Bold10pt8b);
|
||||
epd->fillRect(xCenter - 33, height / 2 - 20, 66, 24, commonData->bgcolor); // Clear area for message
|
||||
drawTextCenter(xCenter, height / 2 - 10, "No data");
|
||||
|
|
|
@ -10,9 +10,9 @@ class PageWindRose : public Page
|
|||
int16_t lp = 80; // Pointer length
|
||||
|
||||
public:
|
||||
PageWindRose(CommonData &common){
|
||||
commonData = &common;
|
||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageWindRose");
|
||||
PageWindRose(CommonData &common) : Page(common)
|
||||
{
|
||||
logger->logDebug(GwLog::LOG, "Instantiate PageWindRose");
|
||||
}
|
||||
|
||||
// Key functions
|
||||
|
@ -26,8 +26,6 @@ public:
|
|||
}
|
||||
|
||||
int displayPage(PageData &pageData){
|
||||
GwConfigHandler *config = commonData->config;
|
||||
GwLog *logger = commonData->logger;
|
||||
|
||||
static String svalue1old = "";
|
||||
static String unit1old = "";
|
||||
|
@ -142,7 +140,7 @@ public:
|
|||
|
||||
// Logging boat values
|
||||
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
|
||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageWindRose, %s:%f, %s:%f, %s:%f, %s:%f, %s:%f, %s:%f", name1.c_str(), value1, name2.c_str(), value2, name3.c_str(), value3, name4.c_str(), value4, name5.c_str(), value5, name6.c_str(), value6);
|
||||
logger->logDebug(GwLog::LOG, "Drawing at PageWindRose, %s:%f, %s:%f, %s:%f, %s:%f, %s:%f, %s:%f", name1.c_str(), value1, name2.c_str(), value2, name3.c_str(), value3, name4.c_str(), value4, name5.c_str(), value5, name6.c_str(), value6);
|
||||
|
||||
// Draw page
|
||||
//***********************************************************
|
||||
|
|
|
@ -10,9 +10,9 @@ class PageWindRoseFlex : public Page
|
|||
int16_t lp = 80; // Pointer length
|
||||
|
||||
public:
|
||||
PageWindRoseFlex(CommonData &common){
|
||||
commonData = &common;
|
||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageWindRoseFlex");
|
||||
PageWindRoseFlex(CommonData &common) : Page(common)
|
||||
{
|
||||
logger->logDebug(GwLog::LOG, "Instantiate PageWindRoseFlex");
|
||||
}
|
||||
|
||||
// Key functions
|
||||
|
@ -26,8 +26,6 @@ public:
|
|||
}
|
||||
|
||||
int displayPage(PageData &pageData){
|
||||
GwConfigHandler *config = commonData->config;
|
||||
GwLog *logger = commonData->logger;
|
||||
|
||||
static String svalue1old = "";
|
||||
static String unit1old = "";
|
||||
|
@ -142,7 +140,7 @@ public:
|
|||
|
||||
// Logging boat values
|
||||
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
|
||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageWindRoseFlex, %s:%f, %s:%f, %s:%f, %s:%f, %s:%f, %s:%f", name1.c_str(), value1, name2.c_str(), value2, name3.c_str(), value3, name4.c_str(), value4, name5.c_str(), value5, name6.c_str(), value6);
|
||||
logger->logDebug(GwLog::LOG, "Drawing at PageWindRoseFlex, %s:%f, %s:%f, %s:%f, %s:%f, %s:%f, %s:%f", name1.c_str(), value1, name2.c_str(), value2, name3.c_str(), value3, name4.c_str(), value4, name5.c_str(), value5, name6.c_str(), value6);
|
||||
|
||||
// Draw page
|
||||
//***********************************************************
|
||||
|
|
|
@ -33,11 +33,11 @@ class PageXTETrack : public Page
|
|||
bool holdvalues = false;
|
||||
|
||||
public:
|
||||
PageXTETrack(CommonData &common){
|
||||
commonData = &common;
|
||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageXTETrack");
|
||||
simulation = common.config->getBool(common.config->useSimuData);
|
||||
holdvalues = common.config->getBool(common.config->holdvalues);
|
||||
PageXTETrack(CommonData &common) : Page(common)
|
||||
{
|
||||
logger->logDebug(GwLog::LOG, "Instantiate PageXTETrack");
|
||||
simulation = config->getBool(config->useSimuData);
|
||||
holdvalues = config->getBool(config->holdvalues);
|
||||
}
|
||||
|
||||
void drawSegment(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1,
|
||||
|
@ -67,8 +67,6 @@ class PageXTETrack : public Page
|
|||
}
|
||||
|
||||
int displayPage(PageData &pageData){
|
||||
GwConfigHandler *config = commonData->config;
|
||||
GwLog *logger = commonData->logger;
|
||||
|
||||
// Get config data
|
||||
String flashLED = config->getString(config->flashLED);
|
||||
|
@ -84,7 +82,7 @@ class PageXTETrack : public Page
|
|||
}
|
||||
|
||||
// Logging boat values
|
||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageXTETrack");
|
||||
logger->logDebug(GwLog::LOG,"Drawing at PageXTETrack");
|
||||
|
||||
// Draw page
|
||||
//***********************************************************
|
||||
|
|
|
@ -130,6 +130,12 @@ protected:
|
|||
GwConfigHandler *config;
|
||||
GwLog *logger;
|
||||
public:
|
||||
Page(){}
|
||||
Page(CommonData &common) {
|
||||
commonData = &common;
|
||||
config = commonData->config;
|
||||
logger = commonData->logger;
|
||||
}
|
||||
int refreshtime = 1000;
|
||||
virtual int displayPage(PageData &pageData)=0;
|
||||
virtual void displayNew(PageData &pageData){}
|
||||
|
|
|
@ -17,3 +17,7 @@
|
|||
- page clock: sunrise / sunset in local time or UTC
|
||||
|
||||
- implement alerts
|
||||
|
||||
- page windplot: replace circles for degree symbol with font symbol
|
||||
|
||||
- central definition of placeholder symbol: ---
|
||||
|
|
Loading…
Reference in New Issue