First Alpha Version V0.80

This commit is contained in:
norbert-walter 2024-03-24 14:10:26 +01:00
parent f00064ece8
commit 726b1abf2d
23 changed files with 54 additions and 59 deletions

View File

@ -77,7 +77,7 @@ void hardwareInit()
setPortPin(OBP_POWER_50, true); setPortPin(OBP_POWER_50, true);
// Init E-Ink display // Init E-Ink display
//display.init(115200, true, 2, false); // Use this for Waveshare boards with "clever" reset circuit, 2ms reset pulse //getdisplay().init(115200, true, 2, false); // Use this for Waveshare boards with "clever" reset circuit, 2ms reset pulse
// Init RGB LEDs // Init RGB LEDs
@ -225,12 +225,12 @@ String xdrDelete(String input){
// Show a triangle for trend direction high (x, y is the left edge) // Show a triangle for trend direction high (x, y is the left edge)
void displayTrendHigh(int16_t x, int16_t y, uint16_t size, uint16_t color){ void displayTrendHigh(int16_t x, int16_t y, uint16_t size, uint16_t color){
display.fillTriangle(x, y, x+size*2, y, x+size, y-size*2, color); getdisplay().fillTriangle(x, y, x+size*2, y, x+size, y-size*2, color);
} }
// Show a triangle for trend direction low (x, y is the left edge) // Show a triangle for trend direction low (x, y is the left edge)
void displayTrendLow(int16_t x, int16_t y, uint16_t size, uint16_t color){ void displayTrendLow(int16_t x, int16_t y, uint16_t size, uint16_t color){
display.fillTriangle(x, y, x+size*2, y, x+size, y+size*2, color); getdisplay().fillTriangle(x, y, x+size*2, y, x+size, y+size*2, color);
} }
// Show header informations // Show header informations
@ -259,27 +259,27 @@ void displayHeader(CommonData &commonData, GwApi::BoatValue *date, GwApi::BoatVa
} }
// Show status info // Show status info
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
display.setCursor(0, 15); getdisplay().setCursor(0, 15);
if(commonData.status.wifiApOn){ if(commonData.status.wifiApOn){
display.print(" AP "); getdisplay().print(" AP ");
} }
// If receive new telegram data then display bus name // If receive new telegram data then display bus name
if(commonData.status.tcpClRx != tcpClRxOld || commonData.status.tcpClTx != tcpClTxOld || commonData.status.tcpSerRx != tcpSerRxOld || commonData.status.tcpSerTx != tcpSerTxOld){ if(commonData.status.tcpClRx != tcpClRxOld || commonData.status.tcpClTx != tcpClTxOld || commonData.status.tcpSerRx != tcpSerRxOld || commonData.status.tcpSerTx != tcpSerTxOld){
display.print("TCP "); getdisplay().print("TCP ");
} }
if(commonData.status.n2kRx != n2kRxOld || commonData.status.n2kTx != n2kTxOld){ if(commonData.status.n2kRx != n2kRxOld || commonData.status.n2kTx != n2kTxOld){
display.print("N2K "); getdisplay().print("N2K ");
} }
if(commonData.status.serRx != serRxOld || commonData.status.serTx != serTxOld){ if(commonData.status.serRx != serRxOld || commonData.status.serTx != serTxOld){
display.print("183 "); getdisplay().print("183 ");
} }
if(commonData.status.usbRx != usbRxOld || commonData.status.usbTx != usbTxOld){ if(commonData.status.usbRx != usbRxOld || commonData.status.usbTx != usbTxOld){
display.print("USB "); getdisplay().print("USB ");
} }
if(commonData.config->getBool(commonData.config->useGPS) == true && date->valid == true){ if(commonData.config->getBool(commonData.config->useGPS) == true && date->valid == true){
display.print("GPS"); getdisplay().print("GPS");
} }
// Save old telegram counter // Save old telegram counter
tcpClRxOld = commonData.status.tcpClRx; tcpClRxOld = commonData.status.tcpClRx;
@ -294,38 +294,38 @@ void displayHeader(CommonData &commonData, GwApi::BoatValue *date, GwApi::BoatVa
usbTxOld = commonData.status.usbTx; usbTxOld = commonData.status.usbTx;
// Heartbeat as dot // Heartbeat as dot
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold32pt7b); getdisplay().setFont(&Ubuntu_Bold32pt7b);
display.setCursor(205, 14); getdisplay().setCursor(205, 14);
if(heartbeat == true){ if(heartbeat == true){
display.print("."); getdisplay().print(".");
} }
else{ else{
display.print(" "); getdisplay().print(" ");
} }
heartbeat = !heartbeat; heartbeat = !heartbeat;
// Date and time // Date and time
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
display.setCursor(230, 15); getdisplay().setCursor(230, 15);
if(date->valid == true){ if(date->valid == true){
String acttime = formatValue(time, commonData).svalue; String acttime = formatValue(time, commonData).svalue;
acttime = acttime.substring(0, 5); acttime = acttime.substring(0, 5);
String actdate = formatValue(date, commonData).svalue; String actdate = formatValue(date, commonData).svalue;
display.print(acttime); getdisplay().print(acttime);
display.print(" "); getdisplay().print(" ");
display.print(actdate); getdisplay().print(actdate);
display.print(" "); getdisplay().print(" ");
if(commonData.config->getInt(commonData.config->timeZone) == 0){ if(commonData.config->getInt(commonData.config->timeZone) == 0){
display.print("UTC"); getdisplay().print("UTC");
} }
else{ else{
display.print("LOT"); getdisplay().print("LOT");
} }
} }
else{ else{
display.print("No GPS data"); getdisplay().print("No GPS data");
} }
} }
} }
@ -385,20 +385,20 @@ void batteryGraphic(uint x, uint y, float percent, int pcolor, int bcolor){
} }
// Battery corpus 100x80 with fill level // Battery corpus 100x80 with fill level
int level = int((100.0 - percent) * (80-(2*t)) / 100.0); int level = int((100.0 - percent) * (80-(2*t)) / 100.0);
display.fillRect(xb, yb, 100, 80, pcolor); getdisplay().fillRect(xb, yb, 100, 80, pcolor);
if(percent < 99){ if(percent < 99){
display.fillRect(xb+t, yb+t, 100-(2*t), level, bcolor); getdisplay().fillRect(xb+t, yb+t, 100-(2*t), level, bcolor);
} }
// Plus pol 20x15 // Plus pol 20x15
int xp = xb + 20; int xp = xb + 20;
int yp = yb - 15 + t; int yp = yb - 15 + t;
display.fillRect(xp, yp, 20, 15, pcolor); getdisplay().fillRect(xp, yp, 20, 15, pcolor);
display.fillRect(xp+t, yp+t, 20-(2*t), 15-(2*t), bcolor); getdisplay().fillRect(xp+t, yp+t, 20-(2*t), 15-(2*t), bcolor);
// Minus pol 20x15 // Minus pol 20x15
int xm = xb + 60; int xm = xb + 60;
int ym = yb -15 + t; int ym = yb -15 + t;
display.fillRect(xm, ym, 20, 15, pcolor); getdisplay().fillRect(xm, ym, 20, 15, pcolor);
display.fillRect(xm+t, ym+t, 20-(2*t), 15-(2*t), bcolor); getdisplay().fillRect(xm+t, ym+t, 20-(2*t), 15-(2*t), bcolor);
} }
#endif #endif

View File

@ -106,7 +106,6 @@ public:
} }
// Set display in partial refresh mode // Set display in partial refresh mode
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
getdisplay().fillScreen(bgcolor); // Clear display
// Show values AWS // Show values AWS
getdisplay().setTextColor(textcolor); getdisplay().setTextColor(textcolor);

View File

@ -121,7 +121,6 @@ class PageBME280 : public Page
} }
// Set display in partial refresh mode // Set display in partial refresh mode
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
getdisplay().fillScreen(bgcolor); // Clear display
// ############### Value 1 ################ // ############### Value 1 ################

View File

@ -169,7 +169,6 @@ class PageBattery : public Page
} }
// Set display in partial refresh mode // Set display in partial refresh mode
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
getdisplay().fillScreen(bgcolor); // Clear display
// Show average settings // Show average settings
getdisplay().setTextColor(textcolor); getdisplay().setTextColor(textcolor);

View File

@ -195,7 +195,6 @@ public:
} }
// Set display in partial refresh mode // Set display in partial refresh mode
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
getdisplay().fillScreen(bgcolor); // Clear display
// Show name // Show name
getdisplay().setTextColor(textcolor); getdisplay().setTextColor(textcolor);

View File

@ -107,7 +107,6 @@ public:
} }
// Set display in partial refresh mode // Set display in partial refresh mode
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
getdisplay().fillScreen(bgcolor); // Clear display
// Show values GPS date // Show values GPS date
getdisplay().setTextColor(textcolor); getdisplay().setTextColor(textcolor);

View File

@ -107,7 +107,6 @@ class PageDST810 : public Page
} }
// Set display in partial refresh mode // Set display in partial refresh mode
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
getdisplay().fillScreen(bgcolor); // Clear display
// ############### Value 1 ################ // ############### Value 1 ################

View File

@ -107,7 +107,6 @@ class PageFourValues : public Page
} }
// Set display in partial refresh mode // Set display in partial refresh mode
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
getdisplay().fillScreen(bgcolor); // Clear display
// ############### Value 1 ################ // ############### Value 1 ################

View File

@ -107,7 +107,6 @@ class PageFourValues2 : public Page
} }
// Set display in partial refresh mode // Set display in partial refresh mode
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
getdisplay().fillScreen(bgcolor); // Clear display
// ############### Value 1 ################ // ############### Value 1 ################

View File

@ -83,7 +83,6 @@ public:
} }
/// Set display in partial refresh mode /// Set display in partial refresh mode
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
getdisplay().fillScreen(bgcolor); // Clear display
// Show name // Show name
getdisplay().setTextColor(textcolor); getdisplay().setTextColor(textcolor);

View File

@ -85,8 +85,6 @@ public:
} }
// Set display in partial refresh mode // Set display in partial refresh mode
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
getdisplay().fillScreen(bgcolor); // Clear display
//******************************************************************************************* //*******************************************************************************************

View File

@ -73,7 +73,6 @@ class PageOneValue : public Page{
} }
/// Set display in partial refresh mode /// Set display in partial refresh mode
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
getdisplay().fillScreen(bgcolor); // Clear display
// Show name // Show name
getdisplay().setTextColor(textcolor); getdisplay().setTextColor(textcolor);

View File

@ -145,7 +145,6 @@ public:
} }
// Set display in partial refresh mode // Set display in partial refresh mode
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
getdisplay().fillScreen(bgcolor); // Clear display
// Horizintal separator left // Horizintal separator left
getdisplay().fillRect(0, 149, 60, 3, pixelcolor); getdisplay().fillRect(0, 149, 60, 3, pixelcolor);

View File

@ -81,8 +81,6 @@ public:
} }
// Set display in partial refresh mode // Set display in partial refresh mode
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
getdisplay().fillScreen(bgcolor); // Clear display
//******************************************************************************************* //*******************************************************************************************

View File

@ -83,7 +83,6 @@ public:
} }
// Set display in partial refresh mode // Set display in partial refresh mode
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
getdisplay().fillScreen(bgcolor); // Clear display
// Show name // Show name
getdisplay().setTextColor(textcolor); getdisplay().setTextColor(textcolor);

View File

@ -96,7 +96,6 @@ class PageThreeValues : public Page
} }
/// Set display in partial refresh mode /// Set display in partial refresh mode
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
getdisplay().fillScreen(bgcolor); // Clear display
// ############### Value 1 ################ // ############### Value 1 ################

View File

@ -85,7 +85,6 @@ class PageTwoValues : public Page
} }
// Set display in partial refresh mode // Set display in partial refresh mode
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
getdisplay().fillScreen(bgcolor); // Clear display
// ############### Value 1 ################ // ############### Value 1 ################

View File

@ -149,7 +149,6 @@ public:
} }
// Set display in partial refresh mode // Set display in partial refresh mode
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
getdisplay().fillScreen(bgcolor); // Clear display
// Show name // Show name
getdisplay().setTextColor(textcolor); getdisplay().setTextColor(textcolor);

View File

@ -35,7 +35,6 @@ class PageWhite : public Page{
// Set display in partial refresh mode // Set display in partial refresh mode
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
getdisplay().fillScreen(bgcolor); // Clear display
// Update display // Update display
getdisplay().nextPage(); // Partial update (fast) getdisplay().nextPage(); // Partial update (fast)

View File

@ -156,7 +156,6 @@ public:
} }
// Set display in partial refresh mode // Set display in partial refresh mode
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
getdisplay().fillScreen(bgcolor); // Clear display
// Show values AWA // Show values AWA
getdisplay().setTextColor(textcolor); getdisplay().setTextColor(textcolor);

View File

@ -1,4 +1,13 @@
[ [
{
"name": "deviceName",
"label": "system name",
"type": "string",
"default": "OBP60V2",
"check": "checkSystemName",
"description": "system name, used for the access point and for services",
"category": "system"
},
{ {
"name": "timeZone", "name": "timeZone",
"label": "Time Zone", "label": "Time Zone",

View File

@ -30,6 +30,11 @@ int taskRunCounter = 0; // Task couter for loop section
// Hardware initialization before start all services // Hardware initialization before start all services
//#################################################################################### //####################################################################################
void OBP60Init(GwApi *api){ void OBP60Init(GwApi *api){
// Set a new device name and hidden the original name in the main config
String devicename = api->getConfig()->getConfigItem(api->getConfig()->deviceName,true)->asString();
api->getConfig()->setValue(GwConfigDefinitions::systemName, devicename, GwConfigInterface::ConfigType::HIDDEN);
api->getLogger()->logDebug(GwLog::LOG,"obp60init running"); api->getLogger()->logDebug(GwLog::LOG,"obp60init running");
// Check I2C devices // Check I2C devices
@ -477,7 +482,7 @@ void OBP60Task(GwApi *api){
// Full display update afer a new selected page and 4s wait time // Full display update afer a new selected page and 4s wait time
if(millis() > starttime4 + 4000 && delayedDisplayUpdate == true){ if(millis() > starttime4 + 4000 && delayedDisplayUpdate == true){
getdisplay().setFullWindow(); // Set full update getdisplay().setFullWindow(); // Set full update
getdisplay().nextPage(); // Full Update getdisplay().nextPage(); // Full update
delayedDisplayUpdate = false; delayedDisplayUpdate = false;
} }
@ -487,7 +492,7 @@ void OBP60Task(GwApi *api){
starttime1 = millis(); starttime1 = 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(); // Full Update getdisplay().nextPage(); // Full update
} }
// Subtask E-Ink full refresh // Subtask E-Ink full refresh
@ -495,7 +500,7 @@ 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(); // Full Update getdisplay().nextPage(); // Full update
} }
// Refresh display data all 1s // Refresh display data all 1s
@ -509,7 +514,8 @@ void OBP60Task(GwApi *api){
getdisplay().fillRect(0, 0, getdisplay().width(), getdisplay().height(), bgcolor); // Clear display getdisplay().fillRect(0, 0, getdisplay().width(), getdisplay().height(), bgcolor); // Clear display
if (pages[pageNumber].description && pages[pageNumber].description->header){ if (pages[pageNumber].description && pages[pageNumber].description->header){
//build some header and footer using commonData //build some header and footer using commonData
displayHeader(commonData, date, time); getdisplay().fillScreen(bgcolor); // Clear display
displayHeader(commonData, date, time); // Sown header
} }
// Call the particular page // Call the particular page

View File

@ -21,6 +21,7 @@
// OBP60 Task // OBP60 Task
void OBP60Task(GwApi *param); void OBP60Task(GwApi *param);
DECLARE_USERTASK_PARAM(OBP60Task, 10000) // Need 8k RAM as stack size DECLARE_USERTASK_PARAM(OBP60Task, 10000); // Need 8k RAM as stack size
DECLARE_CAPABILITY(obp60,true); DECLARE_CAPABILITY(obp60,true);
DECLARE_STRING_CAPABILITY(HELP_URL, "https://obp60-v2-docu.readthedocs.io/de/latest/"); // Link to help pages
#endif #endif