Merge branch 'PageWindPlot' of https://github.com/Scorgan01/esp32-nmea2000-obp60 into PageWindPlot

This commit is contained in:
Ulrich Meine 2025-07-25 08:43:01 +02:00
commit 938b566bfc
37 changed files with 501 additions and 175 deletions

View File

@ -526,3 +526,17 @@ env.Append(
) )
#script does not run on clean yet - maybe in the future #script does not run on clean yet - maybe in the future
env.AddPostAction("clean",cleangenerated) env.AddPostAction("clean",cleangenerated)
#look for extra task scripts and include them here
for taskdir in userTaskDirs:
script = os.path.join(taskdir, "extra_task.py")
if os.path.isfile(script):
taskname = os.path.basename(os.path.normpath(taskdir))
print("#extra task script for '{}'".format(taskname))
with open(script) as fh:
try:
code = compile(fh.read(), taskname, 'exec')
except SyntaxError:
print("#ERROR: script does not compile")
continue
exec(code)

View File

@ -520,19 +520,23 @@ prebuild(env)
board="PLATFORM_BOARD_%s"%env["BOARD"].replace("-","_").upper() board="PLATFORM_BOARD_%s"%env["BOARD"].replace("-","_").upper()
print("Board=#%s#"%board) print("Board=#%s#"%board)
print("BuildFlags=%s"%(" ".join(env["BUILD_FLAGS"]))) print("BuildFlags=%s"%(" ".join(env["BUILD_FLAGS"])))
epdtype = "unknown"
pcbvers = "unknown"
for x in env["BUILD_FLAGS"]:
if x.startswith("-D HARDWARE_"):
pcbvers = x.split('_')[1]
if x.startswith("-D DISPLAY_"):
epdtype = x.split('_')[1]
env.Append( env.Append(
LINKFLAGS=[ "-u", "custom_app_desc" ], LINKFLAGS=[ "-u", "custom_app_desc" ],
CPPDEFINES=[(board,"1"), ("BOARD", env["BOARD"]), ("EPDTYPE", epdtype), CPPDEFINES=[(board,"1")]
("PCBVERS", pcbvers)]
) )
#script does not run on clean yet - maybe in the future #script does not run on clean yet - maybe in the future
env.AddPostAction("clean",cleangenerated) env.AddPostAction("clean",cleangenerated)
#look for extra task scripts and include them here
for taskdir in userTaskDirs:
script = os.path.join(taskdir, "extra_task.py")
if os.path.isfile(script):
taskname = os.path.basename(os.path.normpath(taskdir))
print("#extra task script for '{}'".format(taskname))
with open(script) as fh:
try:
code = compile(fh.read(), taskname, 'exec')
except SyntaxError:
print("#ERROR: script does not compile")
continue
exec(code)

View File

@ -300,6 +300,49 @@ void fillPoly4(const std::vector<Point>& p4, uint16_t color) {
getdisplay().fillTriangle(p4[0].x, p4[0].y, p4[2].x, p4[2].y, p4[3].x, p4[3].y, color); getdisplay().fillTriangle(p4[0].x, p4[0].y, p4[2].x, p4[2].y, p4[3].x, p4[3].y, color);
} }
// Split string into words, whitespace separated
std::vector<String> split(const String &s) {
std::vector<String> words;
String word = "";
for (size_t i = 0; i < s.length(); i++) {
if (s[i] == ' ' || s[i] == '\t' || s[i] == '\r' || s[i] == '\n') {
if (word.length() > 0) {
words.push_back(word);
word = "";
}
} else {
word += s[i];
}
}
if (word.length() > 0) {
words.push_back(word);
}
return words;
}
// Wordwrap single line, monospaced font
std::vector<String> wordwrap(String &line, uint16_t maxwidth) {
std::vector<String> lines;
std::vector<String> words = split(line);
String currentLine = "";
for (const auto& word : words) {
if (currentLine.length() + word.length() + 1 > maxwidth) {
if (currentLine.length() > 0) {
lines.push_back(currentLine);
currentLine = "";
}
}
if (currentLine.length() > 0) {
currentLine += " ";
}
currentLine += word;
}
if (currentLine.length() > 0) {
lines.push_back(currentLine);
}
return lines;
}
// Draw centered text // Draw centered text
void drawTextCenter(int16_t cx, int16_t cy, String text) { void drawTextCenter(int16_t cx, int16_t cy, String text) {
int16_t x1, y1; int16_t x1, y1;
@ -545,6 +588,47 @@ void displayFooter(CommonData &commonData) {
#endif #endif
} }
// Alarm overlay, to be drawn as very last draw operation
void displayAlarm(CommonData &commonData) {
const uint16_t x = 50; // overlay area
const uint16_t y = 100;
const uint16_t w = 300;
const uint16_t h = 150;
getdisplay().setFont(&Atari16px);
getdisplay().setTextColor(commonData.fgcolor);
// overlay
getdisplay().drawRect(x, y, w, h, commonData.fgcolor);
getdisplay().fillRect(x + 1, y + 1, w - 1, h - 1, commonData.bgcolor);
getdisplay().drawRect(x + 3, y + 3, w - 5, h - 5, commonData.fgcolor);
// exclamation icon in left top corner
getdisplay().drawXBitmap(x + 16, y + 16, exclamation_bits, exclamation_width, exclamation_height, commonData.fgcolor);
// title
getdisplay().setCursor(x + 64, y + 30);
getdisplay().print("A L A R M");
getdisplay().setCursor(x + 64, y + 48);
getdisplay().print("#" + commonData.alarm.id);
getdisplay().print(" from ");
getdisplay().print(commonData.alarm.source);
// message, but maximum 4 lines
std::vector<String> lines = wordwrap (commonData.alarm.message, w - 16 - 8 / 8);
int n = 0;
for (const auto& l : lines) {
getdisplay().setCursor(x + 16, y + 80 + n);
getdisplay().print(l);
n += 16;
if (n > 64) {
break;
}
}
drawTextCenter(x + w / 2, y + h - 16, "Press button 1 to dismiss alarm");
}
// Sunset und sunrise calculation // Sunset und sunrise calculation
SunData calcSunsetSunrise(double time, double date, double latitude, double longitude, float timezone){ SunData calcSunsetSunrise(double time, double date, double latitude, double longitude, float timezone){
SunData returnset; SunData returnset;

View File

@ -57,6 +57,11 @@ GxEPD2_BW<GxEPD2_420_GYE042A87, GxEPD2_420_GYE042A87::HEIGHT> & getdisplay();
GxEPD2_BW<GxEPD2_420_SE0420NQ04, GxEPD2_420_SE0420NQ04::HEIGHT> & getdisplay(); GxEPD2_BW<GxEPD2_420_SE0420NQ04, GxEPD2_420_SE0420NQ04::HEIGHT> & getdisplay();
#endif #endif
// Page display return values
#define PAGE_OK 0 // all ok, do nothing
#define PAGE_UPDATE 1 // page wants display to update
#define PAGE_HIBERNATE 2 // page wants displey to hibernate
struct Point { struct Point {
double x; double x;
double y; double y;
@ -97,6 +102,7 @@ void displayTrendLow(int16_t x, int16_t y, uint16_t size, uint16_t color);
void displayHeader(CommonData &commonData, GwApi::BoatValue *date, GwApi::BoatValue *time, GwApi::BoatValue *hdop); // Draw display header void displayHeader(CommonData &commonData, GwApi::BoatValue *date, GwApi::BoatValue *time, GwApi::BoatValue *hdop); // Draw display header
void displayFooter(CommonData &commonData); void displayFooter(CommonData &commonData);
void displayAlarm(CommonData &commonData);
SunData calcSunsetSunrise(double time, double date, double latitude, double longitude, float timezone); // Calulate sunset and sunrise SunData calcSunsetSunrise(double time, double date, double latitude, double longitude, float timezone); // Calulate sunset and sunrise
SunData calcSunsetSunriseRTC(struct tm *rtctime, double latitude, double longitude, float timezone); SunData calcSunsetSunriseRTC(struct tm *rtctime, double latitude, double longitude, float timezone);
@ -142,12 +148,12 @@ static unsigned char fram_bits[] PROGMEM = {
0xff, 0xff, 0xf8, 0x1f, 0xf8, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x1f, 0xff, 0xff, 0xf8, 0x1f, 0xf8, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x1f,
0xf8, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x1f }; 0xf8, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x1f };
static unsigned char ap_bits[] = { static unsigned char ap_bits[] PROGMEM = {
0xe0, 0x03, 0x18, 0x0c, 0x04, 0x10, 0xc2, 0x21, 0x30, 0x06, 0x08, 0x08, 0xe0, 0x03, 0x18, 0x0c, 0x04, 0x10, 0xc2, 0x21, 0x30, 0x06, 0x08, 0x08,
0xc0, 0x01, 0x20, 0x02, 0x00, 0x00, 0x80, 0x00, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0x20, 0x02, 0x00, 0x00, 0x80, 0x00, 0xc0, 0x01, 0xc0, 0x01,
0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00 }; 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00 };
static unsigned char dish_bits[] PROGMEM= { static unsigned char dish_bits[] PROGMEM = {
0x3c, 0x00, 0x42, 0x18, 0xfa, 0x1b, 0x02, 0x04, 0x02, 0x0a, 0x02, 0x09, 0x3c, 0x00, 0x42, 0x18, 0xfa, 0x1b, 0x02, 0x04, 0x02, 0x0a, 0x02, 0x09,
0x82, 0x08, 0x06, 0x0a, 0x0e, 0x1b, 0x9c, 0x2b, 0x38, 0x2b, 0x74, 0x20, 0x82, 0x08, 0x06, 0x0a, 0x0e, 0x1b, 0x9c, 0x2b, 0x38, 0x2b, 0x74, 0x20,
0xec, 0x1f, 0x1c, 0x00, 0xf4, 0x00, 0xfe, 0x03 }; 0xec, 0x1f, 0x1c, 0x00, 0xf4, 0x00, 0xfe, 0x03 };

View File

@ -37,6 +37,18 @@ String formatTime(char fmttype, uint8_t hour, uint8_t minute, uint8_t second) {
return String(buffer); return String(buffer);
} }
String formatLatitude(double lat) {
float degree = abs(int(lat));
float minute = abs((lat - int(lat)) * 60);
return String(degree, 0) + "\x90 " + String(minute, 4) + "' " + ((lat > 0) ? "N" : "S");
}
String formatLongitude(double lon) {
float degree = abs(int(lon));
float minute = abs((lon - int(lon)) * 60);
return String(degree, 0) + "\x90 " + String(minute, 4) + "' " + ((lon > 0) ? "E" : "W");
}
FormatedData formatValue(GwApi::BoatValue *value, CommonData &commondata){ FormatedData formatValue(GwApi::BoatValue *value, CommonData &commondata){
GwLog *logger = commondata.logger; GwLog *logger = commondata.logger;
FormatedData result; FormatedData result;

View File

@ -498,14 +498,18 @@ void sensorTask(void *param){
// Send supply voltage value all 1s // Send supply voltage value all 1s
if(millis() > starttime5 + 1000 && String(powsensor1) == "off"){ if(millis() > starttime5 + 1000 && String(powsensor1) == "off"){
starttime5 = millis(); starttime5 = millis();
float rawVoltage = 0; float rawVoltage = 0; // Default value
#if defined(BOARD_OBP40S3) && defined(VOLTAGE_SENSOR) #ifdef BOARD_OBP40S3
sensors.batteryVoltage = 0; // If no sensor then zero voltage
#endif
#if defined(BOARD_OBP40S3) && defined(VOLTAGE_SENSOR)
rawVoltage = (float(analogRead(OBP_ANALOG0)) * 3.3 / 4096 + 0.53) * 2; // Vin = 1/2 for OBP40 rawVoltage = (float(analogRead(OBP_ANALOG0)) * 3.3 / 4096 + 0.53) * 2; // Vin = 1/2 for OBP40
sensors.batteryVoltage = rawVoltage * vslope + voffset; // Calibration
#endif #endif
#ifdef BOARD_OBP60S3 #ifdef BOARD_OBP60S3
rawVoltage = (float(analogRead(OBP_ANALOG0)) * 3.3 / 4096 + 0.17) * 20; // Vin = 1/20 for OBP60 rawVoltage = (float(analogRead(OBP_ANALOG0)) * 3.3 / 4096 + 0.17) * 20; // Vin = 1/20 for OBP60
sensors.batteryVoltage = rawVoltage * vslope + voffset; // Calibration
#endif #endif
sensors.batteryVoltage = rawVoltage * vslope + voffset; // Calibration
// Save new data in average array // Save new data in average array
batV.reading(int(sensors.batteryVoltage * 100)); batV.reading(int(sensors.batteryVoltage * 100));
// Calculate the average values for different time lines from integer values // Calculate the average values for different time lines from integer values

View File

@ -20,7 +20,7 @@ class PageBME280 : public Page
return key; return key;
} }
virtual void displayPage(PageData &pageData){ int displayPage(PageData &pageData){
GwConfigHandler *config = commonData->config; GwConfigHandler *config = commonData->config;
GwLog *logger = commonData->logger; GwLog *logger = commonData->logger;
@ -176,9 +176,7 @@ class PageBME280 : public Page
// Show bus data // Show bus data
getdisplay().print(svalue3); // Real value as formated string getdisplay().print(svalue3); // Real value as formated string
// Update display return PAGE_UPDATE;
getdisplay().nextPage(); // Partial update (fast)
}; };
}; };

View File

@ -34,7 +34,7 @@ class PageBattery : public Page
return key; return key;
} }
virtual void displayPage(PageData &pageData){ int displayPage(PageData &pageData){
GwConfigHandler *config = commonData->config; GwConfigHandler *config = commonData->config;
GwLog *logger = commonData->logger; GwLog *logger = commonData->logger;
@ -288,9 +288,7 @@ class PageBattery : public Page
getdisplay().print("---"); // No sensor data (sensor is off) getdisplay().print("---"); // No sensor data (sensor is off)
} }
// Update display return PAGE_UPDATE;
getdisplay().nextPage(); // Partial update (fast)
}; };
}; };

View File

@ -44,7 +44,7 @@ public:
return key; return key;
} }
virtual void displayPage(PageData &pageData) int displayPage(PageData &pageData)
{ {
GwConfigHandler *config = commonData->config; GwConfigHandler *config = commonData->config;
GwLog *logger = commonData->logger; GwLog *logger = commonData->logger;
@ -334,8 +334,7 @@ public:
getdisplay().setFont(&Ubuntu_Bold16pt8b); getdisplay().setFont(&Ubuntu_Bold16pt8b);
getdisplay().print("W"); getdisplay().print("W");
// Update display return PAGE_UPDATE;
getdisplay().nextPage(); // Partial update (fast)
}; };
}; };

View File

@ -85,7 +85,7 @@ bool homevalid = false; // homelat and homelon are valid
return key; return key;
} }
virtual void displayPage(PageData &pageData) int displayPage(PageData &pageData)
{ {
GwConfigHandler *config = commonData->config; GwConfigHandler *config = commonData->config;
GwLog *logger = commonData->logger; GwLog *logger = commonData->logger;
@ -162,7 +162,7 @@ bool homevalid = false; // homelat and homelon are valid
} }
// Logging boat values // Logging boat values
if (bvalue1 == NULL) return; if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
LOG_DEBUG(GwLog::LOG,"Drawing at PageClock, %s:%f, %s:%f", name1.c_str(), value1, name2.c_str(), value2); LOG_DEBUG(GwLog::LOG,"Drawing at PageClock, %s:%f, %s:%f", name1.c_str(), value1, name2.c_str(), value2);
// Draw page // Draw page
@ -438,9 +438,7 @@ bool homevalid = false; // homelat and homelon are valid
getdisplay().fillCircle(200, 150, startwidth + 6, commonData->bgcolor); getdisplay().fillCircle(200, 150, startwidth + 6, commonData->bgcolor);
getdisplay().fillCircle(200, 150, startwidth + 4, commonData->fgcolor); getdisplay().fillCircle(200, 150, startwidth + 4, commonData->fgcolor);
// Update display return PAGE_UPDATE;
getdisplay().nextPage(); // Partial update (fast)
}; };
}; };

View File

@ -61,7 +61,7 @@ class PageCompass : public Page
return key; return key;
} }
virtual void displayPage(PageData &pageData){ int displayPage(PageData &pageData){
GwConfigHandler *config = commonData->config; GwConfigHandler *config = commonData->config;
GwLog *logger = commonData->logger; GwLog *logger = commonData->logger;
@ -104,7 +104,7 @@ class PageCompass : public Page
setFlashLED(false); setFlashLED(false);
} }
if (bvalue == NULL) return; if (bvalue == NULL) return PAGE_OK; // WTF why this statement?
//*********************************************************** //***********************************************************
@ -235,12 +235,11 @@ class PageCompass : public Page
// if ( x_test > 390) // if ( x_test > 390)
// x_test = 320; // x_test = 320;
// Update display return PAGE_UPDATE;
getdisplay().nextPage(); // Partial update (fast)
};
}; };
};
static Page *createPage(CommonData &common){ static Page *createPage(CommonData &common){
return new PageCompass(common); return new PageCompass(common);
}/** }/**

View File

@ -20,7 +20,7 @@ public:
return key; return key;
} }
virtual void displayPage(PageData &pageData){ int displayPage(PageData &pageData){
GwConfigHandler *config = commonData->config; GwConfigHandler *config = commonData->config;
GwLog *logger = commonData->logger; GwLog *logger = commonData->logger;
@ -84,7 +84,7 @@ public:
} }
// Logging boat values // Logging boat values
if (bvalue1 == NULL) return; 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); 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 // Draw page
@ -242,9 +242,7 @@ public:
unit4old = unit4; // Save the old unit unit4old = unit4; // Save the old unit
} }
// Update display return PAGE_UPDATE;
getdisplay().nextPage(); // Partial update (fast)
}; };
}; };

View File

@ -98,7 +98,7 @@ class PageFluid : public Page
commonData->logger->logDebug(GwLog::LOG,"New PageFluid: fluidtype=%d", fluidtype); commonData->logger->logDebug(GwLog::LOG,"New PageFluid: fluidtype=%d", fluidtype);
} }
virtual void displayPage(PageData &pageData){ int displayPage(PageData &pageData){
GwConfigHandler *config = commonData->config; GwConfigHandler *config = commonData->config;
GwLog *logger = commonData->logger; GwLog *logger = commonData->logger;
@ -252,9 +252,7 @@ class PageFluid : public Page
getdisplay().fillCircle(c.x, c.y, 6, commonData->bgcolor); getdisplay().fillCircle(c.x, c.y, 6, commonData->bgcolor);
} }
// Update display return PAGE_UPDATE;
getdisplay().nextPage(); // Partial update (fast)
}; };
}; };

View File

@ -21,7 +21,7 @@ class PageFourValues : public Page
return key; return key;
} }
virtual void displayPage(PageData &pageData){ int displayPage(PageData &pageData){
GwConfigHandler *config = commonData->config; GwConfigHandler *config = commonData->config;
GwLog *logger = commonData->logger; GwLog *logger = commonData->logger;
@ -89,7 +89,7 @@ class PageFourValues : public Page
} }
// Logging boat values // Logging boat values
if (bvalue1 == NULL) return; 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); 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 // Draw page
@ -287,9 +287,7 @@ class PageFourValues : public Page
unit4old = unit4; // Save the old unit unit4old = unit4; // Save the old unit
} }
// Update display return PAGE_UPDATE;
getdisplay().nextPage(); // Partial update (fast)
}; };
}; };

View File

@ -21,7 +21,7 @@ class PageFourValues2 : public Page
return key; return key;
} }
virtual void displayPage(PageData &pageData){ int displayPage(PageData &pageData){
GwConfigHandler *config = commonData->config; GwConfigHandler *config = commonData->config;
GwLog *logger = commonData->logger; GwLog *logger = commonData->logger;
@ -89,7 +89,7 @@ class PageFourValues2 : public Page
} }
// Logging boat values // Logging boat values
if (bvalue1 == NULL) return; 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); 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 // Draw page
@ -287,9 +287,7 @@ class PageFourValues2 : public Page
unit4old = unit4; // Save the old unit unit4old = unit4; // Save the old unit
} }
// Update display return PAGE_UPDATE;
getdisplay().nextPage(); // Partial update (fast)
}; };
}; };

View File

@ -20,7 +20,7 @@ public:
return key; return key;
} }
virtual void displayPage(PageData &pageData) int displayPage(PageData &pageData)
{ {
GwConfigHandler *config = commonData->config; GwConfigHandler *config = commonData->config;
GwLog *logger = commonData->logger; GwLog *logger = commonData->logger;
@ -203,8 +203,7 @@ public:
getdisplay().setFont(&Ubuntu_Bold16pt8b); getdisplay().setFont(&Ubuntu_Bold16pt8b);
getdisplay().print("W"); getdisplay().print("W");
// Update display return PAGE_UPDATE;
getdisplay().nextPage(); // Partial update (fast)
}; };
}; };

View File

@ -21,7 +21,7 @@ public:
return key; return key;
} }
virtual void displayPage(PageData &pageData) int displayPage(PageData &pageData)
{ {
GwConfigHandler *config = commonData->config; GwConfigHandler *config = commonData->config;
GwLog *logger = commonData->logger; GwLog *logger = commonData->logger;
@ -206,9 +206,7 @@ public:
getdisplay().print("No sensor data"); // Info missing sensor getdisplay().print("No sensor data"); // Info missing sensor
} }
// Update display return PAGE_UPDATE;
getdisplay().nextPage(); // Partial update (fast)
}; };
}; };

View File

@ -21,7 +21,7 @@ class PageOneValue : public Page
return key; return key;
} }
virtual void displayPage(PageData &pageData){ int displayPage(PageData &pageData){
GwConfigHandler *config = commonData->config; GwConfigHandler *config = commonData->config;
GwLog *logger = commonData->logger; GwLog *logger = commonData->logger;
@ -53,7 +53,7 @@ class PageOneValue : public Page
} }
// Logging boat values // Logging boat values
if (bvalue1 == NULL) return; if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
LOG_DEBUG(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 // Draw page
@ -104,9 +104,7 @@ class PageOneValue : public Page
unit1old = unit1; // Save the old unit unit1old = unit1; // Save the old unit
} }
// Update display return PAGE_UPDATE;
getdisplay().nextPage(); // Partial update (fast)
}; };
}; };

View File

@ -21,7 +21,7 @@ public:
return key; return key;
} }
virtual void displayPage(PageData &pageData){ int displayPage(PageData &pageData){
GwConfigHandler *config = commonData->config; GwConfigHandler *config = commonData->config;
GwLog *logger = commonData->logger; GwLog *logger = commonData->logger;
@ -109,7 +109,7 @@ public:
} }
// Logging boat values // Logging boat values
if (bvalue1 == NULL) return; 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); LOG_DEBUG(GwLog::LOG,"Drawing at PageRollPitch, %s:%f, %s:%f", name1.c_str(), value1, name2.c_str(), value2);
// Draw page // Draw page
@ -305,9 +305,7 @@ public:
getdisplay().print("No sensor data"); // Info missing sensor getdisplay().print("No sensor data"); // Info missing sensor
} }
// Update display return PAGE_UPDATE;
getdisplay().nextPage(); // Partial update (fast)
}; };
}; };

View File

@ -22,7 +22,7 @@ public:
return key; return key;
} }
virtual void displayPage(PageData &pageData){ int displayPage(PageData &pageData){
GwConfigHandler *config = commonData->config; GwConfigHandler *config = commonData->config;
GwLog *logger = commonData->logger; GwLog *logger = commonData->logger;
@ -67,7 +67,7 @@ public:
} }
// Logging boat values // Logging boat values
if (bvalue1 == NULL) return; if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
LOG_DEBUG(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 // Draw page
@ -207,8 +207,7 @@ public:
getdisplay().fillCircle(200, 150, startwidth + 6, commonData->bgcolor); getdisplay().fillCircle(200, 150, startwidth + 6, commonData->bgcolor);
getdisplay().fillCircle(200, 150, startwidth + 4, commonData->fgcolor); getdisplay().fillCircle(200, 150, startwidth + 4, commonData->fgcolor);
// Update display return PAGE_UPDATE;
getdisplay().nextPage(); // Partial update (fast)
}; };
}; };

View File

@ -29,7 +29,7 @@ class PageSixValues : public Page
return key; return key;
} }
virtual void displayPage(PageData &pageData){ int displayPage(PageData &pageData){
GwConfigHandler *config = commonData->config; GwConfigHandler *config = commonData->config;
GwLog *logger = commonData->logger; GwLog *logger = commonData->logger;
@ -71,7 +71,7 @@ class PageSixValues : public Page
setFlashLED(false); setFlashLED(false);
} }
if (bvalue == NULL) return; if (bvalue == NULL) return PAGE_OK; // WTF why this statement?
// Draw page // Draw page
//*********************************************************** //***********************************************************
@ -149,9 +149,7 @@ class PageSixValues : public Page
getdisplay().fillRect(SixValues_x1+SixValues_DeltaX-8, SixValues_y1+i*SixValues_DeltaY, 3, SixValues_DeltaY, commonData->fgcolor); getdisplay().fillRect(SixValues_x1+SixValues_DeltaX-8, SixValues_y1+i*SixValues_DeltaY, 3, SixValues_DeltaY, commonData->fgcolor);
} }
// Update display return PAGE_UPDATE;
getdisplay().nextPage(); // Partial update (fast)
}; };
}; };

View File

@ -20,7 +20,7 @@ public:
return key; return key;
} }
virtual void displayPage(PageData &pageData){ int displayPage(PageData &pageData){
GwConfigHandler *config = commonData->config; GwConfigHandler *config = commonData->config;
GwLog *logger = commonData->logger; GwLog *logger = commonData->logger;
@ -199,8 +199,7 @@ public:
getdisplay().setFont(&Ubuntu_Bold16pt8b); getdisplay().setFont(&Ubuntu_Bold16pt8b);
getdisplay().print("W"); getdisplay().print("W");
// Update display return PAGE_UPDATE;
getdisplay().nextPage(); // Partial update (fast)
}; };
}; };

View File

@ -17,6 +17,7 @@
#define BOARDINFO STRINGIZE(BOARD) #define BOARDINFO STRINGIZE(BOARD)
#define PCBINFO STRINGIZE(PCBVERS) #define PCBINFO STRINGIZE(PCBVERS)
#define DISPLAYINFO STRINGIZE(EPDTYPE) #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
@ -43,6 +44,8 @@ String batt_sensor;
String solar_sensor; String solar_sensor;
String gen_sensor; String gen_sensor;
String rot_sensor; String rot_sensor;
double homelat;
double homelon;
char mode = 'N'; // (N)ormal, (S)ettings, (D)evice list, (C)ard char mode = 'N'; // (N)ormal, (S)ettings, (D)evice list, (C)ard
@ -69,6 +72,8 @@ public:
solar_sensor = common.config->getString(common.config->usePowSensor2); solar_sensor = common.config->getString(common.config->usePowSensor2);
gen_sensor = common.config->getString(common.config->usePowSensor3); gen_sensor = common.config->getString(common.config->usePowSensor3);
rot_sensor = common.config->getString(common.config->useRotSensor); rot_sensor = common.config->getString(common.config->useRotSensor);
homelat = common.config->getString(common.config->homeLAT).toDouble();
homelon = common.config->getString(common.config->homeLON).toDouble();
} }
virtual void setupKeys(){ virtual void setupKeys(){
@ -159,7 +164,7 @@ public:
} }
} }
virtual void displayPage(PageData &pageData){ int displayPage(PageData &pageData){
GwConfigHandler *config = commonData->config; GwConfigHandler *config = commonData->config;
GwLog *logger = commonData->logger; GwLog *logger = commonData->logger;
@ -203,19 +208,21 @@ public:
getdisplay().setCursor(8, 95); getdisplay().setCursor(8, 95);
getdisplay().print("Firmware version: "); getdisplay().print("Firmware version: ");
getdisplay().setCursor(160, 95); getdisplay().setCursor(150, 95);
getdisplay().print(VERSINFO); getdisplay().print(VERSINFO);
getdisplay().setCursor(8, 113); getdisplay().setCursor(8, 113);
getdisplay().print("Board version: "); getdisplay().print("Board version: ");
getdisplay().setCursor(160, 113); getdisplay().setCursor(150, 113);
getdisplay().print(BOARDINFO); getdisplay().print(BOARDINFO);
getdisplay().print(String(" HW ") + String(PCBINFO)); getdisplay().print(String(" HW ") + String(PCBINFO));
getdisplay().setCursor(8, 131); getdisplay().setCursor(8, 131);
getdisplay().print("Display version: "); getdisplay().print("Display version: ");
getdisplay().setCursor(160, 131); getdisplay().setCursor(150, 131);
getdisplay().print(DISPLAYINFO); getdisplay().print(DISPLAYINFO);
getdisplay().print("; GxEPD2 v");
getdisplay().print(GXEPD2INFO);
getdisplay().setCursor(8, 265); getdisplay().setCursor(8, 265);
#ifdef BOARD_OBP60S3 #ifdef BOARD_OBP60S3
@ -295,34 +302,44 @@ public:
// left column // left column
getdisplay().setCursor(x0, y0); getdisplay().setCursor(x0, y0);
getdisplay().print("Simulation:"); getdisplay().print("Simulation:");
getdisplay().setCursor(140, y0); getdisplay().setCursor(120, y0);
getdisplay().print(simulation ? "on" : "off"); getdisplay().print(simulation ? "on" : "off");
getdisplay().setCursor(x0, y0 + 16); getdisplay().setCursor(x0, y0 + 16);
getdisplay().print("Environment:"); getdisplay().print("Environment:");
getdisplay().setCursor(140, y0 + 16); getdisplay().setCursor(120, y0 + 16);
getdisplay().print(env_module); getdisplay().print(env_module);
getdisplay().setCursor(x0, y0 + 32); getdisplay().setCursor(x0, y0 + 32);
getdisplay().print("Buzzer:"); getdisplay().print("Buzzer:");
getdisplay().setCursor(140, y0 + 32); getdisplay().setCursor(120, y0 + 32);
getdisplay().print(buzzer_mode); getdisplay().print(buzzer_mode);
getdisplay().setCursor(x0, y0 + 64); getdisplay().setCursor(x0, y0 + 64);
getdisplay().print("GPS:"); getdisplay().print("GPS:");
getdisplay().setCursor(140, y0 + 64); getdisplay().setCursor(120, y0 + 64);
getdisplay().print(gps_module); getdisplay().print(gps_module);
getdisplay().setCursor(x0, y0 + 80); getdisplay().setCursor(x0, y0 + 80);
getdisplay().print("RTC:"); getdisplay().print("RTC:");
getdisplay().setCursor(140, y0 + 80); getdisplay().setCursor(120, y0 + 80);
getdisplay().print(rtc_module); getdisplay().print(rtc_module);
getdisplay().setCursor(x0, y0 + 96); getdisplay().setCursor(x0, y0 + 96);
getdisplay().print("Wifi:"); getdisplay().print("Wifi:");
getdisplay().setCursor(140, y0 + 96); getdisplay().setCursor(120, y0 + 96);
getdisplay().print(commonData->status.wifiApOn ? "on" : "off"); getdisplay().print(commonData->status.wifiApOn ? "on" : "off");
// Home location
getdisplay().setCursor(x0, y0 + 128);
getdisplay().print("Home Lat.:");
getdisplay().setCursor(120, y0 + 128);
getdisplay().print(formatLatitude(homelat));
getdisplay().setCursor(x0, y0 + 144);
getdisplay().print("Home Lon.:");
getdisplay().setCursor(120, y0 + 144);
getdisplay().print(formatLongitude(homelon));
// right column // right column
getdisplay().setCursor(202, y0); getdisplay().setCursor(202, y0);
getdisplay().print("Batt. sensor:"); getdisplay().print("Batt. sensor:");
@ -374,7 +391,7 @@ public:
// Update display // Update display
getdisplay().nextPage(); // Partial update (fast) getdisplay().nextPage(); // Partial update (fast)
return PAGE_OK;
}; };
}; };

View File

@ -21,7 +21,7 @@ class PageThreeValues : public Page
return key; return key;
} }
virtual void displayPage(PageData &pageData){ int displayPage(PageData &pageData){
GwConfigHandler *config = commonData->config; GwConfigHandler *config = commonData->config;
GwLog *logger = commonData->logger; GwLog *logger = commonData->logger;
@ -77,7 +77,7 @@ class PageThreeValues : public Page
} }
// Logging boat values // Logging boat values
if (bvalue1 == NULL) return; 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); 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 // Draw page
@ -226,8 +226,7 @@ class PageThreeValues : public Page
unit3old = unit3; // Save the old unit unit3old = unit3; // Save the old unit
} }
// Update display return PAGE_UPDATE;
getdisplay().nextPage(); // Partial update (fast)
}; };
}; };

View File

@ -21,7 +21,7 @@ class PageTwoValues : public Page
return key; return key;
} }
virtual void displayPage(PageData &pageData){ int displayPage(PageData &pageData){
GwConfigHandler *config = commonData->config; GwConfigHandler *config = commonData->config;
GwLog *logger = commonData->logger; GwLog *logger = commonData->logger;
@ -65,7 +65,7 @@ class PageTwoValues : public Page
} }
// Logging boat values // Logging boat values
if (bvalue1 == NULL) return; 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); LOG_DEBUG(GwLog::LOG,"Drawing at PageTwoValues, %s: %f, %s: %f", name1.c_str(), value1, name2.c_str(), value2);
// Draw page // Draw page
@ -166,8 +166,7 @@ class PageTwoValues : public Page
unit2old = unit2; // Save the old unit unit2old = unit2; // Save the old unit
} }
// Update display return PAGE_UPDATE;
getdisplay().nextPage(); // Partial update (fast)
}; };
}; };

View File

@ -100,7 +100,7 @@ public:
getdisplay().fillRect(x + 16, y + 11, 6, 3, color); getdisplay().fillRect(x + 16, y + 11, 6, 3, color);
} }
virtual void displayPage(PageData &pageData){ int displayPage(PageData &pageData){
GwConfigHandler *config = commonData->config; GwConfigHandler *config = commonData->config;
GwLog *logger = commonData->logger; GwLog *logger = commonData->logger;
@ -187,7 +187,6 @@ public:
} }
// Logging voltage value // Logging voltage value
if (raw == 0) return;
LOG_DEBUG(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 // Draw page
@ -384,8 +383,7 @@ public:
} }
// Update display return PAGE_UPDATE;
getdisplay().nextPage(); // Partial update (fast)
}; };
}; };

View File

@ -31,7 +31,7 @@ public:
return key; return key;
} }
virtual void displayPage(PageData &pageData){ int displayPage(PageData &pageData){
GwConfigHandler *config = commonData->config; GwConfigHandler *config = commonData->config;
GwLog *logger = commonData->logger; GwLog *logger = commonData->logger;
@ -67,10 +67,13 @@ public:
} }
// Update display // Update display
getdisplay().nextPage(); // getdisplay().nextPage();
int ret = PAGE_UPDATE;
if (mode == 'W') { if (mode == 'W') {
getdisplay().hibernate(); //getdisplay().hibernate();
ret |= PAGE_HIBERNATE;
} }
return ret;
}; };
}; };

View File

@ -296,7 +296,7 @@ public:
return key; return key;
} }
virtual void displayPage(PageData &pageData) int displayPage(PageData &pageData)
{ {
GwConfigHandler *config = commonData->config; GwConfigHandler *config = commonData->config;
GwLog *logger = commonData->logger; GwLog *logger = commonData->logger;
@ -354,7 +354,7 @@ public:
} }
// Logging boat values // Logging boat values
if (bvalue1 == NULL) return; 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); LOG_DEBUG(GwLog::LOG,"Drawing at PageWind, %s:%f, %s:%f", name1.c_str(), value1, name2.c_str(), value2);
// Draw page // Draw page
@ -618,9 +618,7 @@ public:
} }
// Update display return PAGE_UPDATE;
getdisplay().nextPage(); // Partial update (fast)
}; };
}; };

View File

@ -24,7 +24,7 @@ public:
return key; return key;
} }
virtual void displayPage(PageData &pageData){ int displayPage(PageData &pageData){
GwConfigHandler *config = commonData->config; GwConfigHandler *config = commonData->config;
GwLog *logger = commonData->logger; GwLog *logger = commonData->logger;
@ -140,7 +140,7 @@ public:
} }
// Logging boat values // Logging boat values
if (bvalue1 == NULL) return; 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); 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 // Draw page
@ -357,8 +357,7 @@ public:
getdisplay().print(unit6old); // Unit getdisplay().print(unit6old); // Unit
} }
// Update display return PAGE_UPDATE;
getdisplay().nextPage(); // Partial update (fast)
}; };
}; };

View File

@ -24,7 +24,7 @@ public:
return key; return key;
} }
virtual void displayPage(PageData &pageData){ int displayPage(PageData &pageData){
GwConfigHandler *config = commonData->config; GwConfigHandler *config = commonData->config;
GwLog *logger = commonData->logger; GwLog *logger = commonData->logger;
@ -140,7 +140,7 @@ public:
} }
// Logging boat values // Logging boat values
if (bvalue1 == NULL) return; 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); 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 // Draw page
@ -362,8 +362,7 @@ if ( cos(value1) > 0){
} }
// Update display return PAGE_UPDATE;
getdisplay().nextPage(); // Partial update (fast)
}; };
}; };

View File

@ -65,7 +65,7 @@ class PageXTETrack : public Page
return key; return key;
} }
virtual void displayPage(PageData &pageData){ int displayPage(PageData &pageData){
GwConfigHandler *config = commonData->config; GwConfigHandler *config = commonData->config;
GwLog *logger = commonData->logger; GwLog *logger = commonData->logger;
@ -207,9 +207,7 @@ class PageXTETrack : public Page
drawSegment(399, 100, 318, 24, 289, 24, 350, 100, commonData->fgcolor, seg[4]); drawSegment(399, 100, 318, 24, 289, 24, 350, 100, commonData->fgcolor, seg[4]);
drawSegment(399, 54, 354, 24, 325, 24, 399, 90, commonData->fgcolor, seg[5]); drawSegment(399, 54, 354, 24, 325, 24, 399, 90, commonData->fgcolor, seg[5]);
// Update display return PAGE_UPDATE;
getdisplay().nextPage(); // Partial update (fast)
}; };
}; };

View File

@ -82,6 +82,22 @@ typedef struct{
bool on; // fast on/off detector bool on; // fast on/off detector
} BacklightData; } BacklightData;
enum AlarmSource {
Alarm_Generic,
Alarm_Local,
Alarm_NMEA0183,
Alarm_NMEA2000
};
typedef struct{
uint8_t id; // alarm-id e.g. 01..99 from NMEA0183
AlarmSource source;
String message; // single line of plain text
bool active = false;
uint8_t signal; // how to signal MESSAGE | LED | BUZZER
uint8_t length_sec; // seconds until alarm disappeares without user interaction
} AlarmData;
typedef struct{ typedef struct{
GwApi::Status status; GwApi::Status status;
GwLog *logger=NULL; GwLog *logger=NULL;
@ -90,6 +106,7 @@ typedef struct{
SunData sundata; SunData sundata;
TouchKeyData keydata[6]; TouchKeyData keydata[6];
BacklightData backlight; BacklightData backlight;
AlarmData alarm;
GwApi::BoatValue *time=NULL; GwApi::BoatValue *time=NULL;
GwApi::BoatValue *date=NULL; GwApi::BoatValue *date=NULL;
uint16_t fgcolor; uint16_t fgcolor;
@ -104,7 +121,7 @@ class Page{
CommonData *commonData; CommonData *commonData;
public: public:
int refreshtime = 1000; int refreshtime = 1000;
virtual void displayPage(PageData &pageData)=0; virtual int displayPage(PageData &pageData)=0;
virtual void displayNew(PageData &pageData){} virtual void displayNew(PageData &pageData){}
virtual void setupKeys() { virtual void setupKeys() {
#ifdef HARDWARE_V21 #ifdef HARDWARE_V21
@ -172,6 +189,8 @@ class PageStruct{
// Standard format functions without overhead // Standard format functions without overhead
String formatDate(String fmttype, uint16_t year, uint8_t month, uint8_t day); String formatDate(String fmttype, uint16_t year, uint8_t month, uint8_t day);
String formatTime(char fmttype, uint8_t hour, uint8_t minute, uint8_t second); String formatTime(char fmttype, uint8_t hour, uint8_t minute, uint8_t second);
String formatLatitude(double lat);
String formatLongitude(double lon);
// Structure for formatted boat values // Structure for formatted boat values
typedef struct{ typedef struct{

View File

@ -737,7 +737,7 @@
"condition": [ "condition": [
{ "calInstance1": "AWA" }, { "calInstance1": "AWA" },
{ "calInstance1": "AWS" }, { "calInstance1": "AWS" },
{ "calInstance2": "COG" }, { "calInstance1": "COG" },
{ "calInstance1": "DBT" }, { "calInstance1": "DBT" },
{ "calInstance1": "HDM" }, { "calInstance1": "HDM" },
{ "calInstance1": "PRPOS" }, { "calInstance1": "PRPOS" },
@ -762,7 +762,7 @@
"condition": [ "condition": [
{ "calInstance1": "AWA" }, { "calInstance1": "AWA" },
{ "calInstance1": "AWS" }, { "calInstance1": "AWS" },
{ "calInstance2": "COG" }, { "calInstance1": "COG" },
{ "calInstance1": "DBT" }, { "calInstance1": "DBT" },
{ "calInstance1": "HDM" }, { "calInstance1": "HDM" },
{ "calInstance1": "PRPOS" }, { "calInstance1": "PRPOS" },
@ -790,7 +790,7 @@
"condition": [ "condition": [
{ "calInstance1": "AWA" }, { "calInstance1": "AWA" },
{ "calInstance1": "AWS" }, { "calInstance1": "AWS" },
{ "calInstance2": "COG" }, { "calInstance1": "COG" },
{ "calInstance1": "DBT" }, { "calInstance1": "DBT" },
{ "calInstance1": "HDM" }, { "calInstance1": "HDM" },
{ "calInstance1": "PRPOS" }, { "calInstance1": "PRPOS" },
@ -1296,8 +1296,6 @@
"obp60":"true" "obp60":"true"
} }
}, },
{ {
"name": "page1type", "name": "page1type",
"label": "Type", "label": "Type",

View File

@ -718,10 +718,12 @@
"---", "---",
"AWA", "AWA",
"AWS", "AWS",
"COG",
"DBT", "DBT",
"HDM", "HDM",
"PRPOS", "PRPOS",
"RPOS", "RPOS",
"SOG",
"STW", "STW",
"TWA", "TWA",
"TWS", "TWS",
@ -741,8 +743,22 @@
"description": "Offset for data instance 1", "description": "Offset for data instance 1",
"category": "OBP40 Calibrations", "category": "OBP40 Calibrations",
"capabilities": { "capabilities": {
"obp40": "true" "obp40":"true"
} },
"condition": [
{ "calInstance1": "AWA" },
{ "calInstance1": "AWS" },
{ "calInstance1": "COG" },
{ "calInstance1": "DBT" },
{ "calInstance1": "HDM" },
{ "calInstance1": "PRPOS" },
{ "calInstance1": "RPOS" },
{ "calInstance1": "SOG" },
{ "calInstance1": "STW" },
{ "calInstance1": "TWA" },
{ "calInstance1": "TWS" },
{ "calInstance1": "TWD" },
{ "calInstance1": "WTemp" } ]
}, },
{ {
"name": "calSlope1", "name": "calSlope1",
@ -752,8 +768,22 @@
"description": "Slope for data instance 1", "description": "Slope for data instance 1",
"category": "OBP40 Calibrations", "category": "OBP40 Calibrations",
"capabilities": { "capabilities": {
"obp40": "true" "obp40":"true"
} },
"condition": [
{ "calInstance1": "AWA" },
{ "calInstance1": "AWS" },
{ "calInstance1": "COG" },
{ "calInstance1": "DBT" },
{ "calInstance1": "HDM" },
{ "calInstance1": "PRPOS" },
{ "calInstance1": "RPOS" },
{ "calInstance1": "SOG" },
{ "calInstance1": "STW" },
{ "calInstance1": "TWA" },
{ "calInstance1": "TWS" },
{ "calInstance1": "TWD" },
{ "calInstance1": "WTemp" } ]
}, },
{ {
"name": "calSmooth1", "name": "calSmooth1",
@ -763,11 +793,25 @@
"check": "checkMinMax", "check": "checkMinMax",
"min": 0, "min": 0,
"max": 10, "max": 10,
"description": "Smoothing factor for data instance 1", "description": "Smoothing factor [0..10]; 0 = no smoothing",
"category": "OBP40 Calibrations", "category": "OBP40 Calibrations",
"capabilities": { "capabilities": {
"obp40": "true" "obp40":"true"
} },
"condition": [
{ "calInstance1": "AWA" },
{ "calInstance1": "AWS" },
{ "calInstance1": "COG" },
{ "calInstance1": "DBT" },
{ "calInstance1": "HDM" },
{ "calInstance1": "PRPOS" },
{ "calInstance1": "RPOS" },
{ "calInstance1": "SOG" },
{ "calInstance1": "STW" },
{ "calInstance1": "TWA" },
{ "calInstance1": "TWS" },
{ "calInstance1": "TWD" },
{ "calInstance1": "WTemp" } ]
}, },
{ {
"name": "calInstance2", "name": "calInstance2",
@ -779,10 +823,12 @@
"---", "---",
"AWA", "AWA",
"AWS", "AWS",
"COG",
"DBT", "DBT",
"HDM", "HDM",
"PRPOS", "PRPOS",
"RPOS", "RPOS",
"SOG",
"STW", "STW",
"TWA", "TWA",
"TWS", "TWS",
@ -802,8 +848,22 @@
"description": "Offset for data instance 2", "description": "Offset for data instance 2",
"category": "OBP40 Calibrations", "category": "OBP40 Calibrations",
"capabilities": { "capabilities": {
"obp40": "true" "obp40":"true"
} },
"condition": [
{ "calInstance2": "AWA" },
{ "calInstance2": "AWS" },
{ "calInstance2": "COG" },
{ "calInstance2": "DBT" },
{ "calInstance2": "HDM" },
{ "calInstance2": "PRPOS" },
{ "calInstance2": "RPOS" },
{ "calInstance2": "SOG" },
{ "calInstance2": "STW" },
{ "calInstance2": "TWA" },
{ "calInstance2": "TWS" },
{ "calInstance2": "TWD" },
{ "calInstance2": "WTemp" } ]
}, },
{ {
"name": "calSlope2", "name": "calSlope2",
@ -813,8 +873,22 @@
"description": "Slope for data instance 2", "description": "Slope for data instance 2",
"category": "OBP40 Calibrations", "category": "OBP40 Calibrations",
"capabilities": { "capabilities": {
"obp40": "true" "obp40":"true"
} },
"condition": [
{ "calInstance2": "AWA" },
{ "calInstance2": "AWS" },
{ "calInstance2": "COG" },
{ "calInstance2": "DBT" },
{ "calInstance2": "HDM" },
{ "calInstance2": "PRPOS" },
{ "calInstance2": "RPOS" },
{ "calInstance2": "SOG" },
{ "calInstance2": "STW" },
{ "calInstance2": "TWA" },
{ "calInstance2": "TWS" },
{ "calInstance2": "TWD" },
{ "calInstance2": "WTemp" } ]
}, },
{ {
"name": "calSmooth2", "name": "calSmooth2",
@ -824,11 +898,25 @@
"check": "checkMinMax", "check": "checkMinMax",
"min": 0, "min": 0,
"max": 10, "max": 10,
"description": "Smoothing factor for data instance 2", "description": "Smoothing factor [0..10]; 0 = no smoothing",
"category": "OBP40 Calibrations", "category": "OBP40 Calibrations",
"capabilities": { "capabilities": {
"obp40": "true" "obp40":"true"
} },
"condition": [
{ "calInstance2": "AWA" },
{ "calInstance2": "AWS" },
{ "calInstance2": "COG" },
{ "calInstance2": "DBT" },
{ "calInstance2": "HDM" },
{ "calInstance2": "PRPOS" },
{ "calInstance2": "RPOS" },
{ "calInstance2": "SOG" },
{ "calInstance2": "STW" },
{ "calInstance2": "TWA" },
{ "calInstance2": "TWS" },
{ "calInstance2": "TWD" },
{ "calInstance2": "WTemp" } ]
}, },
{ {
"name": "calInstance3", "name": "calInstance3",
@ -840,10 +928,12 @@
"---", "---",
"AWA", "AWA",
"AWS", "AWS",
"COG",
"DBT", "DBT",
"HDM", "HDM",
"PRPOS", "PRPOS",
"RPOS", "RPOS",
"SOG",
"STW", "STW",
"TWA", "TWA",
"TWS", "TWS",
@ -863,8 +953,22 @@
"description": "Offset for data instance 3", "description": "Offset for data instance 3",
"category": "OBP40 Calibrations", "category": "OBP40 Calibrations",
"capabilities": { "capabilities": {
"obp40": "true" "obp40":"true"
} },
"condition": [
{ "calInstance3": "AWA" },
{ "calInstance3": "AWS" },
{ "calInstance3": "COG" },
{ "calInstance3": "DBT" },
{ "calInstance3": "HDM" },
{ "calInstance3": "PRPOS" },
{ "calInstance3": "RPOS" },
{ "calInstance3": "SOG" },
{ "calInstance3": "STW" },
{ "calInstance3": "TWA" },
{ "calInstance3": "TWS" },
{ "calInstance3": "TWD" },
{ "calInstance3": "WTemp" } ]
}, },
{ {
"name": "calSlope3", "name": "calSlope3",
@ -874,8 +978,22 @@
"description": "Slope for data instance 3", "description": "Slope for data instance 3",
"category": "OBP40 Calibrations", "category": "OBP40 Calibrations",
"capabilities": { "capabilities": {
"obp40": "true" "obp40":"true"
} },
"condition": [
{ "calInstance3": "AWA" },
{ "calInstance3": "AWS" },
{ "calInstance3": "COG" },
{ "calInstance3": "DBT" },
{ "calInstance3": "HDM" },
{ "calInstance3": "PRPOS" },
{ "calInstance3": "RPOS" },
{ "calInstance3": "SOG" },
{ "calInstance3": "STW" },
{ "calInstance3": "TWA" },
{ "calInstance3": "TWS" },
{ "calInstance3": "TWD" },
{ "calInstance3": "WTemp" } ]
}, },
{ {
"name": "calSmooth3", "name": "calSmooth3",
@ -885,11 +1003,25 @@
"check": "checkMinMax", "check": "checkMinMax",
"min": 0, "min": 0,
"max": 10, "max": 10,
"description": "Smoothing factor for data instance 3", "description": "Smoothing factor [0..10]; 0 = no smoothing",
"category": "OBP40 Calibrations", "category": "OBP40 Calibrations",
"capabilities": { "capabilities": {
"obp40": "true" "obp40":"true"
} },
"condition": [
{ "calInstance3": "AWA" },
{ "calInstance3": "AWS" },
{ "calInstance3": "COG" },
{ "calInstance3": "DBT" },
{ "calInstance3": "HDM" },
{ "calInstance3": "PRPOS" },
{ "calInstance3": "RPOS" },
{ "calInstance3": "SOG" },
{ "calInstance3": "STW" },
{ "calInstance3": "TWA" },
{ "calInstance3": "TWS" },
{ "calInstance3": "TWD" },
{ "calInstance3": "WTemp" } ]
}, },
{ {
"name": "display", "name": "display",
@ -3863,3 +3995,4 @@
] ]
} }
] ]

View File

@ -0,0 +1,30 @@
# PlatformIO extra script for obp60task
epdtype = "unknown"
pcbvers = "unknown"
for x in env["BUILD_FLAGS"]:
if x.startswith("-D HARDWARE_"):
pcbvers = x.split('_')[1]
if x.startswith("-D DISPLAY_"):
epdtype = x.split('_')[1]
propfilename = os.path.join(env["PROJECT_LIBDEPS_DIR"], env["PIOENV"], "GxEPD2/library.properties")
properties = {}
with open(propfilename, 'r') as file:
for line in file:
match = re.match(r'^([^=]+)=(.*)$', line)
if match:
key = match.group(1).strip()
value = match.group(2).strip()
properties[key] = value
gxepd2vers = "unknown"
try:
if properties["name"] == "GxEPD2":
gxepd2vers = properties["version"]
except:
pass
env["CPPDEFINES"].extend([("BOARD", env["BOARD"]), ("EPDTYPE", epdtype), ("PCBVERS", pcbvers), ("GXEPD2VERS", gxepd2vers)])
print("added hardware info to CPPDEFINES")

View File

@ -531,7 +531,7 @@ void OBP60Task(GwApi *api){
#endif #endif
#ifdef DISPLAY_GDEY042T81 #ifdef DISPLAY_GDEY042T81
getdisplay().init(115200, true, 2, false); // Use this for Waveshare boards with "clever" reset circuit, 2ms reset pulse getdisplay().init(115200, true, 2, false); // Init for Waveshare boards with "clever" reset circuit, 2ms reset pulse
#else #else
getdisplay().init(115200); // Init for normal displays getdisplay().init(115200); // Init for normal displays
#endif #endif
@ -837,7 +837,7 @@ void OBP60Task(GwApi *api){
} }
// #9 or #10 Refresh display after a new page after 4s waiting time and if refresh is disabled // #9 or #10 Refresh display after a new page after 4s waiting time and if refresh is disabled
if(refreshmode == true && (keyboardMessage == 9 || keyboardMessage == 10)){ if(refreshmode == true && (keyboardMessage == 9 || keyboardMessage == 10 || keyboardMessage == 4 || keyboardMessage == 3)){
starttime4 = millis(); starttime4 = millis();
starttime2 = millis(); // Reset the timer for full display update starttime2 = millis(); // Reset the timer for full display update
delayedDisplayUpdate = true; delayedDisplayUpdate = true;
@ -873,12 +873,22 @@ void OBP60Task(GwApi *api){
starttime1 = millis(); starttime1 = millis();
starttime2 = millis(); starttime2 = millis();
getdisplay().setFullWindow(); // Set full update getdisplay().setFullWindow(); // Set full update
getdisplay().nextPage(); if(fastrefresh == "true"){
if(fastrefresh == "false"){ getdisplay().nextPage(); // Full update
}
else{
getdisplay().fillScreen(commonData.fgcolor); // Clear display getdisplay().fillScreen(commonData.fgcolor); // Clear display
#ifdef DISPLAY_GDEY042T81
getdisplay().init(115200, true, 2, false); // Init for Waveshare boards with "clever" reset circuit, 2ms reset pulse
#else
getdisplay().init(115200); // Init for normal displays
#endif
getdisplay().firstPage(); // Full update
getdisplay().nextPage(); // Full update getdisplay().nextPage(); // Full update
getdisplay().fillScreen(commonData.bgcolor); // Clear display // getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
getdisplay().nextPage(); // Full update // getdisplay().fillScreen(commonData.bgcolor); // Clear display
// getdisplay().nextPage(); // Partial update
// getdisplay().nextPage(); // Partial update
} }
delayedDisplayUpdate = false; delayedDisplayUpdate = false;
} }
@ -890,12 +900,22 @@ void OBP60Task(GwApi *api){
starttime2 = millis(); starttime2 = millis();
LOG_DEBUG(GwLog::DEBUG,"E-Ink full refresh first 5 min"); LOG_DEBUG(GwLog::DEBUG,"E-Ink full refresh first 5 min");
getdisplay().setFullWindow(); // Set full update getdisplay().setFullWindow(); // Set full update
getdisplay().nextPage(); if(fastrefresh == "true"){
if(fastrefresh == "false"){ getdisplay().nextPage(); // Full update
}
else{
getdisplay().fillScreen(commonData.fgcolor); // Clear display getdisplay().fillScreen(commonData.fgcolor); // Clear display
#ifdef DISPLAY_GDEY042T81
getdisplay().init(115200, true, 2, false); // Init for Waveshare boards with "clever" reset circuit, 2ms reset pulse
#else
getdisplay().init(115200); // Init for normal displays
#endif
getdisplay().firstPage(); // Full update
getdisplay().nextPage(); // Full update getdisplay().nextPage(); // Full update
getdisplay().fillScreen(commonData.bgcolor); // Clear display // getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
getdisplay().nextPage(); // Full update // getdisplay().fillScreen(commonData.bgcolor); // Clear display
// getdisplay().nextPage(); // Partial update
// getdisplay().nextPage(); // Partial update
} }
} }
@ -904,12 +924,22 @@ void OBP60Task(GwApi *api){
starttime2 = millis(); starttime2 = millis();
LOG_DEBUG(GwLog::DEBUG,"E-Ink full refresh"); LOG_DEBUG(GwLog::DEBUG,"E-Ink full refresh");
getdisplay().setFullWindow(); // Set full update getdisplay().setFullWindow(); // Set full update
getdisplay().nextPage(); if(fastrefresh == "true"){
if(fastrefresh == "false"){ getdisplay().nextPage(); // Full update
}
else{
getdisplay().fillScreen(commonData.fgcolor); // Clear display getdisplay().fillScreen(commonData.fgcolor); // Clear display
#ifdef DISPLAY_GDEY042T81
getdisplay().init(115200, true, 2, false); // Init for Waveshare boards with "clever" reset circuit, 2ms reset pulse
#else
getdisplay().init(115200); // Init for normal displays
#endif
getdisplay().firstPage(); // Full update
getdisplay().nextPage(); // Full update getdisplay().nextPage(); // Full update
getdisplay().fillScreen(commonData.bgcolor); // Clear display // getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
getdisplay().nextPage(); // Full update // getdisplay().fillScreen(commonData.bgcolor); // Clear display
// getdisplay().nextPage(); // Partial update
// getdisplay().nextPage(); // Partial update
} }
} }
@ -975,7 +1005,16 @@ void OBP60Task(GwApi *api){
if (pages[pageNumber].description && pages[pageNumber].description->header){ if (pages[pageNumber].description && pages[pageNumber].description->header){
displayFooter(commonData); displayFooter(commonData);
} }
currentPage->displayPage(pages[pageNumber].parameters); int ret = currentPage->displayPage(pages[pageNumber].parameters);
if (commonData.alarm.active) {
displayAlarm(commonData);
}
if (ret & PAGE_UPDATE) {
getdisplay().nextPage(); // Partial update (fast)
}
if (ret & PAGE_HIBERNATE) {
getdisplay().hibernate();
}
} }
} }

View File

@ -40,7 +40,7 @@ lib_deps =
paulstoffregen/OneWire@2.3.8 paulstoffregen/OneWire@2.3.8
milesburton/DallasTemperature@3.11.0 milesburton/DallasTemperature@3.11.0
signetica/SunRise@2.0.2 signetica/SunRise@2.0.2
adafruit/Adafruit FRAM I2C@^2.0.3 adafruit/Adafruit FRAM I2C@2.0.3
build_flags= build_flags=
#https://thingpulse.com/usb-settings-for-logging-with-the-esp32-s3-in-platformio/?srsltid=AfmBOopGskbkr4GoeVkNlFaZXe_zXkLceKF6Rn-tmoXABCeAR2vWsdHL #https://thingpulse.com/usb-settings-for-logging-with-the-esp32-s3-in-platformio/?srsltid=AfmBOopGskbkr4GoeVkNlFaZXe_zXkLceKF6Rn-tmoXABCeAR2vWsdHL
# -D CORE_DEBUG_LEVEL=1 #Debug level for CPU core via CDC (seral device) # -D CORE_DEBUG_LEVEL=1 #Debug level for CPU core via CDC (seral device)
@ -91,7 +91,7 @@ lib_deps =
paulstoffregen/OneWire@2.3.8 paulstoffregen/OneWire@2.3.8
milesburton/DallasTemperature@3.11.0 milesburton/DallasTemperature@3.11.0
signetica/SunRise@2.0.2 signetica/SunRise@2.0.2
adafruit/Adafruit FRAM I2C@^2.0.3 adafruit/Adafruit FRAM I2C@2.0.3
build_flags= build_flags=
-D DISABLE_DIAGNOSTIC_OUTPUT #Disable diagnostic output for GxEPD2 lib -D DISABLE_DIAGNOSTIC_OUTPUT #Disable diagnostic output for GxEPD2 lib
-D BOARD_OBP40S3 #Board OBP40 with ESP32S3 -D BOARD_OBP40S3 #Board OBP40 with ESP32S3