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