NMEA2000 access for system page
This commit is contained in:
parent
f823dadc6b
commit
cf305e9f5a
|
@ -2,6 +2,7 @@
|
|||
#define _GWAPI_H
|
||||
#include "GwMessage.h"
|
||||
#include "N2kMsg.h"
|
||||
#include "Nmea2kTwai.h"
|
||||
#include "NMEA0183Msg.h"
|
||||
#include "GWConfig.h"
|
||||
#include "GwBoatData.h"
|
||||
|
@ -222,6 +223,7 @@ class GwApi{
|
|||
* accessing boat data must only be executed from within the main thread
|
||||
* you need to use the request pattern as shown in GwExampleTask.cpp
|
||||
*/
|
||||
virtual Nmea2kTwai *getNMEA2000()=0;
|
||||
virtual GwBoatData *getBoatData()=0;
|
||||
virtual ~GwApi(){}
|
||||
};
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "images/logo64.xbm"
|
||||
#include <esp32/clk.h>
|
||||
#include "qrcode.h"
|
||||
#include "Nmea2kTwai.h"
|
||||
|
||||
#ifdef BOARD_OBP40S3
|
||||
#include <SD.h>
|
||||
|
@ -530,6 +531,10 @@ public:
|
|||
// Logging page information
|
||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageSystem, Mode=%c", mode);
|
||||
|
||||
// Get references from API
|
||||
Nmea2kTwai *NMEA2000 = pageData.api->getNMEA2000();
|
||||
LOG_DEBUG(GwLog::LOG,"N2k source address=%d", NMEA2000->GetN2kSource());
|
||||
|
||||
// Set display in partial refresh mode
|
||||
epd->setPartialWindow(0, 0, epd->width(), epd->height());
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
typedef std::vector<GwApi::BoatValue *> ValueList;
|
||||
|
||||
typedef struct{
|
||||
GwApi *api;
|
||||
String pageName;
|
||||
uint8_t pageNumber; // page number in sequence of visible pages
|
||||
//the values will always contain the user defined values first
|
||||
|
|
|
@ -976,6 +976,7 @@ void OBP60Task(GwApi *api){
|
|||
if (systemPage) {
|
||||
displayFooter(commonData);
|
||||
PageData sysparams; // empty
|
||||
sysparams.api = api;
|
||||
syspage->displayPage(sysparams);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -216,6 +216,10 @@ public:
|
|||
{
|
||||
return api->getLogger();
|
||||
}
|
||||
virtual Nmea2kTwai *getNMEA2000()
|
||||
{
|
||||
return api->getNMEA2000();
|
||||
}
|
||||
virtual GwBoatData *getBoatData()
|
||||
{
|
||||
return api->getBoatData();
|
||||
|
@ -428,4 +432,4 @@ void GwUserCode::handleWebRequest(const String &url,AsyncWebServerRequest *req){
|
|||
}
|
||||
LOG_DEBUG(GwLog::DEBUG,"no task found for web request %s[%s]",url.c_str(),tname.c_str());
|
||||
req->send(404, "text/plain", "not found");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -333,6 +333,9 @@ public:
|
|||
status.n2kTx=countNMEA2KOut.getGlobal();
|
||||
channels.fillStatus(status);
|
||||
}
|
||||
virtual Nmea2kTwai *getNMEA2000(){
|
||||
return &NMEA2000;
|
||||
}
|
||||
virtual GwBoatData *getBoatData(){
|
||||
return &boatData;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue