Move config code into page constructors and some code cleanup
This commit is contained in:
parent
54b4954797
commit
8695d3eeb5
|
@ -19,10 +19,6 @@
|
||||||
class PageAIS : public Page
|
class PageAIS : public Page
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
bool simulation = false;
|
|
||||||
bool holdvalues = false;
|
|
||||||
String flashLED;
|
|
||||||
String backlightMode;
|
|
||||||
|
|
||||||
int scale = 5; // Radius of display circle in nautical miles
|
int scale = 5; // Radius of display circle in nautical miles
|
||||||
|
|
||||||
|
@ -36,7 +32,7 @@ private:
|
||||||
|
|
||||||
// TBD Boatvalues: ...
|
// TBD Boatvalues: ...
|
||||||
|
|
||||||
LOG_DEBUG(GwLog::DEBUG,"Drawing at PageAIS");
|
logger->logDebug(GwLog::DEBUG,"Drawing at PageAIS");
|
||||||
|
|
||||||
Point c = {200, 150}; // center = current boat position
|
Point c = {200, 150}; // center = current boat position
|
||||||
uint16_t r = 125;
|
uint16_t r = 125;
|
||||||
|
@ -84,17 +80,9 @@ private:
|
||||||
public:
|
public:
|
||||||
PageAIS(CommonData &common) : Page(common)
|
PageAIS(CommonData &common) : Page(common)
|
||||||
{
|
{
|
||||||
logger->logDebug(GwLog::LOG,"Instantiate PageAIS");
|
logger->logDebug(GwLog::LOG, "Instantiate PageAIS");
|
||||||
|
|
||||||
// preload configuration data
|
|
||||||
simulation = config->getBool(config->useSimuData);
|
|
||||||
holdvalues = config->getBool(config->holdvalues);
|
|
||||||
flashLED = config->getString(config->flashLED);
|
|
||||||
backlightMode = config->getString(config->backlight);
|
|
||||||
|
|
||||||
alarm_range = 3;
|
alarm_range = 3;
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void setupKeys(){
|
void setupKeys(){
|
||||||
Page::setupKeys();
|
Page::setupKeys();
|
||||||
|
@ -143,7 +131,7 @@ public:
|
||||||
int displayPage(PageData &pageData){
|
int displayPage(PageData &pageData){
|
||||||
|
|
||||||
// Logging boat values
|
// 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
|
// Set display in partial refresh mode
|
||||||
epd->setPartialWindow(0, 0, epd->width(), epd->height());
|
epd->setPartialWindow(0, 0, epd->width(), epd->height());
|
||||||
|
|
|
@ -51,10 +51,6 @@ static unsigned char anchor_bits[] = {
|
||||||
class PageAnchor : public Page
|
class PageAnchor : public Page
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
bool simulation = false;
|
|
||||||
bool holdvalues = false;
|
|
||||||
String flashLED;
|
|
||||||
String backlightMode;
|
|
||||||
String lengthformat;
|
String lengthformat;
|
||||||
|
|
||||||
int scale = 50; // Radius of display circle in meter
|
int scale = 50; // Radius of display circle in meter
|
||||||
|
@ -98,7 +94,7 @@ private:
|
||||||
String sval_hdop = formatValue(bv_hdop, *commonData).svalue;
|
String sval_hdop = formatValue(bv_hdop, *commonData).svalue;
|
||||||
String sunit_hdop = formatValue(bv_hdop, *commonData).unit;
|
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
|
Point c = {200, 150}; // center = anchor position
|
||||||
uint16_t r = 125;
|
uint16_t r = 125;
|
||||||
|
@ -194,7 +190,7 @@ private:
|
||||||
// alarm range in meter has to be smaller than the scale in meter
|
// alarm range in meter has to be smaller than the scale in meter
|
||||||
// r and r_range are pixel values
|
// r and r_range are pixel values
|
||||||
uint16_t r_range = int(alarm_range * r / scale);
|
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);
|
epd->drawCircle(c.x, c.y, r_range, commonData->fgcolor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,7 +216,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());
|
||||||
|
@ -244,13 +240,9 @@ private:
|
||||||
public:
|
public:
|
||||||
PageAnchor(CommonData &common) : Page(common)
|
PageAnchor(CommonData &common) : Page(common)
|
||||||
{
|
{
|
||||||
logger->logDebug(GwLog::LOG,"Instantiate PageAnchor");
|
logger->logDebug(GwLog::LOG, "Instantiate PageAnchor");
|
||||||
|
|
||||||
// preload configuration data
|
// preload configuration data
|
||||||
simulation = config->getBool(config->useSimuData);
|
|
||||||
holdvalues = config->getBool(config->holdvalues);
|
|
||||||
flashLED = config->getString(config->flashLED);
|
|
||||||
backlightMode = config->getString(config->backlight);
|
|
||||||
lengthformat = config->getString(config->lengthFormat);
|
lengthformat = config->getString(config->lengthFormat);
|
||||||
chain_length = config->getInt(config->chainLength);
|
chain_length = config->getInt(config->chainLength);
|
||||||
|
|
||||||
|
@ -266,7 +258,7 @@ public:
|
||||||
newitem = menu->addItem("chain", "Chain out", "int", 0, "m");
|
newitem = menu->addItem("chain", "Chain out", "int", 0, "m");
|
||||||
if (! newitem) {
|
if (! newitem) {
|
||||||
// Demo: in case of failure exit here, should never be happen
|
// 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;
|
return;
|
||||||
}
|
}
|
||||||
newitem->setRange(0, 200, {1, 5, 10});
|
newitem->setRange(0, 200, {1, 5, 10});
|
||||||
|
@ -392,7 +384,7 @@ public:
|
||||||
int displayPage(PageData &pageData){
|
int displayPage(PageData &pageData){
|
||||||
|
|
||||||
// Logging boat values
|
// 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
|
// Set display in partial refresh mode
|
||||||
epd->setPartialWindow(0, 0, epd->width(), epd->height()); // Set partial update
|
epd->setPartialWindow(0, 0, epd->width(), epd->height()); // Set partial update
|
||||||
|
|
|
@ -12,18 +12,13 @@
|
||||||
class PageAutopilot : public Page
|
class PageAutopilot : public Page
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
bool simulation = false;
|
|
||||||
bool holdvalues = false;
|
|
||||||
String flashLED;
|
|
||||||
String backlightMode;
|
|
||||||
|
|
||||||
char mode = 'N'; // (N)ormal, (C)onfig
|
char mode = 'N'; // (N)ormal, (C)onfig
|
||||||
|
|
||||||
void displayModeNormal(PageData &pageData) {
|
void displayModeNormal(PageData &pageData) {
|
||||||
|
|
||||||
// TBD Boatvalues: ...
|
// TBD Boatvalues: ...
|
||||||
|
|
||||||
LOG_DEBUG(GwLog::DEBUG,"Drawing at PageAutopilot");
|
logger->logDebug(GwLog::DEBUG, "Drawing at PageAutopilot");
|
||||||
|
|
||||||
// Title and corner value headings
|
// Title and corner value headings
|
||||||
epd->setTextColor(commonData->fgcolor);
|
epd->setTextColor(commonData->fgcolor);
|
||||||
|
@ -49,22 +44,15 @@ public:
|
||||||
PageAutopilot(CommonData &common) : Page(common)
|
PageAutopilot(CommonData &common) : Page(common)
|
||||||
{
|
{
|
||||||
logger->logDebug(GwLog::LOG, "Instantiate PageAutopilot");
|
logger->logDebug(GwLog::LOG, "Instantiate PageAutopilot");
|
||||||
|
}
|
||||||
|
|
||||||
// preload configuration data
|
void setupKeys() {
|
||||||
simulation = config->getBool(config->useSimuData);
|
|
||||||
holdvalues = config->getBool(config->holdvalues);
|
|
||||||
flashLED = config->getString(config->flashLED);
|
|
||||||
backlightMode = config->getString(config->backlight);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void setupKeys(){
|
|
||||||
Page::setupKeys();
|
Page::setupKeys();
|
||||||
commonData->keydata[0].label = "MODE";
|
commonData->keydata[0].label = "MODE";
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BOARD_OBP60S3
|
#ifdef BOARD_OBP60S3
|
||||||
int handleKey(int key){
|
int handleKey(int key) {
|
||||||
if (key == 1) { // Switch between normal and config mode
|
if (key == 1) { // Switch between normal and config mode
|
||||||
if (mode == 'N') {
|
if (mode == 'N') {
|
||||||
mode = 'C';
|
mode = 'C';
|
||||||
|
@ -106,7 +94,7 @@ public:
|
||||||
int displayPage(PageData &pageData){
|
int displayPage(PageData &pageData){
|
||||||
|
|
||||||
// Logging boat values
|
// 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
|
// Set display in partial refresh mode
|
||||||
epd->setPartialWindow(0, 0, epd->width(), epd->height());
|
epd->setPartialWindow(0, 0, epd->width(), epd->height());
|
||||||
|
|
|
@ -6,13 +6,21 @@
|
||||||
|
|
||||||
class PageBME280 : public Page
|
class PageBME280 : public Page
|
||||||
{
|
{
|
||||||
|
private:
|
||||||
|
String tempformat;
|
||||||
|
String useenvsensor;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageBME280(CommonData &common) : Page(common)
|
PageBME280(CommonData &common) : Page(common)
|
||||||
{
|
{
|
||||||
logger->logDebug(GwLog::LOG,"Instantiate PageBME280");
|
logger->logDebug(GwLog::LOG, "Instantiate PageBME280");
|
||||||
|
|
||||||
|
// Get config data
|
||||||
|
tempformat = config->getString(config->tempFormat);
|
||||||
|
useenvsensor = config->getString(config->useEnvSensor);
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
||||||
|
@ -29,13 +37,6 @@ public:
|
||||||
String svalue1 = "";
|
String svalue1 = "";
|
||||||
String svalue2 = "";
|
String svalue2 = "";
|
||||||
String svalue3 = "";
|
String svalue3 = "";
|
||||||
|
|
||||||
// Get config data
|
|
||||||
String tempformat = config->getString(config->tempFormat);
|
|
||||||
bool simulation = config->getBool(config->useSimuData);
|
|
||||||
String flashLED = config->getString(config->flashLED);
|
|
||||||
String backlightMode = config->getString(config->backlight);
|
|
||||||
String useenvsensor = config->getString(config->useEnvSensor);
|
|
||||||
|
|
||||||
// Get sensor values #1
|
// Get sensor values #1
|
||||||
String name1 = "Temp"; // Value name
|
String name1 = "Temp"; // Value name
|
||||||
|
@ -98,7 +99,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Logging boat values
|
// 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
|
// Draw page
|
||||||
//***********************************************************
|
//***********************************************************
|
||||||
|
|
|
@ -6,20 +6,25 @@
|
||||||
|
|
||||||
class PageBattery : public Page
|
class PageBattery : public Page
|
||||||
{
|
{
|
||||||
|
private:
|
||||||
|
String powsensor1;
|
||||||
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) : Page(common)
|
PageBattery(CommonData &common) : Page(common)
|
||||||
{
|
{
|
||||||
logger->logDebug(GwLog::LOG, "Instantiate PageBattery");
|
logger->logDebug(GwLog::LOG, "Instantiate PageBattery");
|
||||||
|
|
||||||
|
// Get config data
|
||||||
|
String powsensor1 = config->getString(config->usePowSensor1);
|
||||||
}
|
}
|
||||||
|
|
||||||
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 ++;
|
||||||
|
@ -47,15 +52,7 @@ class PageBattery : public Page
|
||||||
double value3 = 0;
|
double value3 = 0;
|
||||||
static String svalue3old = "";
|
static String svalue3old = "";
|
||||||
static String unit3old = "";
|
static String unit3old = "";
|
||||||
|
|
||||||
// Get config data
|
|
||||||
String lengthformat = config->getString(config->lengthFormat);
|
|
||||||
// bool simulation = config->getBool(config->useSimuData);
|
|
||||||
String flashLED = config->getString(config->flashLED);
|
|
||||||
String backlightMode = config->getString(config->backlight);
|
|
||||||
String powsensor1 = config->getString(config->usePowSensor1);
|
|
||||||
bool simulation = config->getBool(config->useSimuData);
|
|
||||||
|
|
||||||
// Get voltage value
|
// Get voltage value
|
||||||
String name1 = "VBat"; // Value name
|
String name1 = "VBat"; // Value name
|
||||||
if(String(powsensor1) == "INA219" || String(powsensor1) == "INA226"){
|
if(String(powsensor1) == "INA219" || String(powsensor1) == "INA226"){
|
||||||
|
@ -151,7 +148,7 @@ class PageBattery : public Page
|
||||||
}
|
}
|
||||||
|
|
||||||
// Logging boat values
|
// 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
|
// Draw page
|
||||||
//***********************************************************
|
//***********************************************************
|
||||||
|
|
|
@ -7,15 +7,26 @@
|
||||||
|
|
||||||
class PageBattery2 : public Page
|
class PageBattery2 : public Page
|
||||||
{
|
{
|
||||||
bool init = false; // Marker for init done
|
private:
|
||||||
int average = 0; // Average type [0...3], 0=off, 1=10s, 2=60s, 3=300s
|
String batVoltage;
|
||||||
bool trend = true; // Trend indicator [0|1], 0=off, 1=on
|
int batCapacity;
|
||||||
double raw = 0;
|
String batType;
|
||||||
|
String powerSensor;
|
||||||
|
bool init = false; // Marker for init done
|
||||||
|
int average = 0; // Average type [0...3], 0=off, 1=10s, 2=60s, 3=300s
|
||||||
|
bool trend = true; // Trend indicator [0|1], 0=off, 1=on
|
||||||
|
double raw = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageBattery2(CommonData &common) : Page(common)
|
PageBattery2(CommonData &common) : Page(common)
|
||||||
{
|
{
|
||||||
logger->logDebug(GwLog::LOG, "Instantiate PageBattery2");
|
logger->logDebug(GwLog::LOG, "Instantiate PageBattery2");
|
||||||
|
|
||||||
|
// Get config data
|
||||||
|
batVoltage = config->getString(config->batteryVoltage);
|
||||||
|
batCapacity = config->getInt(config->batteryCapacity);
|
||||||
|
batType = config->getString(config->batteryType);
|
||||||
|
powerSensor = config->getString(config->usePowSensor1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setupKeys(){
|
void setupKeys(){
|
||||||
|
@ -54,16 +65,6 @@ public:
|
||||||
int batPercentage = 0; // Battery level
|
int batPercentage = 0; // Battery level
|
||||||
float batRange = 0; // Range in hours
|
float batRange = 0; // Range in hours
|
||||||
|
|
||||||
// Get config data
|
|
||||||
bool simulation = config->getBool(config->useSimuData);
|
|
||||||
bool holdvalues = config->getBool(config->holdvalues);
|
|
||||||
String flashLED = config->getString(config->flashLED);
|
|
||||||
String batVoltage = config->getString(config->batteryVoltage);
|
|
||||||
int batCapacity = config->getInt(config->batteryCapacity);
|
|
||||||
String batType = config->getString(config->batteryType);
|
|
||||||
String backlightMode = config->getString(config->backlight);
|
|
||||||
String powerSensor = config->getString(config->usePowSensor1);
|
|
||||||
|
|
||||||
double value1 = 0; // Battery voltage
|
double value1 = 0; // Battery voltage
|
||||||
double value2 = 0; // Battery current
|
double value2 = 0; // Battery current
|
||||||
double value3 = 0; // Battery power consumption
|
double value3 = 0; // Battery power consumption
|
||||||
|
@ -175,7 +176,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Logging voltage value
|
// 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
|
// Draw page
|
||||||
//***********************************************************
|
//***********************************************************
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
class PageClock : public Page
|
class PageClock : public Page
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
bool simulation = false;
|
String dateformat;
|
||||||
int simtime;
|
int simtime;
|
||||||
bool keylock = false;
|
bool keylock = false;
|
||||||
char source = 'R'; // time source (R)TC | (G)PS | (N)TP
|
char source = 'R'; // time source (R)TC | (G)PS | (N)TP
|
||||||
|
@ -34,23 +34,24 @@ public:
|
||||||
{
|
{
|
||||||
logger->logDebug(GwLog::LOG, "Instantiate PageClock");
|
logger->logDebug(GwLog::LOG, "Instantiate PageClock");
|
||||||
|
|
||||||
// WIP time source
|
// Get config data
|
||||||
#ifdef BOARD_OBP60S3
|
dateformat = config->getString(config->dateFormat);
|
||||||
String use_rtc = config->getString(config->useRTC);
|
|
||||||
if (use_rtc == "off") {
|
|
||||||
source = 'G';
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
simulation = config->getBool(config->useSimuData);
|
|
||||||
timezone = config->getString(config->timeZone).toDouble();
|
timezone = config->getString(config->timeZone).toDouble();
|
||||||
homelat = config->getString(config->homeLAT).toDouble();
|
homelat = config->getString(config->homeLAT).toDouble();
|
||||||
homelon = config->getString(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
|
||||||
|
|
||||||
|
#ifdef BOARD_OBP60S3
|
||||||
|
// WIP time source
|
||||||
|
String use_rtc = config->getString(config->useRTC);
|
||||||
|
if (use_rtc == "off") {
|
||||||
|
source = 'G';
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void setupKeys(){
|
void setupKeys(){
|
||||||
Page::setupKeys();
|
Page::setupKeys();
|
||||||
commonData->keydata[0].label = "SRC";
|
commonData->keydata[0].label = "SRC";
|
||||||
commonData->keydata[1].label = "MODE";
|
commonData->keydata[1].label = "MODE";
|
||||||
|
@ -58,7 +59,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Key functions
|
// Key functions
|
||||||
virtual int handleKey(int key){
|
int handleKey(int key){
|
||||||
// Time source
|
// Time source
|
||||||
if (key == 1) {
|
if (key == 1) {
|
||||||
if (source == 'G') {
|
if (source == 'G') {
|
||||||
|
@ -113,13 +114,6 @@ public:
|
||||||
double value3 = 0; // HDOP
|
double value3 = 0; // HDOP
|
||||||
bool gpsvalid = false;
|
bool gpsvalid = false;
|
||||||
|
|
||||||
// Get config data
|
|
||||||
String lengthformat = config->getString(config->lengthFormat);
|
|
||||||
String dateformat = config->getString(config->dateFormat);
|
|
||||||
bool holdvalues = config->getBool(config->holdvalues);
|
|
||||||
String flashLED = config->getString(config->flashLED);
|
|
||||||
String backlightMode = config->getString(config->backlight);
|
|
||||||
|
|
||||||
// Get boat values for GPS time
|
// Get boat values for GPS time
|
||||||
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue)
|
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue)
|
||||||
String name1 = bvalue1->getName().c_str(); // Value name
|
String name1 = bvalue1->getName().c_str(); // Value name
|
||||||
|
@ -175,7 +169,7 @@ public:
|
||||||
|
|
||||||
// Logging boat values
|
// Logging boat values
|
||||||
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
|
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
|
// Draw page
|
||||||
//***********************************************************
|
//***********************************************************
|
||||||
|
@ -392,7 +386,7 @@ public:
|
||||||
if (hour > 12) {
|
if (hour > 12) {
|
||||||
hour -= 12.0;
|
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
|
// Draw hour pointer
|
||||||
float startwidth = 8; // Start width of pointer
|
float startwidth = 8; // Start width of pointer
|
||||||
|
|
|
@ -25,56 +25,48 @@ const float Compass_LineDelta = 8.0;// compass band: 1deg = 5 Pixels, 10deg = 50
|
||||||
|
|
||||||
class PageCompass : public Page
|
class PageCompass : public Page
|
||||||
{
|
{
|
||||||
|
private:
|
||||||
int WhichDataCompass = ShowHDM;
|
int WhichDataCompass = ShowHDM;
|
||||||
int WhichDataDisplay = ShowHDM;
|
int WhichDataDisplay = ShowHDM;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageCompass(CommonData &common) : Page(common)
|
PageCompass(CommonData &common) : Page(common)
|
||||||
{
|
{
|
||||||
logger->logDebug(GwLog::LOG, "Instantiate PageCompass");
|
logger->logDebug(GwLog::LOG, "Instantiate PageCompass");
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void setupKeys(){
|
void setupKeys(){
|
||||||
Page::setupKeys();
|
Page::setupKeys();
|
||||||
commonData->keydata[0].label = "CMP";
|
commonData->keydata[0].label = "CMP";
|
||||||
commonData->keydata[1].label = "SRC";
|
commonData->keydata[1].label = "SRC";
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int handleKey(int key){
|
int handleKey(int key){
|
||||||
// Code for keylock
|
// Code for keylock
|
||||||
|
if (key == 1) {
|
||||||
if ( key == 1 ) {
|
|
||||||
WhichDataCompass += 1;
|
WhichDataCompass += 1;
|
||||||
if ( WhichDataCompass > ShowCOG)
|
if ( WhichDataCompass > ShowCOG)
|
||||||
WhichDataCompass = ShowHDM;
|
WhichDataCompass = ShowHDM;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if ( key == 2 ) {
|
if (key == 2) {
|
||||||
WhichDataDisplay += 1;
|
WhichDataDisplay += 1;
|
||||||
if ( WhichDataDisplay > ShowDBS)
|
if (WhichDataDisplay > ShowDBS)
|
||||||
WhichDataDisplay = ShowHDM;
|
WhichDataDisplay = ShowHDM;
|
||||||
}
|
}
|
||||||
|
if (key == 11) {
|
||||||
if(key == 11){
|
|
||||||
commonData->keylock = !commonData->keylock;
|
commonData->keylock = !commonData->keylock;
|
||||||
return 0; // Commit the key
|
return 0; // Commit the key
|
||||||
}
|
}
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
int displayPage(PageData &pageData){
|
int displayPage(PageData &pageData) {
|
||||||
|
|
||||||
// Old values for hold function
|
// Old values for hold function
|
||||||
static String OldDataText[HowManyValues] = {"", "", "","", "", ""};
|
static String OldDataText[HowManyValues] = {"", "", "","", "", ""};
|
||||||
static String OldDataUnits[HowManyValues] = {"", "", "","", "", ""};
|
static String OldDataUnits[HowManyValues] = {"", "", "","", "", ""};
|
||||||
|
|
||||||
// Get config data
|
|
||||||
String lengthformat = config->getString(config->lengthFormat);
|
|
||||||
// bool simulation = config->getBool(config->useSimuData);
|
|
||||||
bool holdvalues = config->getBool(config->holdvalues);
|
|
||||||
String flashLED = config->getString(config->flashLED);
|
|
||||||
String backlightMode = config->getString(config->backlight);
|
|
||||||
|
|
||||||
GwApi::BoatValue *bvalue;
|
GwApi::BoatValue *bvalue;
|
||||||
String DataName[HowManyValues];
|
String DataName[HowManyValues];
|
||||||
double DataValue[HowManyValues];
|
double DataValue[HowManyValues];
|
||||||
|
@ -94,7 +86,7 @@ class PageCompass : public Page
|
||||||
DataValue[i] = TheFormattedData.value; // Value as double in SI unit
|
DataValue[i] = TheFormattedData.value; // Value as double in SI unit
|
||||||
DataValid[i] = bvalue->valid;
|
DataValid[i] = bvalue->valid;
|
||||||
DataFormat[i] = bvalue->getFormat(); // Unit of value
|
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)
|
// Optical warning by limit violation (unused)
|
||||||
|
|
|
@ -6,13 +6,19 @@
|
||||||
|
|
||||||
class PageDST810 : public Page
|
class PageDST810 : public Page
|
||||||
{
|
{
|
||||||
|
private:
|
||||||
|
String lengthformat;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageDST810(CommonData &common) : Page(common)
|
PageDST810(CommonData &common) : Page(common)
|
||||||
{
|
{
|
||||||
logger->logDebug(GwLog::LOG, "Instantiate PageDST810");
|
logger->logDebug(GwLog::LOG, "Instantiate PageDST810");
|
||||||
|
|
||||||
|
// Get config data
|
||||||
|
lengthformat = config->getString(config->lengthFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
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,7 +27,7 @@ public:
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
int displayPage(PageData &pageData){
|
int displayPage(PageData &pageData) {
|
||||||
|
|
||||||
// Old values for hold function
|
// Old values for hold function
|
||||||
static String svalue1old = "";
|
static String svalue1old = "";
|
||||||
|
@ -33,13 +39,6 @@ public:
|
||||||
static String svalue4old = "";
|
static String svalue4old = "";
|
||||||
static String unit4old = "";
|
static String unit4old = "";
|
||||||
|
|
||||||
// Get config data
|
|
||||||
String lengthformat = config->getString(config->lengthFormat);
|
|
||||||
// bool simulation = config->getBool(config->useSimuData);
|
|
||||||
bool holdvalues = config->getBool(config->holdvalues);
|
|
||||||
String flashLED = config->getString(config->flashLED);
|
|
||||||
String backlightMode = config->getString(config->backlight);
|
|
||||||
|
|
||||||
// Get boat values #1
|
// Get boat values #1
|
||||||
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue)
|
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue)
|
||||||
String name1 = xdrDelete(bvalue1->getName()); // Value name
|
String name1 = xdrDelete(bvalue1->getName()); // Value name
|
||||||
|
@ -84,7 +83,7 @@ public:
|
||||||
|
|
||||||
// Logging boat values
|
// Logging boat values
|
||||||
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
|
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
|
// Draw page
|
||||||
//***********************************************************
|
//***********************************************************
|
||||||
|
|
|
@ -12,18 +12,13 @@
|
||||||
class PageEPropulsion : public Page
|
class PageEPropulsion : public Page
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
bool simulation = false;
|
|
||||||
bool holdvalues = false;
|
|
||||||
String flashLED;
|
|
||||||
String backlightMode;
|
|
||||||
|
|
||||||
char mode = 'N'; // (N)ormal, (C)onfig
|
char mode = 'N'; // (N)ormal, (C)onfig
|
||||||
|
|
||||||
void displayModeNormal(PageData &pageData) {
|
void displayModeNormal(PageData &pageData) {
|
||||||
|
|
||||||
// TBD Boatvalues: ...
|
// TBD Boatvalues: ...
|
||||||
|
|
||||||
LOG_DEBUG(GwLog::DEBUG,"Drawing at PageEPropulsion");
|
logger->logDebug(GwLog::DEBUG, "Drawing at PageEPropulsion");
|
||||||
|
|
||||||
// Title and corner value headings
|
// Title and corner value headings
|
||||||
epd->setTextColor(commonData->fgcolor);
|
epd->setTextColor(commonData->fgcolor);
|
||||||
|
@ -49,14 +44,7 @@ public:
|
||||||
PageEPropulsion(CommonData &common) : Page(common)
|
PageEPropulsion(CommonData &common) : Page(common)
|
||||||
{
|
{
|
||||||
logger->logDebug(GwLog::LOG,"Instantiate PageEPropulsion");
|
logger->logDebug(GwLog::LOG,"Instantiate PageEPropulsion");
|
||||||
|
}
|
||||||
// preload configuration data
|
|
||||||
simulation = config->getBool(config->useSimuData);
|
|
||||||
holdvalues = config->getBool(config->holdvalues);
|
|
||||||
flashLED = config->getString(config->flashLED);
|
|
||||||
backlightMode = config->getString(config->backlight);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void setupKeys(){
|
void setupKeys(){
|
||||||
Page::setupKeys();
|
Page::setupKeys();
|
||||||
|
@ -105,7 +93,7 @@ public:
|
||||||
int displayPage(PageData &pageData){
|
int displayPage(PageData &pageData){
|
||||||
|
|
||||||
// Logging boat values
|
// 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
|
// Set display in partial refresh mode
|
||||||
epd->setPartialWindow(0, 0, epd->width(), epd->height());
|
epd->setPartialWindow(0, 0, epd->width(), epd->height());
|
||||||
|
|
|
@ -67,25 +67,22 @@ static unsigned char fish_bits[] = {
|
||||||
|
|
||||||
class PageFluid : public Page
|
class PageFluid : public Page
|
||||||
{
|
{
|
||||||
bool simulation = false;
|
private:
|
||||||
double simgoto;
|
double simgoto;
|
||||||
double simval;
|
double simval;
|
||||||
double simstep;
|
double simstep;
|
||||||
bool holdvalues = false;
|
|
||||||
int fluidtype;
|
int fluidtype;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageFluid(CommonData &common) : Page(common)
|
PageFluid(CommonData &common) : Page(common)
|
||||||
{
|
{
|
||||||
logger->logDebug(GwLog::LOG,"Instantiate PageFluid");
|
logger->logDebug(GwLog::LOG, "Instantiate PageFluid");
|
||||||
simulation = config->getBool(config->useSimuData);
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
||||||
|
@ -94,12 +91,12 @@ class PageFluid : public Page
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void displayNew(PageData &pageData){
|
void displayNew(PageData &pageData) {
|
||||||
fluidtype = config->getInt("page" + String(pageData.pageNumber) + "fluid", 0);
|
fluidtype = config->getInt("page" + String(pageData.pageNumber) + "fluid", 0);
|
||||||
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) {
|
||||||
|
|
||||||
// Old values for hold function
|
// Old values for hold function
|
||||||
static double value1old;
|
static double value1old;
|
||||||
|
@ -131,7 +128,7 @@ class PageFluid : public Page
|
||||||
}
|
}
|
||||||
|
|
||||||
// Logging boat values
|
// 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
|
// Draw page
|
||||||
//***********************************************************
|
//***********************************************************
|
||||||
|
|
|
@ -7,10 +7,15 @@
|
||||||
|
|
||||||
class PageFourValues : public Page
|
class PageFourValues : public Page
|
||||||
{
|
{
|
||||||
|
private:
|
||||||
|
String lengthformat;
|
||||||
public:
|
public:
|
||||||
PageFourValues(CommonData &common) : Page(common)
|
PageFourValues(CommonData &common) : Page(common)
|
||||||
{
|
{
|
||||||
logger->logDebug(GwLog::LOG, "Instantiate PageFourValues");
|
logger->logDebug(GwLog::LOG, "Instantiate PageFourValues");
|
||||||
|
|
||||||
|
// Get config data
|
||||||
|
lengthformat = config->getString(config->lengthFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
int handleKey(int key){
|
int handleKey(int key){
|
||||||
|
@ -33,14 +38,7 @@ public:
|
||||||
static String unit3old = "";
|
static String unit3old = "";
|
||||||
static String svalue4old = "";
|
static String svalue4old = "";
|
||||||
static String unit4old = "";
|
static String unit4old = "";
|
||||||
|
|
||||||
// Get config data
|
|
||||||
String lengthformat = config->getString(config->lengthFormat);
|
|
||||||
// bool simulation = config->getBool(config->useSimuData);
|
|
||||||
bool holdvalues = config->getBool(config->holdvalues);
|
|
||||||
String flashLED = config->getString(config->flashLED);
|
|
||||||
String backlightMode = config->getString(config->backlight);
|
|
||||||
|
|
||||||
// Get boat values #1
|
// Get boat values #1
|
||||||
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue)
|
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue)
|
||||||
String name1 = xdrDelete(bvalue1->getName()); // Value name
|
String name1 = xdrDelete(bvalue1->getName()); // Value name
|
||||||
|
@ -89,7 +87,7 @@ public:
|
||||||
|
|
||||||
// Logging boat values
|
// Logging boat values
|
||||||
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
|
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
|
// Draw page
|
||||||
//***********************************************************
|
//***********************************************************
|
||||||
|
|
|
@ -7,13 +7,18 @@
|
||||||
|
|
||||||
class PageFourValues2 : public Page
|
class PageFourValues2 : public Page
|
||||||
{
|
{
|
||||||
|
private:
|
||||||
|
String lengthformat;
|
||||||
public:
|
public:
|
||||||
PageFourValues2(CommonData &common) : Page(common)
|
PageFourValues2(CommonData &common) : Page(common)
|
||||||
{
|
{
|
||||||
logger->logDebug(GwLog::LOG,"Instantiate PageFourValues2");
|
logger->logDebug(GwLog::LOG, "Instantiate PageFourValues2");
|
||||||
|
|
||||||
|
// Get config data
|
||||||
|
lengthformat = config->getString(config->lengthFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
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; // Toggle keylock
|
commonData->keylock = !commonData->keylock; // Toggle keylock
|
||||||
|
@ -22,7 +27,7 @@ public:
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
int displayPage(PageData &pageData){
|
int displayPage(PageData &pageData) {
|
||||||
|
|
||||||
// Old values for hold function
|
// Old values for hold function
|
||||||
static String svalue1old = "";
|
static String svalue1old = "";
|
||||||
|
@ -33,14 +38,7 @@ public:
|
||||||
static String unit3old = "";
|
static String unit3old = "";
|
||||||
static String svalue4old = "";
|
static String svalue4old = "";
|
||||||
static String unit4old = "";
|
static String unit4old = "";
|
||||||
|
|
||||||
// Get config data
|
|
||||||
String lengthformat = config->getString(config->lengthFormat);
|
|
||||||
// bool simulation = config->getBool(config->useSimuData);
|
|
||||||
bool holdvalues = config->getBool(config->holdvalues);
|
|
||||||
String flashLED = config->getString(config->flashLED);
|
|
||||||
String backlightMode = config->getString(config->backlight);
|
|
||||||
|
|
||||||
// Get boat values #1
|
// Get boat values #1
|
||||||
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue)
|
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue)
|
||||||
String name1 = xdrDelete(bvalue1->getName()); // Value name
|
String name1 = xdrDelete(bvalue1->getName()); // Value name
|
||||||
|
@ -89,7 +87,7 @@ public:
|
||||||
|
|
||||||
// Logging boat values
|
// Logging boat values
|
||||||
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
|
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
|
// Draw page
|
||||||
//***********************************************************
|
//***********************************************************
|
||||||
|
|
|
@ -7,10 +7,20 @@
|
||||||
|
|
||||||
class PageGenerator : public Page
|
class PageGenerator : public Page
|
||||||
{
|
{
|
||||||
|
private:
|
||||||
|
String batVoltage;
|
||||||
|
int genPower;
|
||||||
|
String powerSensor;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageGenerator(CommonData &common) : Page(common)
|
PageGenerator(CommonData &common) : Page(common)
|
||||||
{
|
{
|
||||||
logger->logDebug(GwLog::LOG, "Instantiate PageGenerator");
|
logger->logDebug(GwLog::LOG, "Instantiate PageGenerator");
|
||||||
|
|
||||||
|
// Get config data
|
||||||
|
batVoltage = config->getString(config->batteryVoltage);
|
||||||
|
genPower = config->getInt(config->genPower);
|
||||||
|
powerSensor = config->getString(config->usePowSensor3);
|
||||||
}
|
}
|
||||||
|
|
||||||
int handleKey(int key){
|
int handleKey(int key){
|
||||||
|
@ -24,15 +34,6 @@ public:
|
||||||
|
|
||||||
int displayPage(PageData &pageData) {
|
int displayPage(PageData &pageData) {
|
||||||
|
|
||||||
// Get config data
|
|
||||||
bool simulation = config->getBool(config->useSimuData);
|
|
||||||
bool holdvalues = config->getBool(config->holdvalues);
|
|
||||||
String flashLED = config->getString(config->flashLED);
|
|
||||||
String batVoltage = config->getString(config->batteryVoltage);
|
|
||||||
int genPower = config->getInt(config->genPower);
|
|
||||||
String backlightMode = config->getString(config->backlight);
|
|
||||||
String powerSensor = config->getString(config->usePowSensor3);
|
|
||||||
|
|
||||||
double value1 = 0; // Solar voltage
|
double value1 = 0; // Solar voltage
|
||||||
double value2 = 0; // Solar current
|
double value2 = 0; // Solar current
|
||||||
double value3 = 0; // Solar output power
|
double value3 = 0; // Solar output power
|
||||||
|
@ -76,7 +77,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Logging voltage value
|
// 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
|
// Draw page
|
||||||
//***********************************************************
|
//***********************************************************
|
||||||
|
|
|
@ -6,10 +6,20 @@
|
||||||
|
|
||||||
class PageKeelPosition : public Page
|
class PageKeelPosition : public Page
|
||||||
{
|
{
|
||||||
|
private:
|
||||||
|
String lengthformat;
|
||||||
|
String rotsensor;
|
||||||
|
String rotfunction;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageKeelPosition(CommonData &common) : Page(common)
|
PageKeelPosition(CommonData &common) : Page(common)
|
||||||
{
|
{
|
||||||
logger->logDebug(GwLog::LOG, "Instantiate PageKeelPosition");
|
logger->logDebug(GwLog::LOG, "Instantiate PageKeelPosition");
|
||||||
|
|
||||||
|
// Get config data
|
||||||
|
lengthformat = config->getString(config->lengthFormat);
|
||||||
|
rotsensor = config->getString(config->useRotSensor);
|
||||||
|
rotfunction = config->getString(config->rotFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Key functions
|
// Key functions
|
||||||
|
@ -27,15 +37,6 @@ public:
|
||||||
double value1 = 0;
|
double value1 = 0;
|
||||||
double value1old = 0;
|
double value1old = 0;
|
||||||
|
|
||||||
// Get config data
|
|
||||||
String lengthformat = config->getString(config->lengthFormat);
|
|
||||||
bool simulation = config->getBool(config->useSimuData);
|
|
||||||
bool holdvalues = config->getBool(config->holdvalues);
|
|
||||||
String flashLED = config->getString(config->flashLED);
|
|
||||||
String backlightMode = config->getString(config->backlight);
|
|
||||||
String rotsensor = config->getString(config->useRotSensor);
|
|
||||||
String rotfunction = config->getString(config->rotFunction);
|
|
||||||
|
|
||||||
// Get boat values for Keel position
|
// Get boat values for Keel position
|
||||||
bool valid1 = commonData->data.validRotAngle; // Valid information
|
bool valid1 = commonData->data.validRotAngle; // Valid information
|
||||||
if(simulation == false && rotsensor == "AS5600" && rotfunction == "Keel"){
|
if(simulation == false && rotsensor == "AS5600" && rotfunction == "Keel"){
|
||||||
|
@ -60,7 +61,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Logging boat values
|
// 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
|
// Draw page
|
||||||
//***********************************************************
|
//***********************************************************
|
||||||
|
|
|
@ -7,10 +7,15 @@
|
||||||
|
|
||||||
class PageOneValue : public Page
|
class PageOneValue : public Page
|
||||||
{
|
{
|
||||||
public:
|
private:
|
||||||
|
String lengthformat;
|
||||||
|
public:
|
||||||
PageOneValue(CommonData &common) : Page(common)
|
PageOneValue(CommonData &common) : Page(common)
|
||||||
{
|
{
|
||||||
logger->logDebug(GwLog::LOG, "Instantiate PageOneValue");
|
logger->logDebug(GwLog::LOG, "Instantiate PageOneValue");
|
||||||
|
|
||||||
|
// Get config data
|
||||||
|
lengthformat = config->getString(config->lengthFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
int handleKey(int key) {
|
int handleKey(int key) {
|
||||||
|
@ -28,12 +33,6 @@ class PageOneValue : public Page
|
||||||
static String svalue1old = "";
|
static String svalue1old = "";
|
||||||
static String unit1old = "";
|
static String unit1old = "";
|
||||||
|
|
||||||
// Get config data
|
|
||||||
String lengthformat = config->getString(config->lengthFormat);
|
|
||||||
// bool simulation = config->getBool(config->useSimuData);
|
|
||||||
bool holdvalues = config->getBool(config->holdvalues);
|
|
||||||
String flashLED = config->getString(config->flashLED);
|
|
||||||
String backlightMode = config->getString(config->backlight);
|
|
||||||
|
|
||||||
// Get boat values
|
// Get boat values
|
||||||
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue)
|
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue)
|
||||||
|
@ -53,7 +52,7 @@ class PageOneValue : public Page
|
||||||
|
|
||||||
// Logging boat values
|
// Logging boat values
|
||||||
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
|
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
|
// Draw page
|
||||||
//***********************************************************
|
//***********************************************************
|
||||||
|
|
|
@ -6,10 +6,26 @@
|
||||||
|
|
||||||
class PageRollPitch : public Page
|
class PageRollPitch : public Page
|
||||||
{
|
{
|
||||||
|
private:
|
||||||
|
String lengthformat;
|
||||||
|
int rolllimit;
|
||||||
|
String roffset;
|
||||||
|
double rolloffset;
|
||||||
|
String poffset;
|
||||||
|
double pitchoffset;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageRollPitch(CommonData &common) : Page(common)
|
PageRollPitch(CommonData &common) : Page(common)
|
||||||
{
|
{
|
||||||
logger->logDebug(GwLog::LOG, "Instantiate PageRollPitch");
|
logger->logDebug(GwLog::LOG, "Instantiate PageRollPitch");
|
||||||
|
|
||||||
|
// Get config data
|
||||||
|
String lengthformat = config->getString(config->lengthFormat);
|
||||||
|
rolllimit = config->getInt(config->rollLimit);
|
||||||
|
roffset = config->getString(config->rollOffset);
|
||||||
|
rolloffset = roffset.toFloat() / 360 * (2 * M_PI);
|
||||||
|
poffset = config->getString(config->pitchOffset);
|
||||||
|
pitchoffset = poffset.toFloat() / 360 * (2 * M_PI);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Key functions
|
// Key functions
|
||||||
|
@ -31,18 +47,6 @@ public:
|
||||||
String svalue2 = "";
|
String svalue2 = "";
|
||||||
String svalue2old = "";
|
String svalue2old = "";
|
||||||
|
|
||||||
// Get config data
|
|
||||||
String lengthformat = config->getString(config->lengthFormat);
|
|
||||||
bool simulation = config->getBool(config->useSimuData);
|
|
||||||
bool holdvalues = config->getBool(config->holdvalues);
|
|
||||||
String flashLED = config->getString(config->flashLED);
|
|
||||||
String backlightMode = config->getString(config->backlight);
|
|
||||||
int rolllimit = config->getInt(config->rollLimit);
|
|
||||||
String roffset = config->getString(config->rollOffset);
|
|
||||||
double rolloffset = roffset.toFloat()/360*(2*M_PI);
|
|
||||||
String poffset = config->getString(config->pitchOffset);
|
|
||||||
double pitchoffset = poffset.toFloat()/360*(2*M_PI);
|
|
||||||
|
|
||||||
// Get boat values for roll
|
// Get boat values for roll
|
||||||
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (xdrRoll)
|
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (xdrRoll)
|
||||||
String name1 = xdrDelete(bvalue1->getName()); // Value name
|
String name1 = xdrDelete(bvalue1->getName()); // Value name
|
||||||
|
@ -108,7 +112,7 @@ public:
|
||||||
|
|
||||||
// Logging boat values
|
// Logging boat values
|
||||||
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
|
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
|
// Draw page
|
||||||
//***********************************************************
|
//***********************************************************
|
||||||
|
|
|
@ -7,14 +7,20 @@
|
||||||
|
|
||||||
class PageRudderPosition : public Page
|
class PageRudderPosition : public Page
|
||||||
{
|
{
|
||||||
|
private:
|
||||||
|
String lengthformat;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageRudderPosition(CommonData &common) : Page(common)
|
PageRudderPosition(CommonData &common) : Page(common)
|
||||||
{
|
{
|
||||||
logger->logDebug(GwLog::LOG, "Show PageRudderPosition");
|
logger->logDebug(GwLog::LOG, "Instantiate PageRudderPosition");
|
||||||
|
|
||||||
|
// Get config data
|
||||||
|
String lengthformat = config->getString(config->lengthFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Key functions
|
// Key functions
|
||||||
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;
|
||||||
|
@ -29,13 +35,6 @@ public:
|
||||||
double value1 = 0.1;
|
double value1 = 0.1;
|
||||||
double value1old = 0.1;
|
double value1old = 0.1;
|
||||||
|
|
||||||
// Get config data
|
|
||||||
String lengthformat = config->getString(config->lengthFormat);
|
|
||||||
bool simulation = config->getBool(config->useSimuData);
|
|
||||||
bool holdvalues = config->getBool(config->holdvalues);
|
|
||||||
String flashLED = config->getString(config->flashLED);
|
|
||||||
String backlightMode = config->getString(config->backlight);
|
|
||||||
|
|
||||||
// Get boat values for rudder position
|
// Get boat values for rudder position
|
||||||
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list
|
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list
|
||||||
String name1 = bvalue1->getName().c_str(); // Value name
|
String name1 = bvalue1->getName().c_str(); // Value name
|
||||||
|
@ -46,15 +45,14 @@ public:
|
||||||
String svalue1 = formatValue(bvalue1, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
String svalue1 = formatValue(bvalue1, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
||||||
String unit1 = formatValue(bvalue1, *commonData).unit; // Unit of value
|
String unit1 = formatValue(bvalue1, *commonData).unit; // Unit of value
|
||||||
|
|
||||||
if(valid1 == true){
|
if (valid1 == true) {
|
||||||
value1old = value1; // Save old value
|
value1old = value1; // Save old value
|
||||||
unit1old = unit1; // Save old unit
|
unit1old = unit1; // Save old unit
|
||||||
} else {
|
} else {
|
||||||
if(simulation == true){
|
if (simulation == true) {
|
||||||
value1 = (3 + float(random(0, 50)) / 10.0)/360*2*PI;
|
value1 = (3 + float(random(0, 50)) / 10.0) / 360 * 2 * M_PI;
|
||||||
unit1 = "Deg";
|
unit1 = "Deg";
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
value1 = 0;
|
value1 = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,7 +65,7 @@ public:
|
||||||
|
|
||||||
// Logging boat values
|
// Logging boat values
|
||||||
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
|
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
|
// Draw page
|
||||||
//***********************************************************
|
//***********************************************************
|
||||||
|
@ -79,7 +77,7 @@ public:
|
||||||
|
|
||||||
// Draw RudderPosition
|
// Draw RudderPosition
|
||||||
int rInstrument = 110; // Radius of RudderPosition
|
int rInstrument = 110; // Radius of RudderPosition
|
||||||
float pi = 3.141592;
|
const float pi = 3.141592;
|
||||||
|
|
||||||
epd->fillCircle(200, 150, rInstrument + 10, commonData->fgcolor); // Outer circle
|
epd->fillCircle(200, 150, rInstrument + 10, commonData->fgcolor); // Outer circle
|
||||||
epd->fillCircle(200, 150, rInstrument + 7, commonData->bgcolor); // Outer circle
|
epd->fillCircle(200, 150, rInstrument + 7, commonData->bgcolor); // Outer circle
|
||||||
|
@ -127,7 +125,7 @@ public:
|
||||||
|
|
||||||
// Draw sub scale with lines (two triangles)
|
// Draw sub scale with lines (two triangles)
|
||||||
if(i % 30 == 0){
|
if(i % 30 == 0){
|
||||||
float dx=2; // Line thickness = 2*dx+1
|
float dx = 2; // Line thickness = 2*dx+1
|
||||||
float xx1 = -dx;
|
float xx1 = -dx;
|
||||||
float xx2 = +dx;
|
float xx2 = +dx;
|
||||||
float yy1 = -(rInstrument-10);
|
float yy1 = -(rInstrument-10);
|
||||||
|
|
|
@ -21,7 +21,7 @@ public:
|
||||||
logger->logDebug(GwLog::LOG, "Instantiate PageSixValues");
|
logger->logDebug(GwLog::LOG, "Instantiate PageSixValues");
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
||||||
|
|
|
@ -13,7 +13,7 @@ class PageSkyView : public Page
|
||||||
public:
|
public:
|
||||||
PageSkyView(CommonData &common) : Page(common)
|
PageSkyView(CommonData &common) : Page(common)
|
||||||
{
|
{
|
||||||
logger->logDebug(GwLog::LOG,"Instantiate PageSkyView");
|
logger->logDebug(GwLog::LOG, "Instantiate PageSkyView");
|
||||||
}
|
}
|
||||||
|
|
||||||
int handleKey(int key){
|
int handleKey(int key){
|
||||||
|
@ -27,11 +27,6 @@ public:
|
||||||
|
|
||||||
int displayPage(PageData &pageData) {
|
int displayPage(PageData &pageData) {
|
||||||
|
|
||||||
// Get config data
|
|
||||||
String flashLED = config->getString(config->flashLED);
|
|
||||||
String displaycolor = config->getString(config->displaycolor);
|
|
||||||
String backlightMode = config->getString(config->backlight);
|
|
||||||
|
|
||||||
// Optical warning by limit violation (unused)
|
// Optical warning by limit violation (unused)
|
||||||
if(String(flashLED) == "Limit Violation"){
|
if(String(flashLED) == "Limit Violation"){
|
||||||
setBlinkingLED(false);
|
setBlinkingLED(false);
|
||||||
|
|
|
@ -7,10 +7,20 @@
|
||||||
|
|
||||||
class PageSolar : public Page
|
class PageSolar : public Page
|
||||||
{
|
{
|
||||||
|
private:
|
||||||
|
String batVoltage;
|
||||||
|
int solPower;
|
||||||
|
String powerSensor;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageSolar(CommonData &common) : Page(common)
|
PageSolar(CommonData &common) : Page(common)
|
||||||
{
|
{
|
||||||
logger->logDebug(GwLog::LOG,"Instantiate PageSolar");
|
logger->logDebug(GwLog::LOG, "Instantiate PageSolar");
|
||||||
|
|
||||||
|
// Get config data
|
||||||
|
String batVoltage = config->getString(config->batteryVoltage);
|
||||||
|
int solPower = config->getInt(config->solarPower);
|
||||||
|
String powerSensor = config->getString(config->usePowSensor2);
|
||||||
}
|
}
|
||||||
|
|
||||||
int handleKey(int key){
|
int handleKey(int key){
|
||||||
|
@ -24,15 +34,6 @@ public:
|
||||||
|
|
||||||
int displayPage(PageData &pageData) {
|
int displayPage(PageData &pageData) {
|
||||||
|
|
||||||
// Get config data
|
|
||||||
bool simulation = config->getBool(config->useSimuData);
|
|
||||||
bool holdvalues = config->getBool(config->holdvalues);
|
|
||||||
String flashLED = config->getString(config->flashLED);
|
|
||||||
String batVoltage = config->getString(config->batteryVoltage);
|
|
||||||
int solPower = config->getInt(config->solarPower);
|
|
||||||
String backlightMode = config->getString(config->backlight);
|
|
||||||
String powerSensor = config->getString(config->usePowSensor2);
|
|
||||||
|
|
||||||
double value1 = 0; // Solar voltage
|
double value1 = 0; // Solar voltage
|
||||||
double value2 = 0; // Solar current
|
double value2 = 0; // Solar current
|
||||||
double value3 = 0; // Solar output power
|
double value3 = 0; // Solar output power
|
||||||
|
@ -76,7 +77,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Logging voltage value
|
// 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
|
// Draw page
|
||||||
//***********************************************************
|
//***********************************************************
|
||||||
|
|
|
@ -1,29 +1,6 @@
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
#if defined BOARD_OBP60S3 || defined BOARD_OBP40S3
|
#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>
|
|
||||||
#include "dirent.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
|
* Special system page, called directly with fast key sequence 5,4
|
||||||
* Out of normal page order.
|
* Out of normal page order.
|
||||||
|
@ -46,6 +23,26 @@
|
||||||
* powerInit(powermode);
|
* 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 "dirent.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
|
class PageSystem : public Page
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
@ -55,7 +52,6 @@ private:
|
||||||
// Generic data access
|
// Generic data access
|
||||||
|
|
||||||
uint64_t chipid;
|
uint64_t chipid;
|
||||||
bool simulation;
|
|
||||||
bool use_sdcard;
|
bool use_sdcard;
|
||||||
String buzzer_mode;
|
String buzzer_mode;
|
||||||
uint8_t buzzer_power;
|
uint8_t buzzer_power;
|
||||||
|
@ -86,7 +82,7 @@ private:
|
||||||
} else if (mode == 'C') { // Config
|
} else if (mode == 'C') { // Config
|
||||||
mode = 'D';
|
mode = 'D';
|
||||||
} else if (mode == 'D') { // Device list
|
} else if (mode == 'D') { // Device list
|
||||||
if (use_sdcard) {
|
if (hasSDCard) {
|
||||||
mode = 'A'; // SD-Card
|
mode = 'A'; // SD-Card
|
||||||
} else {
|
} else {
|
||||||
mode = 'N';
|
mode = 'N';
|
||||||
|
@ -99,7 +95,7 @@ private:
|
||||||
|
|
||||||
void decMode() {
|
void decMode() {
|
||||||
if (mode == 'N') {
|
if (mode == 'N') {
|
||||||
if (use_sdcard) {
|
if (hasSDCard) {
|
||||||
mode = 'A';
|
mode = 'A';
|
||||||
} else {
|
} else {
|
||||||
mode = 'D';
|
mode = 'D';
|
||||||
|
@ -188,8 +184,10 @@ private:
|
||||||
epd->setCursor(90, y0 + 48);
|
epd->setCursor(90, y0 + 48);
|
||||||
if (hasSDCard) {
|
if (hasSDCard) {
|
||||||
uint64_t cardsize = ((uint64_t) sdcard->csd.capacity) * sdcard->csd.sector_size / (1024 * 1024);
|
uint64_t cardsize = ((uint64_t) sdcard->csd.capacity) * sdcard->csd.sector_size / (1024 * 1024);
|
||||||
// epd->print(String(cardsize) + String(" MB"));
|
|
||||||
epd->printf("%llu MB", cardsize);
|
epd->printf("%llu MB", cardsize);
|
||||||
|
if (!use_sdcard) {
|
||||||
|
epd->print(" (disabled)");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
epd->print("off");
|
epd->print("off");
|
||||||
}
|
}
|
||||||
|
@ -394,8 +392,16 @@ private:
|
||||||
epd->setCursor(x0, y0);
|
epd->setCursor(x0, y0);
|
||||||
epd->print("Work in progress...");
|
epd->print("Work in progress...");
|
||||||
|
|
||||||
// TODO directories IMG, MAP, HIST should exist.
|
#ifdef BOARD_OBP40S3
|
||||||
// Show state: Files and used size
|
/* TODO identify card as OBP-Card:
|
||||||
|
magic.dat
|
||||||
|
version.dat
|
||||||
|
readme.txt
|
||||||
|
IMAGES/
|
||||||
|
CHARTS/
|
||||||
|
LOGS/
|
||||||
|
DATA/
|
||||||
|
*/
|
||||||
|
|
||||||
// Simple test for one file in root
|
// Simple test for one file in root
|
||||||
epd->setCursor(x0, y0 + 32);
|
epd->setCursor(x0, y0 + 32);
|
||||||
|
@ -480,6 +486,7 @@ private:
|
||||||
fclose(fh);
|
fclose(fh);
|
||||||
// epd->drawXBitmap(20, 200, buffer, width, height, commonData.fgcolor);
|
// epd->drawXBitmap(20, 200, buffer, width, height, commonData.fgcolor);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void displayModeDevicelist() {
|
void displayModeDevicelist() {
|
||||||
|
@ -516,7 +523,6 @@ public:
|
||||||
flashLED = config->getString(config->flashLED);
|
flashLED = config->getString(config->flashLED);
|
||||||
|
|
||||||
chipid = ESP.getEfuseMac();
|
chipid = ESP.getEfuseMac();
|
||||||
simulation = config->getBool(config->useSimuData);
|
|
||||||
#ifdef BOARD_OBP40S3
|
#ifdef BOARD_OBP40S3
|
||||||
use_sdcard = config->getBool(config->useSDCard);
|
use_sdcard = config->getBool(config->useSDCard);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -7,10 +7,15 @@
|
||||||
|
|
||||||
class PageThreeValues : public Page
|
class PageThreeValues : public Page
|
||||||
{
|
{
|
||||||
public:
|
private:
|
||||||
|
String lengthformat;
|
||||||
|
public:
|
||||||
PageThreeValues(CommonData &common) : Page(common)
|
PageThreeValues(CommonData &common) : Page(common)
|
||||||
{
|
{
|
||||||
logger->logDebug(GwLog::LOG, "Instantiate PageThreeValue");
|
logger->logDebug(GwLog::LOG, "Instantiate PageThreeValue");
|
||||||
|
|
||||||
|
// Get config data
|
||||||
|
lengthformat = config->getString(config->lengthFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
int handleKey(int key){
|
int handleKey(int key){
|
||||||
|
@ -32,13 +37,6 @@ class PageThreeValues : public Page
|
||||||
static String svalue3old = "";
|
static String svalue3old = "";
|
||||||
static String unit3old = "";
|
static String unit3old = "";
|
||||||
|
|
||||||
// Get config data
|
|
||||||
String lengthformat = config->getString(config->lengthFormat);
|
|
||||||
// bool simulation = config->getBool(config->useSimuData);
|
|
||||||
bool holdvalues = config->getBool(config->holdvalues);
|
|
||||||
String flashLED = config->getString(config->flashLED);
|
|
||||||
String backlightMode = config->getString(config->backlight);
|
|
||||||
|
|
||||||
// Get boat values #1
|
// Get boat values #1
|
||||||
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue)
|
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue)
|
||||||
String name1 = xdrDelete(bvalue1->getName()); // Value name
|
String name1 = xdrDelete(bvalue1->getName()); // Value name
|
||||||
|
@ -77,7 +75,7 @@ class PageThreeValues : public Page
|
||||||
|
|
||||||
// Logging boat values
|
// Logging boat values
|
||||||
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
|
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
|
// Draw page
|
||||||
//***********************************************************
|
//***********************************************************
|
||||||
|
|
|
@ -7,10 +7,15 @@
|
||||||
|
|
||||||
class PageTwoValues : public Page
|
class PageTwoValues : public Page
|
||||||
{
|
{
|
||||||
public:
|
private:
|
||||||
|
String lengthformat;
|
||||||
|
public:
|
||||||
PageTwoValues(CommonData &common) : Page(common)
|
PageTwoValues(CommonData &common) : Page(common)
|
||||||
{
|
{
|
||||||
logger->logDebug(GwLog::LOG, "Instantiate PageTwoValue");
|
logger->logDebug(GwLog::LOG, "Instantiate PageTwoValue");
|
||||||
|
|
||||||
|
// Get config data
|
||||||
|
lengthformat = config->getString(config->lengthFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
int handleKey(int key){
|
int handleKey(int key){
|
||||||
|
@ -30,12 +35,6 @@ class PageTwoValues : public Page
|
||||||
static String svalue2old = "";
|
static String svalue2old = "";
|
||||||
static String unit2old = "";
|
static String unit2old = "";
|
||||||
|
|
||||||
// Get config data
|
|
||||||
String lengthformat = config->getString(config->lengthFormat);
|
|
||||||
// bool simulation = config->getBool(config->useSimuData);
|
|
||||||
bool holdvalues = config->getBool(config->holdvalues);
|
|
||||||
String flashLED = config->getString(config->flashLED);
|
|
||||||
String backlightMode = config->getString(config->backlight);
|
|
||||||
|
|
||||||
// Get boat values #1
|
// Get boat values #1
|
||||||
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue)
|
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue)
|
||||||
|
@ -65,7 +64,7 @@ class PageTwoValues : public Page
|
||||||
|
|
||||||
// Logging boat values
|
// Logging boat values
|
||||||
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
|
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
|
// Draw page
|
||||||
//***********************************************************
|
//***********************************************************
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
class PageVoltage : public Page
|
class PageVoltage : public Page
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
String batVoltage;
|
||||||
|
String batType;
|
||||||
bool init = false; // Marker for init done
|
bool init = false; // Marker for init done
|
||||||
uint8_t average = 0; // Average type [0...3], 0=off, 1=10s, 2=60s, 3=300s
|
uint8_t average = 0; // Average type [0...3], 0=off, 1=10s, 2=60s, 3=300s
|
||||||
bool trend = true; // Trend indicator [0|1], 0=off, 1=on
|
bool trend = true; // Trend indicator [0|1], 0=off, 1=on
|
||||||
|
@ -18,6 +20,11 @@ public:
|
||||||
PageVoltage(CommonData &common) : Page(common)
|
PageVoltage(CommonData &common) : Page(common)
|
||||||
{
|
{
|
||||||
logger->logDebug(GwLog::LOG, "Instantiate PageVoltage");
|
logger->logDebug(GwLog::LOG, "Instantiate PageVoltage");
|
||||||
|
|
||||||
|
// Get config data
|
||||||
|
batVoltage = config->getString(config->batteryVoltage);
|
||||||
|
batType = config->getString(config->batteryType);
|
||||||
|
|
||||||
if (hasFRAM) {
|
if (hasFRAM) {
|
||||||
average = fram.read(FRAM_VOLTAGE_AVG);
|
average = fram.read(FRAM_VOLTAGE_AVG);
|
||||||
trend = fram.read(FRAM_VOLTAGE_TREND);
|
trend = fram.read(FRAM_VOLTAGE_TREND);
|
||||||
|
@ -29,14 +36,14 @@ public:
|
||||||
logger->logDebug(GwLog::LOG, "Destroy PageVoltage");
|
logger->logDebug(GwLog::LOG, "Destroy PageVoltage");
|
||||||
}
|
}
|
||||||
|
|
||||||
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";
|
||||||
}
|
}
|
||||||
|
|
||||||
int handleKey(int key){
|
int handleKey(int key) {
|
||||||
// Change average
|
// Change average
|
||||||
if(key == 1){
|
if(key == 1){
|
||||||
average ++;
|
average ++;
|
||||||
|
@ -107,14 +114,6 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
int displayPage(PageData &pageData) {
|
int displayPage(PageData &pageData) {
|
||||||
|
|
||||||
// Get config data
|
|
||||||
bool simulation = config->getBool(config->useSimuData);
|
|
||||||
bool holdvalues = config->getBool(config->holdvalues);
|
|
||||||
String flashLED = config->getString(config->flashLED);
|
|
||||||
String batVoltage = config->getString(config->batteryVoltage);
|
|
||||||
String batType = config->getString(config->batteryType);
|
|
||||||
String backlightMode = config->getString(config->backlight);
|
|
||||||
|
|
||||||
double value1 = 0;
|
double value1 = 0;
|
||||||
double valueTrend = 0; // Average over 10 values
|
double valueTrend = 0; // Average over 10 values
|
||||||
|
@ -191,7 +190,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Logging voltage value
|
// 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
|
// Draw page
|
||||||
//***********************************************************
|
//***********************************************************
|
||||||
|
|
|
@ -14,7 +14,8 @@
|
||||||
|
|
||||||
class PageWhite : public Page
|
class PageWhite : public Page
|
||||||
{
|
{
|
||||||
char mode = 'W'; // display mode (W)hite | (L)ogo | (M)FD logo
|
private:
|
||||||
|
char mode = 'W'; // display mode (W)hite | (L)ogo | (M)FD logo
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageWhite(CommonData &common) : Page(common)
|
PageWhite(CommonData &common) : Page(common)
|
||||||
|
@ -23,7 +24,7 @@ public:
|
||||||
refreshtime = 15000;
|
refreshtime = 15000;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int handleKey(int key) {
|
int handleKey(int key) {
|
||||||
// Change display mode
|
// Change display mode
|
||||||
if (key == 1) {
|
if (key == 1) {
|
||||||
if (mode == 'W') {
|
if (mode == 'W') {
|
||||||
|
@ -38,10 +39,7 @@ public:
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
int displayPage(PageData &pageData){
|
int displayPage(PageData &pageData) {
|
||||||
|
|
||||||
// Get config data
|
|
||||||
String flashLED = config->getString(config->flashLED);
|
|
||||||
|
|
||||||
// Optical warning by limit violation (unused)
|
// Optical warning by limit violation (unused)
|
||||||
if(String(flashLED) == "Limit Violation"){
|
if(String(flashLED) == "Limit Violation"){
|
||||||
|
@ -50,7 +48,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Logging boat values
|
// Logging boat values
|
||||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageWhite");
|
logger->logDebug(GwLog::LOG, "Drawing at PageWhite");
|
||||||
|
|
||||||
// Draw page
|
// Draw page
|
||||||
//***********************************************************
|
//***********************************************************
|
||||||
|
|
|
@ -215,15 +215,21 @@ static unsigned char front_bits[] PROGMEM = {
|
||||||
|
|
||||||
class PageWind : public Page
|
class PageWind : public Page
|
||||||
{
|
{
|
||||||
bool keylock = false; // Keylock
|
private:
|
||||||
int8_t lp = 80; // Pointer length
|
String lengthformat;
|
||||||
char mode = 'N'; // page mode (N)ormal | (L)ens | e(X)ample
|
bool keylock = false; // Keylock
|
||||||
char source = 'A'; // data source (A)pparent | (T)rue
|
int8_t lp = 80; // Pointer length
|
||||||
|
char mode = 'N'; // page mode (N)ormal | (L)ens | e(X)ample
|
||||||
|
char source = 'A'; // data source (A)pparent | (T)rue
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageWind(CommonData &common) : Page(common)
|
PageWind(CommonData &common) : Page(common)
|
||||||
{
|
{
|
||||||
logger->logDebug(GwLog::LOG, "Instantiate PageWind");
|
logger->logDebug(GwLog::LOG, "Instantiate PageWind");
|
||||||
|
|
||||||
|
// Get config data
|
||||||
|
lengthformat = config->getString(config->lengthFormat);
|
||||||
|
|
||||||
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 +237,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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 +249,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Key functions
|
// Key functions
|
||||||
int handleKey(int key){
|
int handleKey(int key) {
|
||||||
|
|
||||||
if(key == 1){ // Mode switch
|
if(key == 1){ // Mode switch
|
||||||
if(mode == 'N'){
|
if(mode == 'N'){
|
||||||
|
@ -304,13 +310,6 @@ public:
|
||||||
static String svalue2old = "";
|
static String svalue2old = "";
|
||||||
static String unit2old = "";
|
static String unit2old = "";
|
||||||
|
|
||||||
// Get config data
|
|
||||||
String lengthformat = config->getString(config->lengthFormat);
|
|
||||||
bool simulation = config->getBool(config->useSimuData);
|
|
||||||
bool holdvalues = config->getBool(config->holdvalues);
|
|
||||||
String flashLED = config->getString(config->flashLED);
|
|
||||||
String backlightMode = config->getString(config->backlight);
|
|
||||||
|
|
||||||
GwApi::BoatValue *bvalue1; // Value 1 for speed on top
|
GwApi::BoatValue *bvalue1; // Value 1 for speed on top
|
||||||
GwApi::BoatValue *bvalue2; // Value 2 for angle on bottom
|
GwApi::BoatValue *bvalue2; // Value 2 for angle on bottom
|
||||||
|
|
||||||
|
@ -353,7 +352,7 @@ public:
|
||||||
|
|
||||||
// Logging boat values
|
// Logging boat values
|
||||||
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
|
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
|
// Draw page
|
||||||
//***********************************************************
|
//***********************************************************
|
||||||
|
|
|
@ -49,7 +49,7 @@ int getRng(const RingBuffer<int16_t>& windDirHstry, int center, size_t amount)
|
||||||
|
|
||||||
// ****************************************************************
|
// ****************************************************************
|
||||||
class PageWindPlot : public Page {
|
class PageWindPlot : public Page {
|
||||||
|
private:
|
||||||
bool keylock = false; // Keylock
|
bool keylock = false; // Keylock
|
||||||
char chrtMode = 'D'; // Chart mode: 'D' for TWD, 'S' for TWS, 'B' for both
|
char chrtMode = 'D'; // Chart mode: 'D' for TWD, 'S' for TWS, 'B' for both
|
||||||
int dataIntv = 1; // Update interval for wind history chart:
|
int dataIntv = 1; // Update interval for wind history chart:
|
||||||
|
@ -62,8 +62,7 @@ public:
|
||||||
logger->logDebug(GwLog::LOG, "Instantiate PageWindPlot");
|
logger->logDebug(GwLog::LOG, "Instantiate PageWindPlot");
|
||||||
}
|
}
|
||||||
|
|
||||||
void setupKeys()
|
void setupKeys() {
|
||||||
{
|
|
||||||
Page::setupKeys();
|
Page::setupKeys();
|
||||||
// commonData->keydata[0].label = "MODE";
|
// commonData->keydata[0].label = "MODE";
|
||||||
commonData->keydata[1].label = "INTV";
|
commonData->keydata[1].label = "INTV";
|
||||||
|
@ -71,8 +70,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Key functions
|
// Key functions
|
||||||
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) {
|
||||||
if (chrtMode == 'D') {
|
if (chrtMode == 'D') {
|
||||||
|
@ -134,8 +132,6 @@ public:
|
||||||
static bool isInitialized = false; // Flag to indicate that page is initialized
|
static bool isInitialized = false; // Flag to indicate that page is initialized
|
||||||
static bool wndDataValid = false; // Flag to indicate if wind data is valid
|
static bool wndDataValid = false; // Flag to indicate if wind data is valid
|
||||||
static int numNoData; // Counter for multiple invalid data values in a row
|
static int numNoData; // Counter for multiple invalid data values in a row
|
||||||
static bool simulation = false;
|
|
||||||
static bool holdValues = false;
|
|
||||||
|
|
||||||
static int width; // Screen width
|
static int width; // Screen width
|
||||||
static int height; // Screen height
|
static int height; // Screen height
|
||||||
|
@ -169,13 +165,7 @@ public:
|
||||||
int chrtVal; // Current wind value
|
int chrtVal; // Current wind value
|
||||||
static int chrtPrevVal; // Last wind value in chart area for check if value crosses 180 degree line
|
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);
|
|
||||||
holdValues = config->getBool(config->holdvalues);
|
|
||||||
String flashLED = config->getString(config->flashLED);
|
|
||||||
String backlightMode = config->getString(config->backlight);
|
|
||||||
|
|
||||||
if (!isInitialized) {
|
if (!isInitialized) {
|
||||||
width = epd->width();
|
width = epd->width();
|
||||||
|
@ -237,7 +227,7 @@ public:
|
||||||
bufStart = max(0, bufStart - numAddedBufVals);
|
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],
|
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);
|
intvBufSize, numWndVals, bufStart, numAddedBufVals, pageData.boatHstry.twdHstry->getLastIdx(), oldDataIntv, dataIntv);
|
||||||
|
|
||||||
|
@ -250,7 +240,7 @@ public:
|
||||||
} else {
|
} else {
|
||||||
wndCenter = 0;
|
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);
|
wndCenter, diffRng, chrtRng);
|
||||||
} else {
|
} else {
|
||||||
// check and adjust range between left, center, and right chart limit
|
// check and adjust range between left, center, and right chart limit
|
||||||
|
@ -330,7 +320,7 @@ public:
|
||||||
|
|
||||||
// if (i >= (numWndVals / dataIntv) - 10)
|
// if (i >= (numWndVals / dataIntv) - 10)
|
||||||
if (i >= (numWndVals / dataIntv) - 1)
|
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)) {
|
if ((i == 0) || (chrtPrevVal == INT16_MIN)) {
|
||||||
// just a dot for 1st chart point or after some invalid values
|
// just a dot for 1st chart point or after some invalid values
|
||||||
|
@ -363,7 +353,7 @@ public:
|
||||||
|
|
||||||
int minWndDir = pageData.boatHstry.twdHstry->getMin(numWndVals) / 1000.0 * radToDeg;
|
int minWndDir = pageData.boatHstry.twdHstry->getMin(numWndVals) / 1000.0 * radToDeg;
|
||||||
int maxWndDir = pageData.boatHstry.twdHstry->getMax(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 + 540 >= wndCenter + 540) || (maxWndDir + 540 <= wndCenter + 540)) {
|
||||||
if (((minWndDir - wndCenter >= 0) && (minWndDir - wndCenter < 180)) || ((maxWndDir - wndCenter <= 0) && (maxWndDir - wndCenter >=180))) {
|
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
|
// Check if all wind value are left or right of center value -> optimize chart range
|
||||||
|
@ -372,14 +362,14 @@ public:
|
||||||
wndCenter = int((midWndDir + (midWndDir >= 0 ? 5 : -5)) / 10) * 10; // Set new center value; round to nearest 10 degree value
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// No valid data available
|
// 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->setFont(&Ubuntu_Bold10pt8b);
|
||||||
epd->fillRect(xCenter - 33, height / 2 - 20, 66, 24, commonData->bgcolor); // Clear area for message
|
epd->fillRect(xCenter - 33, height / 2 - 20, 66, 24, commonData->bgcolor); // Clear area for message
|
||||||
drawTextCenter(xCenter, height / 2 - 10, "No data");
|
drawTextCenter(xCenter, height / 2 - 10, "No data");
|
||||||
|
|
|
@ -7,16 +7,21 @@
|
||||||
|
|
||||||
class PageWindRose : public Page
|
class PageWindRose : public Page
|
||||||
{
|
{
|
||||||
int16_t lp = 80; // Pointer length
|
private:
|
||||||
|
String lengthformat;
|
||||||
|
int16_t lp = 80; // Pointer length
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageWindRose(CommonData &common)
|
PageWindRose(CommonData &common) : Page(common)
|
||||||
{
|
{
|
||||||
logger->logDebug(GwLog::LOG, "Instantiate PageWindRose");
|
logger->logDebug(GwLog::LOG, "Instantiate PageWindRose");
|
||||||
|
|
||||||
|
// Get config data
|
||||||
|
String lengthformat = config->getString(config->lengthFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Key functions
|
// Key functions
|
||||||
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;
|
||||||
|
@ -40,13 +45,6 @@ public:
|
||||||
static String svalue6old = "";
|
static String svalue6old = "";
|
||||||
static String unit6old = "";
|
static String unit6old = "";
|
||||||
|
|
||||||
// Get config data
|
|
||||||
String lengthformat = config->getString(config->lengthFormat);
|
|
||||||
bool simulation = config->getBool(config->useSimuData);
|
|
||||||
bool holdvalues = config->getBool(config->holdvalues);
|
|
||||||
String flashLED = config->getString(config->flashLED);
|
|
||||||
String backlightMode = config->getString(config->backlight);
|
|
||||||
|
|
||||||
// Get boat value for AWA
|
// Get boat value for AWA
|
||||||
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue)
|
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue)
|
||||||
String name1 = xdrDelete(bvalue1->getName()); // Value name
|
String name1 = xdrDelete(bvalue1->getName()); // Value name
|
||||||
|
@ -140,7 +138,7 @@ public:
|
||||||
|
|
||||||
// Logging boat values
|
// Logging boat values
|
||||||
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
|
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
|
// Draw page
|
||||||
//***********************************************************
|
//***********************************************************
|
||||||
|
|
|
@ -7,16 +7,21 @@
|
||||||
|
|
||||||
class PageWindRoseFlex : public Page
|
class PageWindRoseFlex : public Page
|
||||||
{
|
{
|
||||||
int16_t lp = 80; // Pointer length
|
private:
|
||||||
|
String lengthformat;
|
||||||
|
int16_t lp = 80; // Pointer length
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageWindRoseFlex(CommonData &common) : Page(common)
|
PageWindRoseFlex(CommonData &common) : Page(common)
|
||||||
{
|
{
|
||||||
logger->logDebug(GwLog::LOG, "Instantiate PageWindRoseFlex");
|
logger->logDebug(GwLog::LOG, "Instantiate PageWindRoseFlex");
|
||||||
|
|
||||||
|
// Get config data
|
||||||
|
lengthformat = config->getString(config->lengthFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Key functions
|
// Key functions
|
||||||
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;
|
||||||
|
@ -25,7 +30,7 @@ public:
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
int displayPage(PageData &pageData){
|
int displayPage(PageData &pageData) {
|
||||||
|
|
||||||
static String svalue1old = "";
|
static String svalue1old = "";
|
||||||
static String unit1old = "";
|
static String unit1old = "";
|
||||||
|
@ -40,13 +45,6 @@ public:
|
||||||
static String svalue6old = "";
|
static String svalue6old = "";
|
||||||
static String unit6old = "";
|
static String unit6old = "";
|
||||||
|
|
||||||
// Get config data
|
|
||||||
String lengthformat = config->getString(config->lengthFormat);
|
|
||||||
bool simulation = config->getBool(config->useSimuData);
|
|
||||||
bool holdvalues = config->getBool(config->holdvalues);
|
|
||||||
String flashLED = config->getString(config->flashLED);
|
|
||||||
String backlightMode = config->getString(config->backlight);
|
|
||||||
|
|
||||||
// Get boat values #1
|
// Get boat values #1
|
||||||
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue)
|
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue)
|
||||||
String name1 = xdrDelete(bvalue1->getName()); // Value name
|
String name1 = xdrDelete(bvalue1->getName()); // Value name
|
||||||
|
@ -140,7 +138,7 @@ public:
|
||||||
|
|
||||||
// Logging boat values
|
// Logging boat values
|
||||||
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
|
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
|
// Draw page
|
||||||
//***********************************************************
|
//***********************************************************
|
||||||
|
|
|
@ -29,15 +29,18 @@ static unsigned char ship_bits[] PROGMEM = {
|
||||||
|
|
||||||
class PageXTETrack : public Page
|
class PageXTETrack : public Page
|
||||||
{
|
{
|
||||||
bool simulation = false;
|
private:
|
||||||
bool holdvalues = false;
|
String trackStep;
|
||||||
|
double seg_step;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PageXTETrack(CommonData &common) : Page(common)
|
PageXTETrack(CommonData &common) : Page(common)
|
||||||
{
|
{
|
||||||
logger->logDebug(GwLog::LOG, "Instantiate PageXTETrack");
|
logger->logDebug(GwLog::LOG, "Instantiate PageXTETrack");
|
||||||
simulation = config->getBool(config->useSimuData);
|
|
||||||
holdvalues = config->getBool(config->holdvalues);
|
// Get config data
|
||||||
|
String trackStep = config->getString(config->trackStep);
|
||||||
|
seg_step = trackStep.toDouble() * M_PI / 180;
|
||||||
}
|
}
|
||||||
|
|
||||||
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,
|
||||||
|
@ -57,7 +60,7 @@ class PageXTETrack : public Page
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
||||||
|
@ -66,16 +69,7 @@ class PageXTETrack : public Page
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
int displayPage(PageData &pageData){
|
int displayPage(PageData &pageData) {
|
||||||
GwConfigHandler *config = commonData->config;
|
|
||||||
GwLog *logger = commonData->logger;
|
|
||||||
|
|
||||||
// Get config data
|
|
||||||
String flashLED = config->getString(config->flashLED);
|
|
||||||
String backlightMode = config->getString(config->backlight);
|
|
||||||
|
|
||||||
String trackStep = config->getString(config->trackStep);
|
|
||||||
double seg_step = trackStep.toFloat() * PI / 180;
|
|
||||||
|
|
||||||
// Optical warning by limit violation (unused)
|
// Optical warning by limit violation (unused)
|
||||||
if(String(flashLED) == "Limit Violation"){
|
if(String(flashLED) == "Limit Violation"){
|
||||||
|
@ -84,7 +78,7 @@ class PageXTETrack : public Page
|
||||||
}
|
}
|
||||||
|
|
||||||
// Logging boat values
|
// Logging boat values
|
||||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageXTETrack");
|
logger->logDebug(GwLog::LOG, "Drawing at PageXTETrack");
|
||||||
|
|
||||||
// Draw page
|
// Draw page
|
||||||
//***********************************************************
|
//***********************************************************
|
||||||
|
|
|
@ -129,12 +129,20 @@ protected:
|
||||||
CommonData *commonData;
|
CommonData *commonData;
|
||||||
GwConfigHandler *config;
|
GwConfigHandler *config;
|
||||||
GwLog *logger;
|
GwLog *logger;
|
||||||
|
bool simulation = false;
|
||||||
|
bool holdvalues = false;
|
||||||
|
String flashLED;
|
||||||
|
String backlightMode;
|
||||||
public:
|
public:
|
||||||
Page(){}
|
|
||||||
Page(CommonData &common) {
|
Page(CommonData &common) {
|
||||||
commonData = &common;
|
commonData = &common;
|
||||||
config = commonData->config;
|
config = commonData->config;
|
||||||
logger = commonData->logger;
|
logger = commonData->logger;
|
||||||
|
// preload generic configuration data
|
||||||
|
simulation = config->getBool(config->useSimuData);
|
||||||
|
holdvalues = config->getBool(config->holdvalues);
|
||||||
|
flashLED = config->getString(config->flashLED);
|
||||||
|
backlightMode = config->getString(config->backlight);
|
||||||
}
|
}
|
||||||
int refreshtime = 1000;
|
int refreshtime = 1000;
|
||||||
virtual int displayPage(PageData &pageData)=0;
|
virtual int displayPage(PageData &pageData)=0;
|
||||||
|
|
Loading…
Reference in New Issue