1
0
mirror of https://github.com/thooge/esp32-nmea2000-obp60.git synced 2026-03-28 18:06:37 +01:00

First step for N2K devicelist

This commit is contained in:
2026-01-08 18:42:48 +01:00
parent a8cf34343f
commit b2e67880d3
2 changed files with 8 additions and 2 deletions

View File

@@ -9,6 +9,7 @@ static const int TIMEOUT_OFFLINE=256; //# of timeouts to consider offline
Nmea2kTwai::Nmea2kTwai(gpio_num_t _TxPin, gpio_num_t _RxPin, unsigned long recP, unsigned long logP): Nmea2kTwai::Nmea2kTwai(gpio_num_t _TxPin, gpio_num_t _RxPin, unsigned long recP, unsigned long logP):
tNMEA2000(),RxPin(_RxPin),TxPin(_TxPin) tNMEA2000(),RxPin(_RxPin),TxPin(_TxPin)
{ {
pN2kDeviceList = new tN2kDeviceList(this);
if (RxPin < 0 || TxPin < 0){ if (RxPin < 0 || TxPin < 0){
disabled=true; disabled=true;
} }
@@ -161,6 +162,8 @@ bool Nmea2kTwai::checkRecovery(){
return strt; return strt;
} }
void Nmea2kTwai::loop(){ void Nmea2kTwai::loop(){
if (disabled) return; if (disabled) return;
timers.loop(); timers.loop();

View File

@@ -1,6 +1,7 @@
#ifndef _NMEA2KTWAI_H #ifndef _NMEA2KTWAI_H
#define _NMEA2KTWAI_H #define _NMEA2KTWAI_H
#include "NMEA2000.h" #include "NMEA2000.h"
#include "N2kDeviceList.h"
#include "GwTimer.h" #include "GwTimer.h"
class Nmea2kTwai : public tNMEA2000{ class Nmea2kTwai : public tNMEA2000{
@@ -26,6 +27,7 @@ class Nmea2kTwai : public tNMEA2000{
STATE state=ST_ERROR; STATE state=ST_ERROR;
} Status; } Status;
Status getStatus(); Status getStatus();
tN2kDeviceList *getDeviceList(){return pN2kDeviceList;}
unsigned long getLastRecoveryStart(){return lastRecoveryStart;} unsigned long getLastRecoveryStart(){return lastRecoveryStart;}
void loop(); void loop();
static const char * stateStr(const STATE &st); static const char * stateStr(const STATE &st);
@@ -58,6 +60,7 @@ class Nmea2kTwai : public tNMEA2000{
GwIntervalRunner timers; GwIntervalRunner timers;
bool disabled=false; bool disabled=false;
unsigned long lastRecoveryStart=0; unsigned long lastRecoveryStart=0;
tN2kDeviceList *pN2kDeviceList;
}; };
#endif #endif