First Alpha Version V0.80
This commit is contained in:
parent
f00064ece8
commit
726b1abf2d
|
@ -77,7 +77,7 @@ void hardwareInit()
|
|||
setPortPin(OBP_POWER_50, true);
|
||||
|
||||
// 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
|
||||
|
@ -225,12 +225,12 @@ String xdrDelete(String input){
|
|||
|
||||
// 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){
|
||||
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)
|
||||
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
|
||||
|
@ -259,27 +259,27 @@ void displayHeader(CommonData &commonData, GwApi::BoatValue *date, GwApi::BoatVa
|
|||
}
|
||||
|
||||
// Show status info
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(0, 15);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(0, 15);
|
||||
if(commonData.status.wifiApOn){
|
||||
display.print(" AP ");
|
||||
getdisplay().print(" AP ");
|
||||
}
|
||||
// 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){
|
||||
display.print("TCP ");
|
||||
getdisplay().print("TCP ");
|
||||
}
|
||||
if(commonData.status.n2kRx != n2kRxOld || commonData.status.n2kTx != n2kTxOld){
|
||||
display.print("N2K ");
|
||||
getdisplay().print("N2K ");
|
||||
}
|
||||
if(commonData.status.serRx != serRxOld || commonData.status.serTx != serTxOld){
|
||||
display.print("183 ");
|
||||
getdisplay().print("183 ");
|
||||
}
|
||||
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){
|
||||
display.print("GPS");
|
||||
getdisplay().print("GPS");
|
||||
}
|
||||
// Save old telegram counter
|
||||
tcpClRxOld = commonData.status.tcpClRx;
|
||||
|
@ -294,38 +294,38 @@ void displayHeader(CommonData &commonData, GwApi::BoatValue *date, GwApi::BoatVa
|
|||
usbTxOld = commonData.status.usbTx;
|
||||
|
||||
// Heartbeat as dot
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold32pt7b);
|
||||
display.setCursor(205, 14);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold32pt7b);
|
||||
getdisplay().setCursor(205, 14);
|
||||
if(heartbeat == true){
|
||||
display.print(".");
|
||||
getdisplay().print(".");
|
||||
}
|
||||
else{
|
||||
display.print(" ");
|
||||
getdisplay().print(" ");
|
||||
}
|
||||
heartbeat = !heartbeat;
|
||||
|
||||
// Date and time
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(230, 15);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(230, 15);
|
||||
if(date->valid == true){
|
||||
String acttime = formatValue(time, commonData).svalue;
|
||||
acttime = acttime.substring(0, 5);
|
||||
String actdate = formatValue(date, commonData).svalue;
|
||||
display.print(acttime);
|
||||
display.print(" ");
|
||||
display.print(actdate);
|
||||
display.print(" ");
|
||||
getdisplay().print(acttime);
|
||||
getdisplay().print(" ");
|
||||
getdisplay().print(actdate);
|
||||
getdisplay().print(" ");
|
||||
if(commonData.config->getInt(commonData.config->timeZone) == 0){
|
||||
display.print("UTC");
|
||||
getdisplay().print("UTC");
|
||||
}
|
||||
else{
|
||||
display.print("LOT");
|
||||
getdisplay().print("LOT");
|
||||
}
|
||||
}
|
||||
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
|
||||
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){
|
||||
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
|
||||
int xp = xb + 20;
|
||||
int yp = yb - 15 + t;
|
||||
display.fillRect(xp, yp, 20, 15, pcolor);
|
||||
display.fillRect(xp+t, yp+t, 20-(2*t), 15-(2*t), bcolor);
|
||||
getdisplay().fillRect(xp, yp, 20, 15, pcolor);
|
||||
getdisplay().fillRect(xp+t, yp+t, 20-(2*t), 15-(2*t), bcolor);
|
||||
// Minus pol 20x15
|
||||
int xm = xb + 60;
|
||||
int ym = yb -15 + t;
|
||||
display.fillRect(xm, ym, 20, 15, pcolor);
|
||||
display.fillRect(xm+t, ym+t, 20-(2*t), 15-(2*t), bcolor);
|
||||
getdisplay().fillRect(xm, ym, 20, 15, pcolor);
|
||||
getdisplay().fillRect(xm+t, ym+t, 20-(2*t), 15-(2*t), bcolor);
|
||||
}
|
||||
|
||||
#endif
|
|
@ -106,7 +106,6 @@ public:
|
|||
}
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
getdisplay().fillScreen(bgcolor); // Clear display
|
||||
|
||||
// Show values AWS
|
||||
getdisplay().setTextColor(textcolor);
|
||||
|
|
|
@ -121,7 +121,6 @@ class PageBME280 : public Page
|
|||
}
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
getdisplay().fillScreen(bgcolor); // Clear display
|
||||
|
||||
// ############### Value 1 ################
|
||||
|
||||
|
|
|
@ -169,7 +169,6 @@ class PageBattery : public Page
|
|||
}
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
getdisplay().fillScreen(bgcolor); // Clear display
|
||||
|
||||
// Show average settings
|
||||
getdisplay().setTextColor(textcolor);
|
||||
|
|
|
@ -195,7 +195,6 @@ public:
|
|||
}
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
getdisplay().fillScreen(bgcolor); // Clear display
|
||||
|
||||
// Show name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
|
|
|
@ -107,7 +107,6 @@ public:
|
|||
}
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
getdisplay().fillScreen(bgcolor); // Clear display
|
||||
|
||||
// Show values GPS date
|
||||
getdisplay().setTextColor(textcolor);
|
||||
|
|
|
@ -107,7 +107,6 @@ class PageDST810 : public Page
|
|||
}
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
getdisplay().fillScreen(bgcolor); // Clear display
|
||||
|
||||
// ############### Value 1 ################
|
||||
|
||||
|
|
|
@ -107,7 +107,6 @@ class PageFourValues : public Page
|
|||
}
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
getdisplay().fillScreen(bgcolor); // Clear display
|
||||
|
||||
// ############### Value 1 ################
|
||||
|
||||
|
|
|
@ -107,7 +107,6 @@ class PageFourValues2 : public Page
|
|||
}
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
getdisplay().fillScreen(bgcolor); // Clear display
|
||||
|
||||
// ############### Value 1 ################
|
||||
|
||||
|
|
|
@ -83,7 +83,6 @@ public:
|
|||
}
|
||||
/// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
getdisplay().fillScreen(bgcolor); // Clear display
|
||||
|
||||
// Show name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
|
|
|
@ -85,8 +85,6 @@ public:
|
|||
}
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
getdisplay().fillScreen(bgcolor); // Clear display
|
||||
|
||||
|
||||
//*******************************************************************************************
|
||||
|
||||
|
|
|
@ -73,7 +73,6 @@ class PageOneValue : public Page{
|
|||
}
|
||||
/// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
getdisplay().fillScreen(bgcolor); // Clear display
|
||||
|
||||
// Show name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
|
|
|
@ -145,7 +145,6 @@ public:
|
|||
}
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
getdisplay().fillScreen(bgcolor); // Clear display
|
||||
|
||||
// Horizintal separator left
|
||||
getdisplay().fillRect(0, 149, 60, 3, pixelcolor);
|
||||
|
|
|
@ -81,8 +81,6 @@ public:
|
|||
}
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
getdisplay().fillScreen(bgcolor); // Clear display
|
||||
|
||||
|
||||
//*******************************************************************************************
|
||||
|
||||
|
|
|
@ -83,7 +83,6 @@ public:
|
|||
}
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
getdisplay().fillScreen(bgcolor); // Clear display
|
||||
|
||||
// Show name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
|
|
|
@ -96,7 +96,6 @@ class PageThreeValues : public Page
|
|||
}
|
||||
/// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
getdisplay().fillScreen(bgcolor); // Clear display
|
||||
|
||||
// ############### Value 1 ################
|
||||
|
||||
|
|
|
@ -85,7 +85,6 @@ class PageTwoValues : public Page
|
|||
}
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
getdisplay().fillScreen(bgcolor); // Clear display
|
||||
|
||||
// ############### Value 1 ################
|
||||
|
||||
|
|
|
@ -149,7 +149,6 @@ public:
|
|||
}
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
getdisplay().fillScreen(bgcolor); // Clear display
|
||||
|
||||
// Show name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
|
|
|
@ -35,7 +35,6 @@ class PageWhite : public Page{
|
|||
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
getdisplay().fillScreen(bgcolor); // Clear display
|
||||
|
||||
// Update display
|
||||
getdisplay().nextPage(); // Partial update (fast)
|
||||
|
|
|
@ -156,7 +156,6 @@ public:
|
|||
}
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
getdisplay().fillScreen(bgcolor); // Clear display
|
||||
|
||||
// Show values AWA
|
||||
getdisplay().setTextColor(textcolor);
|
||||
|
|
|
@ -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",
|
||||
"label": "Time Zone",
|
||||
|
|
|
@ -30,6 +30,11 @@ int taskRunCounter = 0; // Task couter for loop section
|
|||
// Hardware initialization before start all services
|
||||
//####################################################################################
|
||||
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");
|
||||
|
||||
// Check I2C devices
|
||||
|
@ -477,7 +482,7 @@ void OBP60Task(GwApi *api){
|
|||
// Full display update afer a new selected page and 4s wait time
|
||||
if(millis() > starttime4 + 4000 && delayedDisplayUpdate == true){
|
||||
getdisplay().setFullWindow(); // Set full update
|
||||
getdisplay().nextPage(); // Full Update
|
||||
getdisplay().nextPage(); // Full update
|
||||
delayedDisplayUpdate = false;
|
||||
}
|
||||
|
||||
|
@ -487,7 +492,7 @@ void OBP60Task(GwApi *api){
|
|||
starttime1 = millis();
|
||||
LOG_DEBUG(GwLog::DEBUG,"E-Ink full refresh first 5 min");
|
||||
getdisplay().setFullWindow(); // Set full update
|
||||
getdisplay().nextPage(); // Full Update
|
||||
getdisplay().nextPage(); // Full update
|
||||
}
|
||||
|
||||
// Subtask E-Ink full refresh
|
||||
|
@ -495,7 +500,7 @@ void OBP60Task(GwApi *api){
|
|||
starttime2 = millis();
|
||||
LOG_DEBUG(GwLog::DEBUG,"E-Ink full refresh");
|
||||
getdisplay().setFullWindow(); // Set full update
|
||||
getdisplay().nextPage(); // Full Update
|
||||
getdisplay().nextPage(); // Full update
|
||||
}
|
||||
|
||||
// Refresh display data all 1s
|
||||
|
@ -509,7 +514,8 @@ void OBP60Task(GwApi *api){
|
|||
getdisplay().fillRect(0, 0, getdisplay().width(), getdisplay().height(), bgcolor); // Clear display
|
||||
if (pages[pageNumber].description && pages[pageNumber].description->header){
|
||||
//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
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
// OBP60 Task
|
||||
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_STRING_CAPABILITY(HELP_URL, "https://obp60-v2-docu.readthedocs.io/de/latest/"); // Link to help pages
|
||||
#endif
|
Loading…
Reference in New Issue