Add status infos
This commit is contained in:
parent
b1bdc6ac7b
commit
1bdb3ebfb9
|
@ -425,7 +425,7 @@ double formatWind(double cv)
|
|||
{
|
||||
double rt = formatCourse(cv);
|
||||
if (rt > 180)
|
||||
rt = 180 - rt;
|
||||
rt = (360 - rt) * -1;
|
||||
return rt;
|
||||
}
|
||||
double formatKnots(double cv)
|
||||
|
|
|
@ -215,6 +215,7 @@ void OBP60Task(void *param){
|
|||
|
||||
GwApi *api=(GwApi*)param;
|
||||
GwLog *logger=api->getLogger();
|
||||
GwApi::Status status;
|
||||
|
||||
bool hasPosition = false;
|
||||
|
||||
|
@ -260,8 +261,9 @@ void OBP60Task(void *param){
|
|||
GwApi::BoatValue *longitude=new GwApi::BoatValue(F("Longitude"));
|
||||
GwApi::BoatValue *latitude=new GwApi::BoatValue(F("Latitude"));
|
||||
GwApi::BoatValue *waterdepth=new GwApi::BoatValue(F("WaterDepth"));
|
||||
GwApi::BoatValue *hdop=new GwApi::BoatValue(F("HDOP"));
|
||||
GwApi::BoatValue *pdop=new GwApi::BoatValue(F("PDOP"));
|
||||
GwApi::BoatValue *valueList[]={sog, date, time, longitude, latitude, waterdepth, pdop};
|
||||
GwApi::BoatValue *valueList[]={sog, date, time, longitude, latitude, waterdepth, hdop, pdop};
|
||||
|
||||
//Init E-Ink display
|
||||
display.init(); // Initialize and clear display
|
||||
|
@ -284,7 +286,6 @@ void OBP60Task(void *param){
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// Task Loop
|
||||
//###############################
|
||||
while(true){
|
||||
|
@ -339,8 +340,31 @@ void OBP60Task(void *param){
|
|||
}
|
||||
}
|
||||
|
||||
// Read the status values from gateway
|
||||
api->getStatus(status);
|
||||
busInfo.wifiApOn = status.wifiApOn;
|
||||
busInfo.wifiClientOn = status.wifiClientOn;
|
||||
busInfo.wifiClientConnected = status.wifiClientConnected;
|
||||
busInfo.wifiApIp = status.wifiApIp;
|
||||
busInfo.systemName = status.systemName;
|
||||
busInfo.wifiApPass = status.wifiApPass;
|
||||
busInfo.wifiClientIp = status.wifiClientIp;
|
||||
busInfo.wifiClientSSID = status.wifiClientSSID;
|
||||
busInfo.usbRx = status.usbRx;
|
||||
busInfo.usbTx = status.usbTx;
|
||||
busInfo.serRx = status.serRx;
|
||||
busInfo.serTx = status.serTx;
|
||||
busInfo.tcpSerRx = status.tcpSerRx;
|
||||
busInfo.tcpSerTx = status.tcpSerTx;
|
||||
busInfo.tcpClients = status.tcpClients;
|
||||
busInfo.tcpClRx = status.tcpClRx;
|
||||
busInfo.tcpClTx = status.tcpClTx;
|
||||
busInfo.tcpClientConnected = status.tcpClientConnected;
|
||||
busInfo.n2kRx = status.n2kRx;
|
||||
busInfo.n2kTx = status.n2kTx;
|
||||
|
||||
// Read the current bus data and copy to stucture
|
||||
api->getBoatDataValues(7,valueList);
|
||||
api->getBoatDataValues(8,valueList);
|
||||
|
||||
busInfo.WaterDepth.fvalue = waterdepth->value;
|
||||
waterdepth->getFormat().toCharArray(busInfo.WaterDepth.unit, 8, 0);
|
||||
|
@ -356,6 +380,9 @@ void OBP60Task(void *param){
|
|||
formatValue(time).toCharArray(busInfo.Time.svalue, 16, 0);
|
||||
busInfo.Time.valid = time->valid;
|
||||
|
||||
busInfo.HDOP.fvalue = hdop->value;
|
||||
busInfo.HDOP.valid = hdop->valid;
|
||||
|
||||
busInfo.PDOP.fvalue = pdop->value;
|
||||
busInfo.PDOP.valid = pdop->valid;
|
||||
|
||||
|
|
|
@ -11,6 +11,27 @@ typedef struct{ // Sub structure for bus data
|
|||
} dataContainer;
|
||||
|
||||
typedef struct{
|
||||
// Gateway status infos
|
||||
bool wifiApOn = false;
|
||||
bool wifiClientOn = false;
|
||||
bool wifiClientConnected = false;
|
||||
String wifiApIp = "";
|
||||
String systemName = ""; // is also AP SSID
|
||||
String wifiApPass = "";
|
||||
String wifiClientIp = "";
|
||||
String wifiClientSSID = "";
|
||||
unsigned long usbRx = 0;
|
||||
unsigned long usbTx = 0;
|
||||
unsigned long serRx = 0;
|
||||
unsigned long serTx = 0;
|
||||
unsigned long tcpSerRx = 0;
|
||||
unsigned long tcpSerTx = 0;
|
||||
int tcpClients = 0;
|
||||
unsigned long tcpClRx = 0;
|
||||
unsigned long tcpClTx = 0;
|
||||
bool tcpClientConnected = false;
|
||||
unsigned long n2kRx = 0;
|
||||
unsigned long n2kTx = 0;
|
||||
// OBP60 Settings
|
||||
char dateformat[3] = "GB";
|
||||
int timezone = 0;
|
||||
|
|
|
@ -17,7 +17,21 @@ void showPage(busData values){
|
|||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setTextColor(GxEPD_BLACK);
|
||||
display.setCursor(0, 15);
|
||||
display.print(" WiFi AP TCP N2K 183 ");
|
||||
if(values.wifiApOn){
|
||||
display.print(" AP ");
|
||||
}
|
||||
if(values.tcpClRx > 0 || values.tcpClTx > 0 || values.tcpSerRx > 0 || values.tcpSerTx > 0){
|
||||
display.print("TCP ");
|
||||
}
|
||||
if(values.n2kRx > 0 || values.n2kTx > 0){
|
||||
display.print("N2K ");
|
||||
}
|
||||
if(values.serRx > 0 || values.serTx > 0){
|
||||
display.print("183 ");
|
||||
}
|
||||
if(values.usbRx > 0 || values.usbTx > 0){
|
||||
display.print("USB ");
|
||||
}
|
||||
if(values.gps == true && values.PDOP.valid == true && values.PDOP.fvalue <= 50){
|
||||
display.print("GPS");
|
||||
}
|
||||
|
@ -36,8 +50,7 @@ void showPage(busData values){
|
|||
// Date and time
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(230, 15);
|
||||
if(values.gps == true){
|
||||
if(values.PDOP.valid == true && values.PDOP.fvalue <= 50){
|
||||
if(values.HDOP.valid == true && values.HDOP.fvalue <= 50){
|
||||
char newdate[16] = "";
|
||||
if(String(values.dateformat) == "DE"){
|
||||
display.print(values.Date.svalue);
|
||||
|
@ -91,7 +104,6 @@ void showPage(busData values){
|
|||
display.print("No GPS data");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Read page number
|
||||
switch (pageNumber) {
|
||||
|
|
Loading…
Reference in New Issue