Compare commits

..

No commits in common. "2749f25d159af9968eef12961ea1ae6d031df179" and "54b495479752a4ee7939d116bb33deda70444cc7" have entirely different histories.

38 changed files with 754 additions and 709 deletions

View File

@ -62,7 +62,6 @@ sdmmc_card_t *sdcard;
bool hasSDCard = false;
// Global vars
bool heartbeat = false; // Heartbeat indicator with two different states
bool blinkingLED = false; // Enable / disable blinking flash LED
bool statusLED = false; // Actual status of flash LED on/off
bool statusBacklightLED = false;// Actual status of flash LED on/off
@ -303,8 +302,8 @@ void toggleBacklightLED(uint brightness, const Color &color) {
void setFlashLED(bool status) {
if (ledTaskData == nullptr) return;
Color c = status ? COLOR_RED : COLOR_BLACK;
LedInterface current = ledTaskData->getLedData();
Color c = status?COLOR_RED:COLOR_BLACK;
LedInterface current=ledTaskData->getLedData();
current.setFlash(c);
ledTaskData->setLedData(current);
}
@ -460,6 +459,7 @@ void displayTrendLow(int16_t x, int16_t y, uint16_t size, uint16_t color){
// Show header informations
void displayHeader(CommonData &commonData, bool symbolmode, GwApi::BoatValue *date, GwApi::BoatValue *time, GwApi::BoatValue *hdop){
static bool heartbeat = false;
static unsigned long usbRxOld = 0;
static unsigned long usbTxOld = 0;
static unsigned long serRxOld = 0;

View File

@ -38,8 +38,6 @@ extern bool hasSDCard;
extern sdmmc_card_t *sdcard;
#endif
extern bool heartbeat;
// Fonts declarations for display (#includes see OBP60Extensions.cpp)
extern const GFXfont DSEG7Classic_BoldItalic16pt7b;
extern const GFXfont DSEG7Classic_BoldItalic20pt7b;

View File

@ -90,16 +90,16 @@ void sensorTask(void *param){
double voffset = (api->getConfig()->getConfigItem(api->getConfig()->vOffset,true)->asString()).toFloat();
double vslope = (api->getConfig()->getConfigItem(api->getConfig()->vSlope,true)->asString()).toFloat();
if(String(powsensor1) == "off"){
#ifdef VOLTAGE_SENSOR
#ifdef VOLTAGE_SENSOR
float rawVoltage = (float(analogRead(OBP_ANALOG0)) * 3.3 / 4096 + 0.53) * 2; // Vin = 1/2 for OBP40
#else
#else
float rawVoltage = (float(analogRead(OBP_ANALOG0)) * 3.3 / 4096 + 0.17) * 20; // Vin = 1/20 for OBP60
#endif
#endif
sensors.batteryVoltage = rawVoltage * vslope + voffset; // Calibration
#ifdef LIPO_ACCU_1200
#ifdef LIPO_ACCU_1200
sensors.BatteryChargeStatus = 0; // Set to discharging
sensors.batteryLevelLiPo = 0; // Level 0...100%
#endif
#endif
sensors.batteryCurrent = 0;
sensors.batteryPower = 0;
// Fill average arrays with start values
@ -499,24 +499,24 @@ void sensorTask(void *param){
if(millis() > starttime5 + 1000 && String(powsensor1) == "off"){
starttime5 = millis();
float rawVoltage = 0; // Default value
#ifdef BOARD_OBP40S3
#ifdef BOARD_OBP40S3
sensors.batteryVoltage = 0; // If no sensor then zero voltage
#endif
#if defined(BOARD_OBP40S3) && defined(VOLTAGE_SENSOR)
#endif
#if defined(BOARD_OBP40S3) && defined(VOLTAGE_SENSOR)
rawVoltage = (float(analogRead(OBP_ANALOG0)) * 3.3 / 4096 + 0.53) * 2; // Vin = 1/2 for OBP40
sensors.batteryVoltage = rawVoltage * vslope + voffset; // Calibration
#endif
#ifdef BOARD_OBP60S3
#endif
#ifdef BOARD_OBP60S3
rawVoltage = (float(analogRead(OBP_ANALOG0)) * 3.3 / 4096 + 0.17) * 20; // Vin = 1/20 for OBP60
sensors.batteryVoltage = rawVoltage * vslope + voffset; // Calibration
#endif
#endif
// Save new data in average array
batV.reading(int(sensors.batteryVoltage * 100));
// Calculate the average values for different time lines from integer values
sensors.batteryVoltage10 = batV.getAvg(10) / 100.0;
sensors.batteryVoltage60 = batV.getAvg(60) / 100.0;
sensors.batteryVoltage300 = batV.getAvg(300) / 100.0;
#if BOARD_OBP40S3 && defined LIPO_ACCU_1200 && defined VOLTAGE_SENSOR
#if BOARD_OBP40S3 && defined LIPO_ACCU_1200 && defined VOLTAGE_SENSOR
// Polynomfit for LiPo capacity calculation for 3,7V LiPo accus, 0...100%
sensors.batteryLevelLiPo = sensors.batteryVoltage60 * 203.8312 -738.1635;
// Limiter
@ -555,14 +555,14 @@ void sensorTask(void *param){
SetN2kDCBatStatus(N2kMsg, 10, sensors.batteryVoltage, N2kDoubleNA, N2kDoubleNA, 0);
api->sendN2kMessage(N2kMsg);
}
#endif
#ifdef BOARD_OBP60S3
#endif
#ifdef BOARD_OBP60S3
// Send to NMEA200 bus
if(!isnan(sensors.batteryVoltage)){
SetN2kDCBatStatus(N2kMsg, 0, sensors.batteryVoltage, N2kDoubleNA, N2kDoubleNA, 1);
api->sendN2kMessage(N2kMsg);
}
#endif
#endif
}
// Send data from environment sensor all 2s

View File

@ -19,6 +19,10 @@
class PageAIS : public Page
{
private:
bool simulation = false;
bool holdvalues = false;
String flashLED;
String backlightMode;
int scale = 5; // Radius of display circle in nautical miles
@ -32,7 +36,7 @@ private:
// TBD Boatvalues: ...
logger->logDebug(GwLog::DEBUG,"Drawing at PageAIS");
LOG_DEBUG(GwLog::DEBUG,"Drawing at PageAIS");
Point c = {200, 150}; // center = current boat position
uint16_t r = 125;
@ -80,8 +84,16 @@ private:
public:
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;
}
void setupKeys(){
@ -125,20 +137,13 @@ public:
}
#endif
void displayNew(PageData &pageData) {
#ifdef BOARD_OBP60S3
// Clear optical warning
if (flashLED == "Limit Violation") {
setBlinkingLED(false);
setFlashLED(false);
}
#endif
void displayNew(PageData &pageData){
};
int displayPage(PageData &pageData){
// Logging boat values
logger->logDebug(GwLog::LOG, "Drawing at PageAIS; Mode=%c", mode);
LOG_DEBUG(GwLog::LOG,"Drawing at PageAIS; Mode=%c", mode);
// Set display in partial refresh mode
epd->setPartialWindow(0, 0, epd->width(), epd->height());

View File

@ -51,6 +51,10 @@ static unsigned char anchor_bits[] = {
class PageAnchor : public Page
{
private:
bool simulation = false;
bool holdvalues = false;
String flashLED;
String backlightMode;
String lengthformat;
int scale = 50; // Radius of display circle in meter
@ -94,7 +98,7 @@ private:
String sval_hdop = formatValue(bv_hdop, *commonData).svalue;
String sunit_hdop = formatValue(bv_hdop, *commonData).unit;
logger->logDebug(GwLog::DEBUG, "Drawing at PageAnchor; DBS=%f, HDT=%f, AWS=%f", bv_dbs->value, bv_hdt->value, bv_aws->value);
LOG_DEBUG(GwLog::DEBUG,"Drawing at PageAnchor; DBS=%f, HDT=%f, AWS=%f", bv_dbs->value, bv_hdt->value, bv_aws->value);
Point c = {200, 150}; // center = anchor position
uint16_t r = 125;
@ -190,7 +194,7 @@ private:
// alarm range in meter has to be smaller than the scale in meter
// r and r_range are pixel values
uint16_t r_range = int(alarm_range * r / scale);
logger->logDebug(GwLog::LOG, "Drawing at PageAnchor; Alarm range = %d", r_range);
LOG_DEBUG(GwLog::LOG,"Drawing at PageAnchor; Alarm range = %d", r_range);
epd->drawCircle(c.x, c.y, r_range, commonData->fgcolor);
}
@ -216,7 +220,7 @@ private:
for (int i = 0 ; i < menu->getItemCount(); i++) {
ConfigMenuItem *itm = menu->getItemByIndex(i);
if (!itm) {
logger->logDebug(GwLog::ERROR, "Menu item not found: %d", i);
LOG_DEBUG(GwLog::ERROR, "Menu item not found: %d", i);
} else {
Rect r = menu->getItemRect(i);
bool inverted = (i == menu->getActiveIndex());
@ -240,9 +244,13 @@ private:
public:
PageAnchor(CommonData &common) : Page(common)
{
logger->logDebug(GwLog::LOG, "Instantiate PageAnchor");
logger->logDebug(GwLog::LOG,"Instantiate PageAnchor");
// 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);
chain_length = config->getInt(config->chainLength);
@ -258,7 +266,7 @@ public:
newitem = menu->addItem("chain", "Chain out", "int", 0, "m");
if (! newitem) {
// Demo: in case of failure exit here, should never be happen
logger->logDebug(GwLog::ERROR, "Menu item creation failed");
logger->logDebug(GwLog::ERROR,"Menu item creation failed");
return;
}
newitem->setRange(0, 200, {1, 5, 10});
@ -379,19 +387,12 @@ public:
#endif
void displayNew(PageData &pageData){
#ifdef BOARD_OBP60S3
// Clear optical warning
if (flashLED == "Limit Violation") {
setBlinkingLED(false);
setFlashLED(false);
}
#endif
};
int displayPage(PageData &pageData){
// Logging boat values
logger->logDebug(GwLog::LOG, "Drawing at PageAnchor; Mode=%c", mode);
LOG_DEBUG(GwLog::LOG,"Drawing at PageAnchor; Mode=%c", mode);
// Set display in partial refresh mode
epd->setPartialWindow(0, 0, epd->width(), epd->height()); // Set partial update

View File

@ -12,13 +12,18 @@
class PageAutopilot : public Page
{
private:
bool simulation = false;
bool holdvalues = false;
String flashLED;
String backlightMode;
char mode = 'N'; // (N)ormal, (C)onfig
void displayModeNormal(PageData &pageData) {
// TBD Boatvalues: ...
logger->logDebug(GwLog::DEBUG, "Drawing at PageAutopilot");
LOG_DEBUG(GwLog::DEBUG,"Drawing at PageAutopilot");
// Title and corner value headings
epd->setTextColor(commonData->fgcolor);
@ -44,15 +49,22 @@ public:
PageAutopilot(CommonData &common) : Page(common)
{
logger->logDebug(GwLog::LOG, "Instantiate PageAutopilot");
// 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();
commonData->keydata[0].label = "MODE";
}
#ifdef BOARD_OBP60S3
int handleKey(int key) {
int handleKey(int key){
if (key == 1) { // Switch between normal and config mode
if (mode == 'N') {
mode = 'C';
@ -89,19 +101,12 @@ public:
#endif
void displayNew(PageData &pageData){
#ifdef BOARD_OBP60S3
// Clear optical warning
if (flashLED == "Limit Violation") {
setBlinkingLED(false);
setFlashLED(false);
}
#endif
};
int displayPage(PageData &pageData){
// Logging boat values
logger->logDebug(GwLog::LOG, "Drawing at PageAutopilot; Mode=%c", mode);
LOG_DEBUG(GwLog::LOG,"Drawing at PageAutopilot; Mode=%c", mode);
// Set display in partial refresh mode
epd->setPartialWindow(0, 0, epd->width(), epd->height());

View File

@ -6,21 +6,13 @@
class PageBME280 : public Page
{
private:
String tempformat;
String useenvsensor;
public:
PageBME280(CommonData &common) : Page(common)
{
logger->logDebug(GwLog::LOG, "Instantiate PageBME280");
// Get config data
tempformat = config->getString(config->tempFormat);
useenvsensor = config->getString(config->useEnvSensor);
logger->logDebug(GwLog::LOG,"Instantiate PageBME280");
}
int handleKey(int key){
virtual int handleKey(int key){
// Code for keylock
if(key == 11){
commonData->keylock = !commonData->keylock;
@ -38,6 +30,13 @@ public:
String svalue2 = "";
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
String name1 = "Temp"; // Value name
name1 = name1.substring(0, 6); // String length limit for value name
@ -99,7 +98,7 @@ public:
}
// Logging boat values
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);
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);
// Draw page
//***********************************************************

View File

@ -6,25 +6,20 @@
class PageBattery : public Page
{
private:
String powsensor1;
int average = 0; // Average type [0...3], 0=off, 1=10s, 2=60s, 3=300s
public:
public:
PageBattery(CommonData &common) : Page(common)
{
logger->logDebug(GwLog::LOG, "Instantiate PageBattery");
// Get config data
String powsensor1 = config->getString(config->usePowSensor1);
}
void setupKeys(){
virtual void setupKeys(){
Page::setupKeys();
commonData->keydata[0].label = "AVG";
}
int handleKey(int key){
virtual int handleKey(int key){
// Change average
if(key == 1){
average ++;
@ -40,16 +35,6 @@ public:
return key;
}
void displayNew(PageData &pageData) {
#ifdef BOARD_OBP60S3
// Clear optical warning
if (flashLED == "Limit Violation") {
setBlinkingLED(false);
setFlashLED(false);
}
#endif
};
int displayPage(PageData &pageData){
// Old values for hold function
@ -63,6 +48,14 @@ public:
static String svalue3old = "";
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
String name1 = "VBat"; // Value name
if(String(powsensor1) == "INA219" || String(powsensor1) == "INA226"){
@ -151,8 +144,14 @@ public:
String svalue3 = String(value3); // Formatted value as string including unit conversion and switching decimal places
String unit3 = "W"; // Unit of value
// Optical warning by limit violation (unused)
if(String(flashLED) == "Limit Violation"){
setBlinkingLED(false);
setFlashLED(false);
}
// Logging boat values
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);
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);
// Draw page
//***********************************************************

View File

@ -7,26 +7,15 @@
class PageBattery2 : public Page
{
private:
String batVoltage;
int batCapacity;
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;
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:
PageBattery2(CommonData &common) : Page(common)
{
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(){
@ -65,6 +54,16 @@ public:
int batPercentage = 0; // Battery level
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 value2 = 0; // Battery current
double value3 = 0; // Battery power consumption
@ -140,27 +139,43 @@ public:
if(batRange > 99) batRange = 99;
// Optical warning by limit violation
if (flashLED == "Limit Violation") {
bool violation = false;
if (batType == "Pb") {
violation = (raw < 11.8 || raw > 14.8);
} else if (batType == "Gel") {
violation = (raw < 11.8 || raw > 14.4);
} else if (batType == "AGM") {
violation = (raw < 11.8 || raw > 14.7);
} else if (batType == "LiFePo4") {
violation = (raw < 12.0 || raw > 14.6);
}
if (violation) {
if(String(flashLED) == "Limit Violation"){
// Limits for Pb battery
if(String(batType) == "Pb" && (raw < 11.8 || raw > 14.8)){
setBlinkingLED(true);
} else {
}
if(String(batType) == "Pb" && (raw >= 11.8 && raw <= 14.8)){
setBlinkingLED(false);
setFlashLED(false);
}
// Limits for Gel battery
if(String(batType) == "Gel" && (raw < 11.8 || raw > 14.4)){
setBlinkingLED(true);
}
if(String(batType) == "Gel" && (raw >= 11.8 && raw <= 14.4)){
setBlinkingLED(false);
setFlashLED(false);
}
// Limits for AGM battery
if(String(batType) == "AGM" && (raw < 11.8 || raw > 14.7)){
setBlinkingLED(true);
}
if(String(batType) == "AGM" && (raw >= 11.8 && raw <= 14.7)){
setBlinkingLED(false);
setFlashLED(false);
}
// Limits for LiFePo4 battery
if(String(batType) == "LiFePo4" && (raw < 12.0 || raw > 14.6)){
setBlinkingLED(true);
}
if(String(batType) == "LiFePo4" && (raw >= 12.0 && raw <= 14.6)){
setBlinkingLED(false);
setFlashLED(false);
}
}
// Logging voltage value
logger->logDebug(GwLog::LOG, "Drawing at PageBattery2, Type:%s %s:=%f", batType.c_str(), name1.c_str(), raw);
LOG_DEBUG(GwLog::LOG,"Drawing at PageBattery2, Type:%s %s:=%f", batType.c_str(), name1.c_str(), raw);
// Draw page
//***********************************************************

View File

@ -18,7 +18,7 @@
class PageClock : public Page
{
private:
String dateformat;
bool simulation = false;
int simtime;
bool keylock = false;
char source = 'R'; // time source (R)TC | (G)PS | (N)TP
@ -34,24 +34,23 @@ public:
{
logger->logDebug(GwLog::LOG, "Instantiate PageClock");
// Get config data
dateformat = config->getString(config->dateFormat);
timezone = config->getString(config->timeZone).toDouble();
homelat = config->getString(config->homeLAT).toDouble();
homelon = config->getString(config->homeLON).toDouble();
homevalid = homelat >= -180.0 and homelat <= 180 and homelon >= -90.0 and homelon <= 90.0;
simtime = 38160; // time value 11:36
#ifdef BOARD_OBP60S3
// WIP time source
#ifdef BOARD_OBP60S3
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();
homelat = config->getString(config->homeLAT).toDouble();
homelon = config->getString(config->homeLON).toDouble();
homevalid = homelat >= -180.0 and homelat <= 180 and homelon >= -90.0 and homelon <= 90.0;
simtime = 38160; // time value 11:36
}
void setupKeys(){
virtual void setupKeys(){
Page::setupKeys();
commonData->keydata[0].label = "SRC";
commonData->keydata[1].label = "MODE";
@ -59,7 +58,7 @@ public:
}
// Key functions
int handleKey(int key){
virtual int handleKey(int key){
// Time source
if (key == 1) {
if (source == 'G') {
@ -97,18 +96,8 @@ public:
return key;
}
void displayNew(PageData &pageData) {
#ifdef BOARD_OBP60S3
// Clear optical warning
if (flashLED == "Limit Violation") {
setBlinkingLED(false);
setFlashLED(false);
}
#endif
};
int displayPage(PageData &pageData) {
int displayPage(PageData &pageData)
{
static String svalue1old = "";
static String unit1old = "";
static String svalue2old = "";
@ -124,6 +113,13 @@ public:
double value3 = 0; // HDOP
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
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue)
String name1 = bvalue1->getName().c_str(); // Value name
@ -179,7 +175,7 @@ public:
// Logging boat values
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
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);
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);
// Draw page
//***********************************************************
@ -396,7 +392,7 @@ public:
if (hour > 12) {
hour -= 12.0;
}
logger->logDebug(GwLog::DEBUG, "... PageClock, value1: %f hour: %f minute:%f", value1, hour, minute);
LOG_DEBUG(GwLog::DEBUG,"... PageClock, value1: %f hour: %f minute:%f", value1, hour, minute);
// Draw hour pointer
float startwidth = 8; // Start width of pointer

View File

@ -25,58 +25,56 @@ const float Compass_LineDelta = 8.0;// compass band: 1deg = 5 Pixels, 10deg = 50
class PageCompass : public Page
{
private:
int WhichDataCompass = ShowHDM;
int WhichDataDisplay = ShowHDM;
public:
public:
PageCompass(CommonData &common) : Page(common)
{
logger->logDebug(GwLog::LOG, "Instantiate PageCompass");
}
void setupKeys(){
virtual void setupKeys(){
Page::setupKeys();
commonData->keydata[0].label = "CMP";
commonData->keydata[1].label = "SRC";
}
int handleKey(int key){
virtual int handleKey(int key){
// Code for keylock
if (key == 1) {
if ( key == 1 ) {
WhichDataCompass += 1;
if ( WhichDataCompass > ShowCOG)
WhichDataCompass = ShowHDM;
return 0;
}
if (key == 2) {
if ( key == 2 ) {
WhichDataDisplay += 1;
if (WhichDataDisplay > ShowDBS)
if ( WhichDataDisplay > ShowDBS)
WhichDataDisplay = ShowHDM;
}
if (key == 11) {
if(key == 11){
commonData->keylock = !commonData->keylock;
return 0; // Commit the key
}
return key;
}
void displayNew(PageData &pageData) {
#ifdef BOARD_OBP60S3
// Clear optical warning
if (flashLED == "Limit Violation") {
setBlinkingLED(false);
setFlashLED(false);
}
#endif
};
int displayPage(PageData &pageData) {
int displayPage(PageData &pageData){
// Old values for hold function
static String OldDataText[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;
String DataName[HowManyValues];
double DataValue[HowManyValues];
@ -96,7 +94,13 @@ public:
DataValue[i] = TheFormattedData.value; // Value as double in SI unit
DataValid[i] = bvalue->valid;
DataFormat[i] = bvalue->getFormat(); // Unit of value
logger->logDebug(GwLog::LOG, "Drawing at PageCompass: %d %s %f %s %s", i, DataName[i], DataValue[i], DataFormat[i], DataText[i] );
LOG_DEBUG(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)
if(String(flashLED) == "Limit Violation"){
setBlinkingLED(false);
setFlashLED(false);
}
if (bvalue == NULL) return PAGE_OK; // WTF why this statement?

View File

@ -6,19 +6,13 @@
class PageDST810 : public Page
{
private:
String lengthformat;
public:
PageDST810(CommonData &common) : Page(common)
{
logger->logDebug(GwLog::LOG, "Instantiate PageDST810");
// Get config data
lengthformat = config->getString(config->lengthFormat);
}
int handleKey(int key) {
virtual int handleKey(int key){
// Code for keylock
if(key == 11){
commonData->keylock = !commonData->keylock;
@ -27,7 +21,7 @@ public:
return key;
}
int displayPage(PageData &pageData) {
int displayPage(PageData &pageData){
// Old values for hold function
static String svalue1old = "";
@ -39,6 +33,13 @@ public:
static String svalue4old = "";
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
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue)
String name1 = xdrDelete(bvalue1->getName()); // Value name
@ -83,7 +84,7 @@ public:
// Logging boat values
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
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);
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);
// Draw page
//***********************************************************

View File

@ -12,13 +12,18 @@
class PageEPropulsion : public Page
{
private:
bool simulation = false;
bool holdvalues = false;
String flashLED;
String backlightMode;
char mode = 'N'; // (N)ormal, (C)onfig
void displayModeNormal(PageData &pageData) {
// TBD Boatvalues: ...
logger->logDebug(GwLog::DEBUG, "Drawing at PageEPropulsion");
LOG_DEBUG(GwLog::DEBUG,"Drawing at PageEPropulsion");
// Title and corner value headings
epd->setTextColor(commonData->fgcolor);
@ -44,6 +49,13 @@ public:
PageEPropulsion(CommonData &common) : Page(common)
{
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(){
@ -88,19 +100,12 @@ public:
#endif
void displayNew(PageData &pageData){
#ifdef BOARD_OBP60S3
// Clear optical warning
if (flashLED == "Limit Violation") {
setBlinkingLED(false);
setFlashLED(false);
}
#endif
};
int displayPage(PageData &pageData){
// Logging boat values
logger->logDebug(GwLog::LOG,"Drawing at PageEPropulsion; Mode=%c", mode);
LOG_DEBUG(GwLog::LOG,"Drawing at PageEPropulsion; Mode=%c", mode);
// Set display in partial refresh mode
epd->setPartialWindow(0, 0, epd->width(), epd->height());

View File

@ -67,22 +67,25 @@ static unsigned char fish_bits[] = {
class PageFluid : public Page
{
private:
bool simulation = false;
double simgoto;
double simval;
double simstep;
bool holdvalues = false;
int fluidtype;
public:
public:
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));
simgoto = double(random(0, 100));
simstep = (simgoto - simval) / 20.0;
}
int handleKey(int key) {
virtual int handleKey(int key){
// Code for keylock
if(key == 11){
commonData->keylock = !commonData->keylock;
@ -91,23 +94,26 @@ public:
return key;
}
void displayNew(PageData &pageData) {
virtual void displayNew(PageData &pageData){
fluidtype = config->getInt("page" + String(pageData.pageNumber) + "fluid", 0);
logger->logDebug(GwLog::LOG, "New PageFluid: fluidtype=%d", fluidtype);
#ifdef BOARD_OBP60S3
// Clear optical warning
if (flashLED == "Limit Violation") {
setBlinkingLED(false);
setFlashLED(false);
}
#endif
}
int displayPage(PageData &pageData) {
int displayPage(PageData &pageData){
// Old values for hold function
static double value1old;
// Get config data
String flashLED = config->getString(config->flashLED);
String backlightMode = config->getString(config->backlight);
// Optical warning by limit violation (unused)
if(String(flashLED) == "Limit Violation"){
setBlinkingLED(false);
setFlashLED(false);
}
GwApi::BoatValue *bvalue1 = pageData.values[0];
String name1 = bvalue1->getName();
double fluidlevel = bvalue1->value;
@ -125,7 +131,7 @@ public:
}
// Logging boat values
logger->logDebug(GwLog::LOG, "Drawing at PageFluid: value=%f", bvalue1->value);
LOG_DEBUG(GwLog::LOG,"Drawing at PageFluid: value=%f", bvalue1->value);
// Draw page
//***********************************************************

View File

@ -7,16 +7,10 @@
class PageFourValues : public Page
{
private:
String lengthformat;
public:
PageFourValues(CommonData &common) : Page(common)
{
logger->logDebug(GwLog::LOG, "Instantiate PageFourValues");
// Get config data
lengthformat = config->getString(config->lengthFormat);
}
int handleKey(int key){
@ -28,16 +22,6 @@ public:
return key;
}
void displayNew(PageData &pageData) {
#ifdef BOARD_OBP60S3
// Clear optical warning
if (flashLED == "Limit Violation") {
setBlinkingLED(false);
setFlashLED(false);
}
#endif
};
int displayPage(PageData &pageData){
// Old values for hold function
@ -50,6 +34,13 @@ public:
static String svalue4old = "";
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
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue)
String name1 = xdrDelete(bvalue1->getName()); // Value name
@ -90,9 +81,15 @@ public:
String svalue4 = formatValue(bvalue4, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
String unit4 = formatValue(bvalue4, *commonData).unit; // Unit of value
// Optical warning by limit violation (unused)
if(String(flashLED) == "Limit Violation"){
setBlinkingLED(false);
setFlashLED(false);
}
// Logging boat values
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
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);
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);
// Draw page
//***********************************************************
@ -291,15 +288,8 @@ public:
return PAGE_UPDATE;
};
void leavePage(PageData &pageData) {
logger->logDebug(GwLog::LOG, "Leaving PageFourvalues");
}
};
static Page *createPage(CommonData &common){
return new PageFourValues(common);
}/**

View File

@ -7,19 +7,13 @@
class PageFourValues2 : public Page
{
private:
String lengthformat;
public:
PageFourValues2(CommonData &common) : Page(common)
{
logger->logDebug(GwLog::LOG, "Instantiate PageFourValues2");
// Get config data
lengthformat = config->getString(config->lengthFormat);
logger->logDebug(GwLog::LOG,"Instantiate PageFourValues2");
}
int handleKey(int key) {
virtual int handleKey(int key){
// Code for keylock
if(key == 11){
commonData->keylock = !commonData->keylock; // Toggle keylock
@ -28,17 +22,7 @@ public:
return key;
}
void displayNew(PageData &pageData) {
#ifdef BOARD_OBP60S3
// Clear optical warning
if (flashLED == "Limit Violation") {
setBlinkingLED(false);
setFlashLED(false);
}
#endif
};
int displayPage(PageData &pageData) {
int displayPage(PageData &pageData){
// Old values for hold function
static String svalue1old = "";
@ -50,6 +34,13 @@ public:
static String svalue4old = "";
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
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue)
String name1 = xdrDelete(bvalue1->getName()); // Value name
@ -90,9 +81,15 @@ public:
String svalue4 = formatValue(bvalue4, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
String unit4 = formatValue(bvalue4, *commonData).unit; // Unit of value
// Optical warning by limit violation (unused)
if(String(flashLED) == "Limit Violation"){
setBlinkingLED(false);
setFlashLED(false);
}
// Logging boat values
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
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);
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);
// Draw page
//***********************************************************

View File

@ -7,20 +7,10 @@
class PageGenerator : public Page
{
private:
String batVoltage;
int genPower;
String powerSensor;
public:
PageGenerator(CommonData &common) : Page(common)
{
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){
@ -34,6 +24,15 @@ public:
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 value2 = 0; // Solar current
double value3 = 0; // Solar output power
@ -60,19 +59,24 @@ public:
bool valid1 = true;
// Optical warning by limit violation
if (flashLED == "Limit Violation") {
// Over voltage?
if (batVoltage == "12V") {
setBlinkingLED(value1 > 14.8);
} else if (batVoltage == "24V") {
setBlinkingLED(value1 > 29.6);
} else {
if(String(flashLED) == "Limit Violation"){
// Over voltage
if(value1 > 14.8 && batVoltage == "12V"){
setBlinkingLED(true);
}
if(value1 <= 14.8 && batVoltage == "12V"){
setBlinkingLED(false);
}
if(value1 > 29.6 && batVoltage == "24V"){
setBlinkingLED(true);
}
if(value1 <= 29.6 && batVoltage == "24V"){
setBlinkingLED(false);
}
}
// Logging voltage value
logger->logDebug(GwLog::LOG, "Drawing at PageGenerator, Type:%iW %s:=%f", genPower, name1.c_str(), value1);
LOG_DEBUG(GwLog::LOG,"Drawing at PageGenerator, Type:%iW %s:=%f", genPower, name1.c_str(), value1);
// Draw page
//***********************************************************

View File

@ -6,20 +6,10 @@
class PageKeelPosition : public Page
{
private:
String lengthformat;
String rotsensor;
String rotfunction;
public:
PageKeelPosition(CommonData &common) : Page(common)
{
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
@ -32,21 +22,20 @@ public:
return key;
}
void displayNew(PageData &pageData) {
#ifdef BOARD_OBP60S3
// Clear optical warning
if (flashLED == "Limit Violation") {
setBlinkingLED(false);
setFlashLED(false);
}
#endif
};
int displayPage(PageData &pageData) {
double value1 = 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
bool valid1 = commonData->data.validRotAngle; // Valid information
if(simulation == false && rotsensor == "AS5600" && rotfunction == "Keel"){
@ -64,8 +53,14 @@ public:
value1old = value1; // Save old value
}
// Optical warning by limit violation (unused)
if(String(flashLED) == "Limit Violation"){
setBlinkingLED(false);
setFlashLED(false);
}
// Logging boat values
logger->logDebug(GwLog::LOG, "Drawing at PageKeelPosition, Keel:%f", value1);
LOG_DEBUG(GwLog::LOG,"Drawing at PageKeelPosition, Keel:%f", value1);
// Draw page
//***********************************************************

View File

@ -7,16 +7,10 @@
class PageOneValue : public Page
{
private:
String lengthformat;
public:
public:
PageOneValue(CommonData &common) : Page(common)
{
logger->logDebug(GwLog::LOG, "Instantiate PageOneValue");
// Get config data
lengthformat = config->getString(config->lengthFormat);
}
int handleKey(int key) {
@ -28,22 +22,18 @@ public:
return key;
}
void displayNew(PageData &pageData) {
#ifdef BOARD_OBP60S3
// Clear optical warning
if (flashLED == "Limit Violation") {
setBlinkingLED(false);
setFlashLED(false);
}
#endif
};
int displayPage(PageData &pageData) {
// Old values for hold function
static String svalue1old = "";
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
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue)
@ -55,9 +45,15 @@ public:
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
// Optical warning by limit violation (unused)
if(String(flashLED) == "Limit Violation"){
setBlinkingLED(false);
setFlashLED(false);
}
// Logging boat values
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
logger->logDebug(GwLog::LOG, "Drawing at PageOneValue, %s: %f", name1.c_str(), value1);
LOG_DEBUG(GwLog::LOG,"Drawing at PageOneValue, %s: %f", name1.c_str(), value1);
// Draw page
//***********************************************************

View File

@ -6,26 +6,10 @@
class PageRollPitch : public Page
{
private:
String lengthformat;
int rolllimit;
String roffset;
double rolloffset;
String poffset;
double pitchoffset;
public:
PageRollPitch(CommonData &common) : Page(common)
{
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
@ -47,6 +31,18 @@ public:
String svalue2 = "";
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
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (xdrRoll)
String name1 = xdrDelete(bvalue1->getName()); // Value name
@ -99,19 +95,20 @@ public:
}
// Optical warning by limit violation
if (flashLED == "Limit Violation") {
if(String(flashLED) == "Limit Violation"){
// Limits for roll
if (value1*360/(2*M_PI) >= -1*rolllimit && value1*360/(2*M_PI) <= rolllimit) {
if(value1*360/(2*M_PI) >= -1*rolllimit && value1*360/(2*M_PI) <= rolllimit){
setBlinkingLED(false);
setFlashLED(false);
} else {
}
else{
setBlinkingLED(true);
}
}
// Logging boat values
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
logger->logDebug(GwLog::LOG, "Drawing at PageRollPitch, %s:%f, %s:%f", name1.c_str(), value1, name2.c_str(), value2);
LOG_DEBUG(GwLog::LOG,"Drawing at PageRollPitch, %s:%f, %s:%f", name1.c_str(), value1, name2.c_str(), value2);
// Draw page
//***********************************************************

View File

@ -7,20 +7,14 @@
class PageRudderPosition : public Page
{
private:
String lengthformat;
public:
PageRudderPosition(CommonData &common) : Page(common)
{
logger->logDebug(GwLog::LOG, "Instantiate PageRudderPosition");
// Get config data
String lengthformat = config->getString(config->lengthFormat);
logger->logDebug(GwLog::LOG, "Show PageRudderPosition");
}
// Key functions
int handleKey(int key) {
int handleKey(int key){
// Code for keylock
if(key == 11){
commonData->keylock = !commonData->keylock;
@ -29,22 +23,19 @@ public:
return key;
}
void displayNew(PageData &pageData) {
#ifdef BOARD_OBP60S3
// Clear optical warning
if (flashLED == "Limit Violation") {
setBlinkingLED(false);
setFlashLED(false);
}
#endif
};
int displayPage(PageData &pageData) {
static String unit1old = "";
double value1 = 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
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list
String name1 = bvalue1->getName().c_str(); // Value name
@ -55,21 +46,28 @@ public:
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
if (valid1 == true) {
if(valid1 == true){
value1old = value1; // Save old value
unit1old = unit1; // Save old unit
} else {
if (simulation == true) {
value1 = (3 + float(random(0, 50)) / 10.0) / 360 * 2 * M_PI;
if(simulation == true){
value1 = (3 + float(random(0, 50)) / 10.0)/360*2*PI;
unit1 = "Deg";
} else {
}
else{
value1 = 0;
}
}
// Optical warning by limit violation (unused)
if(String(flashLED) == "Limit Violation"){
setBlinkingLED(false);
setFlashLED(false);
}
// Logging boat values
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
logger->logDebug(GwLog::LOG, "Drawing at PageRudderPosition, %s:%f", name1.c_str(), value1);
LOG_DEBUG(GwLog::LOG,"Drawing at PageRudderPosition, %s:%f", name1.c_str(), value1);
// Draw page
//***********************************************************
@ -81,7 +79,7 @@ public:
// Draw RudderPosition
int rInstrument = 110; // Radius of RudderPosition
const float pi = 3.141592;
float pi = 3.141592;
epd->fillCircle(200, 150, rInstrument + 10, commonData->fgcolor); // Outer circle
epd->fillCircle(200, 150, rInstrument + 7, commonData->bgcolor); // Outer circle
@ -93,7 +91,8 @@ public:
float x = 200 + (rInstrument-30)*sin(i/180.0*pi); // x-coordinate dots
float y = 150 - (rInstrument-30)*cos(i/180.0*pi); // y-coordinate cots
const char *ii = " ";
switch (i) {
switch (i)
{
case 0: ii=" "; break; // Use a blank for a empty scale value
case 30 : ii=" "; break;
case 60 : ii=" "; break;
@ -128,7 +127,7 @@ public:
// Draw sub scale with lines (two triangles)
if(i % 30 == 0){
float dx = 2; // Line thickness = 2*dx+1
float dx=2; // Line thickness = 2*dx+1
float xx1 = -dx;
float xx2 = +dx;
float yy1 = -(rInstrument-10);

View File

@ -21,7 +21,7 @@ public:
logger->logDebug(GwLog::LOG, "Instantiate PageSixValues");
}
int handleKey(int key) {
virtual int handleKey(int key){
// Code for keylock
if(key == 11){
commonData->keylock = !commonData->keylock;
@ -30,16 +30,6 @@ public:
return key;
}
void displayNew(PageData &pageData) {
#ifdef BOARD_OBP60S3
// Clear optical warning
if (flashLED == "Limit Violation") {
setBlinkingLED(false);
setFlashLED(false);
}
#endif
};
int displayPage(PageData &pageData) {
// Old values for hold function
@ -73,6 +63,12 @@ public:
DataFormat[i] = bvalue->getFormat(); // Unit of value
}
// Optical warning by limit violation (unused)
if(String(flashLED) == "Limit Violation"){
setBlinkingLED(false);
setFlashLED(false);
}
if (bvalue == NULL) return PAGE_OK; // WTF why this statement?
// Draw page

View File

@ -13,7 +13,7 @@ class PageSkyView : public Page
public:
PageSkyView(CommonData &common) : Page(common)
{
logger->logDebug(GwLog::LOG, "Instantiate PageSkyView");
logger->logDebug(GwLog::LOG,"Instantiate PageSkyView");
}
int handleKey(int key){
@ -25,17 +25,18 @@ public:
return key;
}
void displayNew(PageData &pageData) {
#ifdef BOARD_OBP60S3
// Clear optical warning
if (flashLED == "Limit Violation") {
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)
if(String(flashLED) == "Limit Violation"){
setBlinkingLED(false);
setFlashLED(false);
}
#endif
};
int displayPage(PageData &pageData) {
// Logging boat values
logger->logDebug(GwLog::LOG, "Drawing at PageSkyView");

View File

@ -7,20 +7,10 @@
class PageSolar : public Page
{
private:
String batVoltage;
int solPower;
String powerSensor;
public:
PageSolar(CommonData &common) : Page(common)
{
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);
logger->logDebug(GwLog::LOG,"Instantiate PageSolar");
}
int handleKey(int key){
@ -34,6 +24,15 @@ public:
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 value2 = 0; // Solar current
double value3 = 0; // Solar output power
@ -60,19 +59,24 @@ public:
bool valid1 = true;
// Optical warning by limit violation
if (flashLED == "Limit Violation") {
// Over voltage?
if (batVoltage == "12V") {
setBlinkingLED(value1 > 14.8);
} else if (batVoltage == "24V") {
setBlinkingLED(value1 > 29.6);
} else {
if(String(flashLED) == "Limit Violation"){
// Over voltage
if(value1 > 14.8 && batVoltage == "12V"){
setBlinkingLED(true);
}
if(value1 <= 14.8 && batVoltage == "12V"){
setBlinkingLED(false);
}
if(value1 > 29.6 && batVoltage == "24V"){
setBlinkingLED(true);
}
if(value1 <= 29.6 && batVoltage == "24V"){
setBlinkingLED(false);
}
}
// Logging voltage value
logger->logDebug(GwLog::LOG, "Drawing at PageSolar, Type:%iW %s:=%f", solPower, name1.c_str(), value1);
LOG_DEBUG(GwLog::LOG,"Drawing at PageSolar, Type:%iW %s:=%f", solPower, name1.c_str(), value1);
// Draw page
//***********************************************************

View File

@ -1,6 +1,29 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#if defined BOARD_OBP60S3 || defined BOARD_OBP40S3
#include "Pagedata.h"
#include "OBP60Extensions.h"
#include "ConfigMenu.h"
#include "images/logo64.xbm"
#include <esp32/clk.h>
#include "qrcode.h"
#include "Nmea2kTwai.h"
#ifdef BOARD_OBP40S3
// #include <SD.h>
// #include <FS.h>
#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
* Out of normal page order.
@ -23,26 +46,6 @@
* 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
{
private:
@ -52,6 +55,7 @@ private:
// Generic data access
uint64_t chipid;
bool simulation;
bool use_sdcard;
String buzzer_mode;
uint8_t buzzer_power;
@ -82,7 +86,7 @@ private:
} else if (mode == 'C') { // Config
mode = 'D';
} else if (mode == 'D') { // Device list
if (hasSDCard) {
if (use_sdcard) {
mode = 'A'; // SD-Card
} else {
mode = 'N';
@ -95,7 +99,7 @@ private:
void decMode() {
if (mode == 'N') {
if (hasSDCard) {
if (use_sdcard) {
mode = 'A';
} else {
mode = 'D';
@ -184,10 +188,8 @@ private:
epd->setCursor(90, y0 + 48);
if (hasSDCard) {
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);
if (!use_sdcard) {
epd->print(" (disabled)");
}
} else {
epd->print("off");
}
@ -391,22 +393,9 @@ private:
epd->setFont(&Ubuntu_Bold8pt8b);
epd->setCursor(x0, y0);
epd->print("Work in progress...");
#ifdef BOARD_OBP60S3
// This mode should not be callable by devices without card hardware
// In case of accidential reaching this, display a friendly message
epd->print("This mode is not indended to be reached!\n");
epd->print("There's nothing to see here. Move on.");
#endif
#ifdef BOARD_OBP40S3
/* TODO identify card as OBP-Card:
magic.dat
version.dat
readme.txt
IMAGES/
CHARTS/
LOGS/
DATA/
*/
// TODO directories IMG, MAP, HIST should exist.
// Show state: Files and used size
// Simple test for one file in root
epd->setCursor(x0, y0 + 32);
@ -491,7 +480,6 @@ private:
fclose(fh);
// epd->drawXBitmap(20, 200, buffer, width, height, commonData.fgcolor);
}
#endif
}
void displayModeDevicelist() {
@ -528,6 +516,7 @@ public:
flashLED = config->getString(config->flashLED);
chipid = ESP.getEfuseMac();
simulation = config->getBool(config->useSimuData);
#ifdef BOARD_OBP40S3
use_sdcard = config->getBool(config->useSDCard);
#endif
@ -650,13 +639,6 @@ public:
}
void displayNew(PageData &pageData) {
#ifdef BOARD_OBP60S3
// Clear optical warning
if (flashLED == "Limit Violation") {
setBlinkingLED(false);
setFlashLED(false);
}
#endif
// Get references from API
logger->logDebug(GwLog::LOG, "New page display: PageSystem");
NMEA2000 = pageData.api->getNMEA2000();
@ -664,6 +646,12 @@ public:
int displayPage(PageData &pageData) {
// Optical warning by limit violation (unused)
if(flashLED == "Limit Violation"){
setBlinkingLED(false);
setFlashLED(false);
}
// Logging page information
logger->logDebug(GwLog::LOG, "Drawing at PageSystem, Mode=%c", mode);

View File

@ -7,16 +7,10 @@
class PageThreeValues : public Page
{
private:
String lengthformat;
public:
public:
PageThreeValues(CommonData &common) : Page(common)
{
logger->logDebug(GwLog::LOG, "Instantiate PageThreeValue");
// Get config data
lengthformat = config->getString(config->lengthFormat);
}
int handleKey(int key){
@ -28,16 +22,6 @@ public:
return key;
}
void displayNew(PageData &pageData) {
#ifdef BOARD_OBP60S3
// Clear optical warning
if (flashLED == "Limit Violation") {
setBlinkingLED(false);
setFlashLED(false);
}
#endif
};
int displayPage(PageData &pageData) {
// Old values for hold function
@ -48,6 +32,13 @@ public:
static String svalue3old = "";
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
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue)
String name1 = xdrDelete(bvalue1->getName()); // Value name
@ -78,9 +69,15 @@ public:
String svalue3 = formatValue(bvalue3, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
String unit3 = formatValue(bvalue3, *commonData).unit; // Unit of value
// Optical warning by limit violation (unused)
if(String(flashLED) == "Limit Violation"){
setBlinkingLED(false);
setFlashLED(false);
}
// Logging boat values
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
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);
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);
// Draw page
//***********************************************************

View File

@ -7,16 +7,10 @@
class PageTwoValues : public Page
{
private:
String lengthformat;
public:
public:
PageTwoValues(CommonData &common) : Page(common)
{
logger->logDebug(GwLog::LOG, "Instantiate PageTwoValue");
// Get config data
lengthformat = config->getString(config->lengthFormat);
}
int handleKey(int key){
@ -28,16 +22,6 @@ public:
return key;
}
void displayNew(PageData &pageData) {
#ifdef BOARD_OBP60S3
// Clear optical warning
if (flashLED == "Limit Violation") {
setBlinkingLED(false);
setFlashLED(false);
}
#endif
};
int displayPage(PageData &pageData) {
// Old values for hold function
@ -46,6 +30,12 @@ public:
static String svalue2old = "";
static String unit2old = "";
// Get config data
String lengthformat = config->getString(config->lengthFormat);
// bool simulation = config->getBool(config->useSimuData);
bool holdvalues = config->getBool(config->holdvalues);
String flashLED = config->getString(config->flashLED);
String backlightMode = config->getString(config->backlight);
// Get boat values #1
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue)
@ -67,9 +57,15 @@ public:
String svalue2 = formatValue(bvalue2, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
String unit2 = formatValue(bvalue2, *commonData).unit; // Unit of value
// Optical warning by limit violation (unused)
if(String(flashLED) == "Limit Violation"){
setBlinkingLED(false);
setFlashLED(false);
}
// Logging boat values
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
logger->logDebug(GwLog::LOG, "Drawing at PageTwoValues, %s: %f, %s: %f", name1.c_str(), value1, name2.c_str(), value2);
LOG_DEBUG(GwLog::LOG,"Drawing at PageTwoValues, %s: %f, %s: %f", name1.c_str(), value1, name2.c_str(), value2);
// Draw page
//***********************************************************

View File

@ -8,8 +8,6 @@
class PageVoltage : public Page
{
private:
String batVoltage;
String batType;
bool init = false; // Marker for init done
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
@ -20,11 +18,6 @@ public:
PageVoltage(CommonData &common) : Page(common)
{
logger->logDebug(GwLog::LOG, "Instantiate PageVoltage");
// Get config data
batVoltage = config->getString(config->batteryVoltage);
batType = config->getString(config->batteryType);
if (hasFRAM) {
average = fram.read(FRAM_VOLTAGE_AVG);
trend = fram.read(FRAM_VOLTAGE_TREND);
@ -36,14 +29,14 @@ public:
logger->logDebug(GwLog::LOG, "Destroy PageVoltage");
}
void setupKeys() {
void setupKeys(){
Page::setupKeys();
commonData->keydata[0].label = "AVG";
commonData->keydata[1].label = "MODE";
commonData->keydata[4].label = "TRD";
}
int handleKey(int key) {
int handleKey(int key){
// Change average
if(key == 1){
average ++;
@ -115,6 +108,14 @@ public:
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 valueTrend = 0; // Average over 10 values
@ -154,27 +155,43 @@ public:
bool valid1 = true;
// Optical warning by limit violation
if (flashLED == "Limit Violation") {
bool violation = false;
if (batType == "Pb") {
violation = (raw < 11.8 || raw > 14.8);
} else if (batType == "Gel") {
violation = (raw < 11.8 || raw > 14.4);
} else if (batType == "AGM") {
violation = (raw < 11.8 || raw > 14.7);
} else if (batType == "LiFePo4") {
violation = (raw < 12.0 || raw > 14.6);
}
if (violation) {
if(String(flashLED) == "Limit Violation"){
// Limits for Pb battery
if(String(batType) == "Pb" && (raw < 11.8 || raw > 14.8)){
setBlinkingLED(true);
} else {
}
if(String(batType) == "Pb" && (raw >= 11.8 && raw <= 14.8)){
setBlinkingLED(false);
setFlashLED(false);
}
// Limits for Gel battery
if(String(batType) == "Gel" && (raw < 11.8 || raw > 14.4)){
setBlinkingLED(true);
}
if(String(batType) == "Gel" && (raw >= 11.8 && raw <= 14.4)){
setBlinkingLED(false);
setFlashLED(false);
}
// Limits for AGM battery
if(String(batType) == "AGM" && (raw < 11.8 || raw > 14.7)){
setBlinkingLED(true);
}
if(String(batType) == "AGM" && (raw >= 11.8 && raw <= 14.7)){
setBlinkingLED(false);
setFlashLED(false);
}
// Limits for LiFePo4 battery
if(String(batType) == "LiFePo4" && (raw < 12.0 || raw > 14.6)){
setBlinkingLED(true);
}
if(String(batType) == "LiFePo4" && (raw >= 12.0 && raw <= 14.6)){
setBlinkingLED(false);
setFlashLED(false);
}
}
// Logging voltage value
logger->logDebug(GwLog::LOG, "Drawing at PageVoltage, Type:%s %s:=%f", batType, name1.c_str(), raw);
LOG_DEBUG(GwLog::LOG,"Drawing at PageVoltage, Type:%s %s:=%f", batType, name1.c_str(), raw);
// Draw page
//***********************************************************
@ -191,7 +208,7 @@ public:
epd->setCursor(20, 100);
epd->print(name1); // Value name
#if defined BOARD_OBP40S3 && defined LIPO_ACCU_1200 && defined VOLTAGE_SENSOR
#if defined BOARD_OBP40S3 && defined LIPO_ACCU_1200 && defined VOLTAGE_SENSOR
// Show charge status
epd->setFont(&Ubuntu_Bold8pt8b);
epd->setCursor(185, 100);
@ -201,7 +218,7 @@ public:
else{
epd->print("Discharge");
}
#endif
#endif
// Show unit
epd->setFont(&Ubuntu_Bold20pt8b);
@ -211,12 +228,12 @@ public:
// Show battery type
epd->setFont(&Ubuntu_Bold8pt8b);
epd->setCursor(295, 100);
#ifdef BOARD_OBP60S3
#ifdef BOARD_OBP60S3
epd->print(batType);
#endif
#if defined BOARD_OBP40S3 && defined LIPO_ACCU_1200 && defined VOLTAGE_SENSOR
#endif
#if defined BOARD_OBP40S3 && defined LIPO_ACCU_1200 && defined VOLTAGE_SENSOR
epd->print("LiPo");
#endif
#endif
// Show average settings
printAvg(average, 320, 84, true);

View File

@ -14,8 +14,7 @@
class PageWhite : public Page
{
private:
char mode = 'W'; // display mode (W)hite | (L)ogo | (M)FD logo
char mode = 'W'; // display mode (W)hite | (L)ogo | (M)FD logo
public:
PageWhite(CommonData &common) : Page(common)
@ -24,7 +23,7 @@ public:
refreshtime = 15000;
}
int handleKey(int key) {
virtual int handleKey(int key) {
// Change display mode
if (key == 1) {
if (mode == 'W') {
@ -39,20 +38,19 @@ public:
return key;
}
void displayNew(PageData &pageData) {
#ifdef BOARD_OBP60S3
// Clear optical warning
if (flashLED == "Limit Violation") {
int displayPage(PageData &pageData){
// Get config data
String flashLED = config->getString(config->flashLED);
// Optical warning by limit violation (unused)
if(String(flashLED) == "Limit Violation"){
setBlinkingLED(false);
setFlashLED(false);
}
#endif
};
int displayPage(PageData &pageData) {
// Logging boat values
logger->logDebug(GwLog::LOG, "Drawing at PageWhite");
LOG_DEBUG(GwLog::LOG,"Drawing at PageWhite");
// Draw page
//***********************************************************

View File

@ -215,21 +215,15 @@ static unsigned char front_bits[] PROGMEM = {
class PageWind : public Page
{
private:
String lengthformat;
bool keylock = false; // Keylock
int8_t lp = 80; // Pointer length
char mode = 'N'; // page mode (N)ormal | (L)ens | e(X)ample
char source = 'A'; // data source (A)pparent | (T)rue
bool keylock = false; // Keylock
int8_t lp = 80; // Pointer length
char mode = 'N'; // page mode (N)ormal | (L)ens | e(X)ample
char source = 'A'; // data source (A)pparent | (T)rue
public:
PageWind(CommonData &common) : Page(common)
{
logger->logDebug(GwLog::LOG, "Instantiate PageWind");
// Get config data
lengthformat = config->getString(config->lengthFormat);
if (hasFRAM) {
lp = fram.read(FRAM_WIND_SIZE);
source = fram.read(FRAM_WIND_SRC);
@ -237,7 +231,7 @@ public:
}
}
void setupKeys() {
void setupKeys(){
Page::setupKeys();
commonData->keydata[0].label = "MODE";
if (mode == 'X') {
@ -249,7 +243,7 @@ public:
}
// Key functions
int handleKey(int key) {
int handleKey(int key){
if(key == 1){ // Mode switch
if(mode == 'N'){
@ -303,16 +297,6 @@ public:
return key;
}
void displayNew(PageData &pageData) {
#ifdef BOARD_OBP60S3
// Clear optical warning
if (flashLED == "Limit Violation") {
setBlinkingLED(false);
setFlashLED(false);
}
#endif
};
int displayPage(PageData &pageData) {
static String svalue1old = "";
@ -320,6 +304,13 @@ public:
static String svalue2old = "";
static String unit2old = "";
// Get config data
String lengthformat = config->getString(config->lengthFormat);
bool simulation = config->getBool(config->useSimuData);
bool holdvalues = config->getBool(config->holdvalues);
String flashLED = config->getString(config->flashLED);
String backlightMode = config->getString(config->backlight);
GwApi::BoatValue *bvalue1; // Value 1 for speed on top
GwApi::BoatValue *bvalue2; // Value 2 for angle on bottom
@ -354,9 +345,15 @@ public:
String svalue2 = formatValue(bvalue2, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
String unit2 = formatValue(bvalue2, *commonData).unit; // Unit of value
// Optical warning by limit violation (unused)
if(String(flashLED) == "Limit Violation"){
setBlinkingLED(false);
setFlashLED(false);
}
// Logging boat values
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
logger->logDebug(GwLog::LOG, "Drawing at PageWind, %s:%f, %s:%f", name1.c_str(), value1, name2.c_str(), value2);
LOG_DEBUG(GwLog::LOG,"Drawing at PageWind, %s:%f, %s:%f", name1.c_str(), value1, name2.c_str(), value2);
// Draw page
//***********************************************************

View File

@ -49,7 +49,7 @@ int getRng(const RingBuffer<int16_t>& windDirHstry, int center, size_t amount)
// ****************************************************************
class PageWindPlot : public Page {
private:
bool keylock = false; // Keylock
char chrtMode = 'D'; // Chart mode: 'D' for TWD, 'S' for TWS, 'B' for both
int dataIntv = 1; // Update interval for wind history chart:
@ -62,7 +62,8 @@ public:
logger->logDebug(GwLog::LOG, "Instantiate PageWindPlot");
}
void setupKeys() {
void setupKeys()
{
Page::setupKeys();
// commonData->keydata[0].label = "MODE";
commonData->keydata[1].label = "INTV";
@ -70,7 +71,8 @@ public:
}
// Key functions
int handleKey(int key) {
int handleKey(int key)
{
// Set chart mode TWD | TWS -> to be implemented
if (key == 1) {
if (chrtMode == 'D') {
@ -111,16 +113,6 @@ public:
return key;
}
void displayNew(PageData &pageData) {
#ifdef BOARD_OBP60S3
// Clear optical warning
if (flashLED == "Limit Violation") {
setBlinkingLED(false);
setFlashLED(false);
}
#endif
};
int displayPage(PageData& pageData) {
float twsValue; // TWS value in chart area
@ -142,6 +134,8 @@ public:
static bool isInitialized = false; // Flag to indicate that page is initialized
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 bool simulation = false;
static bool holdValues = false;
static int width; // Screen width
static int height; // Screen height
@ -175,7 +169,13 @@ public:
int chrtVal; // Current wind value
static int chrtPrevVal; // Last wind value in chart area for check if value crosses 180 degree line
logger->logDebug(GwLog::LOG, "Display page WindPlot");
LOG_DEBUG(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) {
width = epd->width();
@ -237,7 +237,7 @@ public:
bufStart = max(0, bufStart - numAddedBufVals);
}
}
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",
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",
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);
@ -250,7 +250,7 @@ public:
} else {
wndCenter = 0;
}
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,
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,
wndCenter, diffRng, chrtRng);
} else {
// check and adjust range between left, center, and right chart limit
@ -330,7 +330,7 @@ public:
// if (i >= (numWndVals / dataIntv) - 10)
if (i >= (numWndVals / dataIntv) - 1)
logger->logDebug(GwLog::DEBUG, "PageWindPlot Chart: i: %d, chrtVal: %d, bufStart: %d, count: %d, linesToShow: %d", i, chrtVal, bufStart, count, (numWndVals / dataIntv));
LOG_DEBUG(GwLog::DEBUG, "PageWindPlot Chart: i: %d, chrtVal: %d, bufStart: %d, count: %d, linesToShow: %d", i, chrtVal, bufStart, count, (numWndVals / dataIntv));
if ((i == 0) || (chrtPrevVal == INT16_MIN)) {
// just a dot for 1st chart point or after some invalid values
@ -363,7 +363,7 @@ public:
int minWndDir = pageData.boatHstry.twdHstry->getMin(numWndVals) / 1000.0 * radToDeg;
int maxWndDir = pageData.boatHstry.twdHstry->getMax(numWndVals) / 1000.0 * radToDeg;
logger->logDebug(GwLog::DEBUG, "PageWindPlot FreeTop: Minimum: %d, Maximum: %d, OldwndCenter: %d", minWndDir, maxWndDir, wndCenter);
LOG_DEBUG(GwLog::DEBUG, "PageWindPlot FreeTop: Minimum: %d, Maximum: %d, OldwndCenter: %d", minWndDir, maxWndDir, wndCenter);
// if ((minWndDir + 540 >= wndCenter + 540) || (maxWndDir + 540 <= wndCenter + 540)) {
if (((minWndDir - wndCenter >= 0) && (minWndDir - wndCenter < 180)) || ((maxWndDir - wndCenter <= 0) && (maxWndDir - wndCenter >=180))) {
// Check if all wind value are left or right of center value -> optimize chart range
@ -372,14 +372,14 @@ public:
wndCenter = int((midWndDir + (midWndDir >= 0 ? 5 : -5)) / 10) * 10; // Set new center value; round to nearest 10 degree value
}
}
logger->logDebug(GwLog::DEBUG, "PageWindPlot FreeTop: cHeight: %d, bufStart: %d, numWndVals: %d, wndCenter: %d", cHeight, bufStart, numWndVals, wndCenter);
LOG_DEBUG(GwLog::DEBUG, "PageWindPlot FreeTop: cHeight: %d, bufStart: %d, numWndVals: %d, wndCenter: %d", cHeight, bufStart, numWndVals, wndCenter);
break;
}
}
} else {
// No valid data available
logger->logDebug(GwLog::LOG, "PageWindPlot: No valid data available");
LOG_DEBUG(GwLog::LOG, "PageWindPlot: No valid data available");
epd->setFont(&Ubuntu_Bold10pt8b);
epd->fillRect(xCenter - 33, height / 2 - 20, 66, 24, commonData->bgcolor); // Clear area for message
drawTextCenter(xCenter, height / 2 - 10, "No data");

View File

@ -7,21 +7,16 @@
class PageWindRose : public Page
{
private:
String lengthformat;
int16_t lp = 80; // Pointer length
int16_t lp = 80; // Pointer length
public:
PageWindRose(CommonData &common) : Page(common)
PageWindRose(CommonData &common)
{
logger->logDebug(GwLog::LOG, "Instantiate PageWindRose");
// Get config data
String lengthformat = config->getString(config->lengthFormat);
}
// Key functions
int handleKey(int key) {
int handleKey(int key){
// Code for keylock
if(key == 11){
commonData->keylock = !commonData->keylock;
@ -30,16 +25,6 @@ public:
return key;
}
void displayNew(PageData &pageData) {
#ifdef BOARD_OBP60S3
// Clear optical warning
if (flashLED == "Limit Violation") {
setBlinkingLED(false);
setFlashLED(false);
}
#endif
};
int displayPage(PageData &pageData) {
static String svalue1old = "";
@ -55,6 +40,13 @@ public:
static String svalue6old = "";
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
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue)
String name1 = xdrDelete(bvalue1->getName()); // Value name
@ -140,9 +132,15 @@ public:
unit6old = unit6; // Save old unit
}
// Optical warning by limit violation (unused)
if(String(flashLED) == "Limit Violation"){
setBlinkingLED(false);
setFlashLED(false);
}
// Logging boat values
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
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);
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);
// Draw page
//***********************************************************
@ -162,7 +160,12 @@ public:
epd->setFont(&Ubuntu_Bold8pt8b);
epd->setCursor(10, 115);
epd->print(" ");
epd->print(holdvalues ? unit1old : unit1);
if(holdvalues == false){
epd->print(unit1); // Unit
}
else{
epd->print(unit1old); // Unit
}
// Horizintal separator left
epd->fillRect(0, 149, 60, 3, commonData->fgcolor);
@ -177,7 +180,12 @@ public:
epd->setFont(&Ubuntu_Bold8pt8b);
epd->setCursor(10, 190);
epd->print(" ");
epd->print(holdvalues ? unit2old : unit2);
if(holdvalues == false){
epd->print(unit2); // Unit
}
else{
epd->print(unit2old); // Unit
}
// Show values TWD
epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
@ -194,7 +202,12 @@ public:
epd->setFont(&Ubuntu_Bold8pt8b);
epd->setCursor(335, 115);
epd->print(" ");
epd->print(holdvalues ? unit3old : unit3);
if(holdvalues == false){
epd->print(unit3); // Unit
}
else{
epd->print(unit3old); // Unit
}
// Horizintal separator right
epd->fillRect(340, 149, 80, 3, commonData->fgcolor);
@ -209,7 +222,12 @@ public:
epd->setFont(&Ubuntu_Bold8pt8b);
epd->setCursor(335, 190);
epd->print(" ");
epd->print(holdvalues ? unit4old : unit4);
if(holdvalues == false){
epd->print(unit4); // Unit
}
else{
epd->print(unit4old); // Unit
}
//*******************************************************************************************
@ -228,7 +246,8 @@ public:
float x = 200 + (rInstrument-30)*sin(i/180.0*pi); // x-coordinate dots
float y = 150 - (rInstrument-30)*cos(i/180.0*pi); // y-coordinate cots
const char *ii = "";
switch (i) {
switch (i)
{
case 0: ii="0"; break;
case 30 : ii="30"; break;
case 60 : ii="60"; break;
@ -249,7 +268,7 @@ public:
uint16_t w, h; // Return values of getTextBounds
epd->getTextBounds(ii, int(x), int(y), &x1, &y1, &w, &h); // Calc width of new string
epd->setCursor(x-w/2, y+h/2);
if (i % 30 == 0) {
if(i % 30 == 0){
epd->setFont(&Ubuntu_Bold8pt8b);
epd->print(ii);
}
@ -316,7 +335,12 @@ public:
epd->setFont(&Ubuntu_Bold8pt8b);
epd->setCursor(190, 215);
epd->print(" ");
epd->print(holdvalues ? unit5old : unit5);
if(holdvalues == false){
epd->print(unit5); // Unit
}
else{
epd->print(unit5old); // Unit
}
// Show values STW
epd->setFont(&DSEG7Classic_BoldItalic16pt7b);
@ -325,7 +349,12 @@ public:
epd->setFont(&Ubuntu_Bold8pt8b);
epd->setCursor(190, 90);
epd->print(" ");
epd->print(holdvalues ? unit6old : unit6);
if(holdvalues == false){
epd->print(unit6); // Unit
}
else{
epd->print(unit6old); // Unit
}
return PAGE_UPDATE;
};

View File

@ -7,21 +7,16 @@
class PageWindRoseFlex : public Page
{
private:
String lengthformat;
int16_t lp = 80; // Pointer length
int16_t lp = 80; // Pointer length
public:
PageWindRoseFlex(CommonData &common) : Page(common)
{
logger->logDebug(GwLog::LOG, "Instantiate PageWindRoseFlex");
// Get config data
lengthformat = config->getString(config->lengthFormat);
}
// Key functions
int handleKey(int key) {
int handleKey(int key){
// Code for keylock
if(key == 11){
commonData->keylock = !commonData->keylock;
@ -30,17 +25,7 @@ public:
return key;
}
void displayNew(PageData &pageData) {
#ifdef BOARD_OBP60S3
// Clear optical warning
if (flashLED == "Limit Violation") {
setBlinkingLED(false);
setFlashLED(false);
}
#endif
};
int displayPage(PageData &pageData) {
int displayPage(PageData &pageData){
static String svalue1old = "";
static String unit1old = "";
@ -55,6 +40,13 @@ public:
static String svalue6old = "";
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
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue)
String name1 = xdrDelete(bvalue1->getName()); // Value name
@ -140,9 +132,15 @@ public:
unit6old = unit6; // Save old unit
}
// Optical warning by limit violation (unused)
if(String(flashLED) == "Limit Violation"){
setBlinkingLED(false);
setFlashLED(false);
}
// Logging boat values
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
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);
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);
// Draw page
//***********************************************************
@ -162,7 +160,12 @@ public:
epd->setFont(&Ubuntu_Bold8pt8b);
epd->setCursor(10, 115);
epd->print(" ");
epd->print(holdvalues ? unit2old : unit2);
if(holdvalues == false){
epd->print(unit2); // Unit
}
else{
epd->print(unit2old); // Unit
}
// Horizintal separator left
epd->fillRect(0, 149, 60, 3, commonData->fgcolor);
@ -177,8 +180,12 @@ public:
epd->setFont(&Ubuntu_Bold8pt8b);
epd->setCursor(10, 190);
epd->print(" ");
epd->print(holdvalues ? unit3old : unit3);
if(holdvalues == false){
epd->print(unit3); // Unit
}
else{
epd->print(unit3old); // Unit
}
// Show value 4 at top right
epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
@ -196,8 +203,12 @@ public:
epd->setFont(&Ubuntu_Bold8pt8b);
epd->setCursor(335, 115);
epd->print(" ");
epd->print(holdvalues ? unit4old : unit4);
if(holdvalues == false){
epd->print(unit4); // Unit
}
else{
epd->print(unit4old); // Unit
}
// Horizintal separator right
epd->fillRect(340, 149, 80, 3, commonData->fgcolor);
@ -212,7 +223,13 @@ public:
epd->setFont(&Ubuntu_Bold8pt8b);
epd->setCursor(335, 190);
epd->print(" ");
epd->print(holdvalues ? unit5old : unit5);
if(holdvalues == false){
epd->print(unit5); // Unit
}
else{
epd->print(unit5old); // Unit
}
//*******************************************************************************************
@ -325,7 +342,12 @@ public:
epd->setCursor(190, 90);
}
epd->print(" ");
epd->print(holdvalues ? unit6old : unit6);
if(holdvalues == false){
epd->print(unit6); // Unit
}
else{
epd->print(unit6old); // Unit
}
return PAGE_UPDATE;
};

View File

@ -29,18 +29,15 @@ static unsigned char ship_bits[] PROGMEM = {
class PageXTETrack : public Page
{
private:
String trackStep;
double seg_step;
bool simulation = false;
bool holdvalues = false;
public:
public:
PageXTETrack(CommonData &common) : Page(common)
{
logger->logDebug(GwLog::LOG, "Instantiate PageXTETrack");
// Get config data
String trackStep = config->getString(config->trackStep);
seg_step = trackStep.toDouble() * M_PI / 180;
simulation = config->getBool(config->useSimuData);
holdvalues = config->getBool(config->holdvalues);
}
void drawSegment(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1,
@ -60,7 +57,7 @@ public:
}
}
int handleKey(int key) {
virtual int handleKey(int key){
// Code for keylock
if(key == 11){
commonData->keylock = !commonData->keylock;
@ -69,20 +66,25 @@ public:
return key;
}
void displayNew(PageData &pageData) {
#ifdef BOARD_OBP60S3
// Clear optical warning
if (flashLED == "Limit Violation") {
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)
if(String(flashLED) == "Limit Violation"){
setBlinkingLED(false);
setFlashLED(false);
}
#endif
};
int displayPage(PageData &pageData) {
// Logging boat values
logger->logDebug(GwLog::LOG, "Drawing at PageXTETrack");
LOG_DEBUG(GwLog::LOG,"Drawing at PageXTETrack");
// Draw page
//***********************************************************

View File

@ -129,25 +129,16 @@ protected:
CommonData *commonData;
GwConfigHandler *config;
GwLog *logger;
bool simulation = false;
bool holdvalues = false;
String flashLED;
String backlightMode;
public:
Page(){}
Page(CommonData &common) {
commonData = &common;
config = commonData->config;
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;
virtual int displayPage(PageData &pageData)=0;
virtual void displayNew(PageData &pageData){}
virtual void leavePage(PageData &pageData){}
virtual void setupKeys() {
#ifdef HARDWARE_V21
commonData->keydata[0].label = "";

View File

@ -4,12 +4,6 @@ Development information
This file contains some hints concerning building the firmware as well as
developing and debugging it.
Coding style
------------
WIP
Please format your new code the same as already existing code.
Preprocessor directives go to column zero.
Git commands
------------

View File

@ -2,6 +2,8 @@
- page refresh after page change and not connected to key codes
- fix sd card code
- config: getFloat, getDouble
- dseg7 font to new version

View File

@ -66,13 +66,13 @@ void OBP60Init(GwApi *api){
// Settings for e-paper display
String fastrefresh = api->getConfig()->getConfigItem(api->getConfig()->fastRefresh,true)->asString();
logger->logDebug(GwLog::DEBUG,"Fast Refresh Mode is: %s", fastrefresh.c_str());
#ifdef DISPLAY_GDEY042T81
#ifdef DISPLAY_GDEY042T81
if(fastrefresh == "true"){
static const bool useFastFullUpdate = true; // Enable fast full display update only for GDEY042T81
}
#endif
#endif
#ifdef BOARD_OBP60S3
#ifdef BOARD_OBP60S3
touchSleepWakeUpEnable(TP1, 45); // TODO sensitivity should be configurable via web interface
touchSleepWakeUpEnable(TP2, 45);
touchSleepWakeUpEnable(TP3, 45);
@ -80,7 +80,7 @@ void OBP60Init(GwApi *api){
touchSleepWakeUpEnable(TP5, 45);
touchSleepWakeUpEnable(TP6, 45);
esp_sleep_enable_touchpad_wakeup();
#endif
#endif
// Get CPU speed
int freq = getCpuFrequencyMhz();
@ -282,16 +282,16 @@ void underVoltageDetection(GwApi *api, CommonData &common){
double voffset = (api->getConfig()->getConfigItem(api->getConfig()->vOffset,true)->asString()).toFloat();
double vslope = (api->getConfig()->getConfigItem(api->getConfig()->vSlope,true)->asString()).toFloat();
// Read supply voltage
#if defined VOLTAGE_SENSOR && defined LIPO_ACCU_1200
#if defined VOLTAGE_SENSOR && defined LIPO_ACCU_1200
float actVoltage = (float(analogRead(OBP_ANALOG0)) * 3.3 / 4096 + 0.53) * 2; // Vin = 1/2 for OBP40
float minVoltage = 3.65; // Absolut minimum volatge for 3,7V LiPo accu
#else
#else
float actVoltage = (float(analogRead(OBP_ANALOG0)) * 3.3 / 4096 + 0.17) * 20; // Vin = 1/20 for OBP60
float minVoltage = MIN_VOLTAGE;
#endif
#endif
double calVoltage = actVoltage * vslope + voffset; // Calibration
if(calVoltage < minVoltage){
#if defined VOLTAGE_SENSOR && defined LIPO_ACCU_1200
#if defined VOLTAGE_SENSOR && defined LIPO_ACCU_1200
// Switch off all power lines
setPortPin(OBP_BACKLIGHT_LED, false); // Backlight Off
setFlashLED(false); // Flash LED Off
@ -311,7 +311,7 @@ void underVoltageDetection(GwApi *api, CommonData &common){
epd->powerOff(); // Display power off
setPortPin(OBP_POWER_EPD, false); // Power off ePaper display
setPortPin(OBP_POWER_SD, false); // Power off SD card
#else
#else
// Switch off all power lines
setPortPin(OBP_BACKLIGHT_LED, false); // Backlight Off
setFlashLED(false); // Flash LED Off
@ -329,7 +329,7 @@ void underVoltageDetection(GwApi *api, CommonData &common){
epd->print("To wake up repower system");
epd->nextPage(); // Partial update
epd->powerOff(); // Display power off
#endif
#endif
// Stop system
while(true){
esp_deep_sleep_start(); // Deep Sleep without weakup. Weakup only after power cycle (restart).
@ -500,15 +500,15 @@ void OBP60Task(GwApi *api){
bool symbolmode = (config->getString(config->headerFormat) == "ICON");
String fastrefresh = api->getConfig()->getConfigItem(api->getConfig()->fastRefresh,true)->asString();
uint fullrefreshtime = uint(api->getConfig()->getConfigItem(api->getConfig()->fullRefreshTime,true)->asInt());
#ifdef BOARD_OBP40S3
#ifdef BOARD_OBP40S3
bool syspage_enabled = config->getBool(config->systemPage);
#endif
#endif
#ifdef DISPLAY_GDEY042T81
#ifdef DISPLAY_GDEY042T81
epd->init(115200, true, 2, false); // Init for Waveshare boards with "clever" reset circuit, 2ms reset pulse
#else
#else
epd->init(115200); // Init for normal displays
#endif
#endif
epd->setRotation(0); // Set display orientation (horizontal)
epd->setFullWindow(); // Set full Refresh
@ -643,9 +643,9 @@ void OBP60Task(GwApi *api){
allParameters.page0=3;
allParameters.queue=xQueueCreate(10,sizeof(int));
allParameters.sensitivity= api->getConfig()->getInt(GwConfigDefinitions::tSensitivity);
#ifdef BOARD_OBP40S3
#ifdef BOARD_OBP40S3
allParameters.use_syspage = syspage_enabled;
#endif
#endif
xTaskCreate(keyboardTask,"keyboard",2000,&allParameters,configMAX_PRIORITIES-1,NULL);
SharedData *shared=new SharedData(api);
createSensorTask(shared);
@ -785,12 +785,12 @@ void OBP60Task(GwApi *api){
toggleBacklightLED(commonData.backlight.brightness, commonData.backlight.color);
}
}
#ifdef BOARD_OBP40S3
#ifdef BOARD_OBP40S3
// #3 Deep sleep mode for OBP40
if ((keyboardMessage == 3) and !syspage_enabled){
deepSleep(commonData);
}
#endif
#endif
// #9 Swipe right or #4 key right
if ((keyboardMessage == 9) or (keyboardMessage == 4))
{
@ -854,11 +854,11 @@ void OBP60Task(GwApi *api){
}
else{
epd->fillScreen(commonData.fgcolor); // Clear display
#ifdef DISPLAY_GDEY042T81
#ifdef DISPLAY_GDEY042T81
epd->init(115200, true, 2, false); // Init for Waveshare boards with "clever" reset circuit, 2ms reset pulse
#else
#else
epd->init(115200); // Init for normal displays
#endif
#endif
epd->firstPage(); // Full update
epd->nextPage(); // Full update
// epd->setPartialWindow(0, 0, epd->width(), epd->height()); // Set partial update
@ -881,11 +881,11 @@ void OBP60Task(GwApi *api){
}
else{
epd->fillScreen(commonData.fgcolor); // Clear display
#ifdef DISPLAY_GDEY042T81
#ifdef DISPLAY_GDEY042T81
epd->init(115200, true, 2, false); // Init for Waveshare boards with "clever" reset circuit, 2ms reset pulse
#else
#else
epd->init(115200); // Init for normal displays
#endif
#endif
epd->firstPage(); // Full update
epd->nextPage(); // Full update
// epd->setPartialWindow(0, 0, epd->width(), epd->height()); // Set partial update
@ -905,11 +905,11 @@ void OBP60Task(GwApi *api){
}
else{
epd->fillScreen(commonData.fgcolor); // Clear display
#ifdef DISPLAY_GDEY042T81
#ifdef DISPLAY_GDEY042T81
epd->init(115200, true, 2, false); // Init for Waveshare boards with "clever" reset circuit, 2ms reset pulse
#else
#else
epd->init(115200); // Init for normal displays
#endif
#endif
epd->firstPage(); // Full update
epd->nextPage(); // Full update
// epd->setPartialWindow(0, 0, epd->width(), epd->height()); // Set partial update
@ -973,13 +973,12 @@ void OBP60Task(GwApi *api){
epd->print("Here be dragons!");
epd->nextPage(); // Partial update (fast)
}
else {
else{
if (lastPage != pageNumber){
pages[lastPage].page->leavePage(pages[lastPage].parameters); // call page cleanup code
if (hasFRAM) fram.write(FRAM_PAGE_NO, pageNumber); // remember new page for device restart
if (hasFRAM) fram.write(FRAM_PAGE_NO, pageNumber); // remember page for device restart
currentPage->setupKeys();
currentPage->displayNew(pages[pageNumber].parameters);
lastPage = pageNumber;
lastPage=pageNumber;
}
//call the page code
LOG_DEBUG(GwLog::DEBUG,"calling page %d",pageNumber);