1
0
mirror of https://github.com/thooge/esp32-nmea2000-obp60.git synced 2025-12-13 05:53:06 +01:00

add XDR min interval, N2K min interval, add N2K_LOAD_LEVEL and N2K_CERTIFICATION_LEVEL

This commit is contained in:
wellenvogel
2021-12-03 11:47:05 +01:00
parent b01dabf8cc
commit 3e73f6b80c
10 changed files with 116 additions and 36 deletions

View File

@@ -31,8 +31,17 @@
//#define FALLBACK_SERIAL
const unsigned long HEAP_REPORT_TIME=2000; //set to 0 to disable heap reporting
#include <Arduino.h>
#include "GwApi.h"
#include "GwHardware.h"
#ifndef N2K_LOAD_LEVEL
#define N2K_LOAD_LEVEL 0
#endif
#ifndef N2K_CERTIFICATION_LEVEL
#define N2K_CERTIFICATION_LEVEL 0xff
#endif
#include <NMEA2000_CAN.h> // This will automatically choose right CAN library and create suitable NMEA2000 object
#include <ActisenseReader.h>
#include <Seasmart.h>
@@ -65,8 +74,6 @@ const unsigned long HEAP_REPORT_TIME=2000; //set to 0 to disable heap reporting
#include "GwUserCode.h"
#include "GwApi.h"
//NMEA message channels
#define N2K_CHANNEL_ID 0
#define USB_CHANNEL_ID 1
@@ -699,13 +706,19 @@ void setup() {
[](const tNMEA0183Msg &msg, int sourceId){
SendNMEA0183Message(msg,sourceId,false);
}
, N2K_CHANNEL_ID,config.getString(config.talkerId,String("GP")),&xdrMappings);
, N2K_CHANNEL_ID,
config.getString(config.talkerId,String("GP")),
&xdrMappings,
config.getInt(config.minXdrInterval,100)
);
toN2KConverter= NMEA0183DataToN2K::create(&logger,&boatData,[](const tN2kMsg &msg)->bool{
logger.logDebug(GwLog::DEBUG+2,"send N2K %ld",msg.PGN);
handleN2kMessage(msg,N2KT_MSGOUT);
return true;
});
},
config.getInt(config.min2KInterval,50)
);
NMEA2000.SetN2kCANMsgBufSize(8);
NMEA2000.SetN2kCANReceiveFrameBufSize(250);
@@ -719,7 +732,10 @@ void setup() {
100, // Manufacturer's product code
systemName->asCString(), // Manufacturer's Model ID
VERSION, // Manufacturer's Software version code
VERSION // Manufacturer's Model version
VERSION, // Manufacturer's Model version,
N2K_LOAD_LEVEL,
0xffff, //Version
N2K_CERTIFICATION_LEVEL
);
// Set device information
NMEA2000.SetDeviceInformation(id, // Unique number. Use e.g. Serial number. Id is generated from MAC-Address