mirror of
https://github.com/thooge/esp32-nmea2000-obp60.git
synced 2026-03-28 09:56:37 +01:00
First step for N2K devicelist
This commit is contained in:
@@ -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):
|
||||
tNMEA2000(),RxPin(_RxPin),TxPin(_TxPin)
|
||||
{
|
||||
pN2kDeviceList = new tN2kDeviceList(this);
|
||||
if (RxPin < 0 || TxPin < 0){
|
||||
disabled=true;
|
||||
}
|
||||
@@ -161,6 +162,8 @@ bool Nmea2kTwai::checkRecovery(){
|
||||
return strt;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Nmea2kTwai::loop(){
|
||||
if (disabled) return;
|
||||
timers.loop();
|
||||
@@ -201,4 +204,4 @@ const char * Nmea2kTwai::stateStr(const Nmea2kTwai::STATE &st){
|
||||
case ST_DISABLED: return "DISABLED";
|
||||
}
|
||||
return "ERROR";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef _NMEA2KTWAI_H
|
||||
#define _NMEA2KTWAI_H
|
||||
#include "NMEA2000.h"
|
||||
#include "N2kDeviceList.h"
|
||||
#include "GwTimer.h"
|
||||
|
||||
class Nmea2kTwai : public tNMEA2000{
|
||||
@@ -26,6 +27,7 @@ class Nmea2kTwai : public tNMEA2000{
|
||||
STATE state=ST_ERROR;
|
||||
} Status;
|
||||
Status getStatus();
|
||||
tN2kDeviceList *getDeviceList(){return pN2kDeviceList;}
|
||||
unsigned long getLastRecoveryStart(){return lastRecoveryStart;}
|
||||
void loop();
|
||||
static const char * stateStr(const STATE &st);
|
||||
@@ -58,6 +60,7 @@ class Nmea2kTwai : public tNMEA2000{
|
||||
GwIntervalRunner timers;
|
||||
bool disabled=false;
|
||||
unsigned long lastRecoveryStart=0;
|
||||
tN2kDeviceList *pN2kDeviceList;
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user