mirror of
https://github.com/thooge/esp32-nmea2000-obp60.git
synced 2025-12-13 05:53:06 +01:00
add support for pgn 127257
This commit is contained in:
@@ -288,6 +288,11 @@ private:
|
||||
}
|
||||
}
|
||||
break;
|
||||
case XDRATTITUDE:
|
||||
if (fillFieldList(current,fields,3)){
|
||||
SetN2kPGN127257(n2kMsg,current.mapping.instanceId,fields[0],fields[1],fields[2]);
|
||||
send(n2kMsg,msg.sourceId,buildN2KKey(n2kMsg,current.mapping));
|
||||
}
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
@@ -976,9 +981,9 @@ private:
|
||||
converters.registerConverter(
|
||||
129283UL,
|
||||
String(F("XTE")), &NMEA0183DataToN2KFunctions::convertXTE);
|
||||
unsigned long *xdrpgns=new unsigned long[7]{127505UL,127508UL,130312UL,130313UL,130314UL,127489UL,127488UL};
|
||||
unsigned long *xdrpgns=new unsigned long[8]{127505UL,127508UL,130312UL,130313UL,130314UL,127489UL,127488UL,127257UL};
|
||||
converters.registerConverter(
|
||||
7,
|
||||
8,
|
||||
xdrpgns,
|
||||
F("XDR"), &NMEA0183DataToN2KFunctions::convertXDR);
|
||||
unsigned long *aispgns=new unsigned long[7]{129810UL,129809UL,129040UL,129039UL,129802UL,129794UL,129038UL};
|
||||
|
||||
@@ -1389,6 +1389,22 @@ private:
|
||||
}
|
||||
finalizeXdr();
|
||||
}
|
||||
void Handle127257(const tN2kMsg &msg){
|
||||
unsigned char instance=-1;
|
||||
double values[3];
|
||||
for (int i=0;i<3;i++) values[i]=N2kDoubleNA;
|
||||
//yaw,pitch,roll
|
||||
if (! ParseN2kPGN127257(msg,instance,
|
||||
values[0],values[1],values[2])){
|
||||
LOG_DEBUG(GwLog::DEBUG,"unable to parse PGN %d",msg.PGN);
|
||||
}
|
||||
for (int i=0;i<3;i++){
|
||||
GwXDRFoundMapping mapping=xdrMappings->getMapping(XDRATTITUDE,0,i,instance);
|
||||
if (! updateDouble(&mapping,values[i])) continue;
|
||||
addToXdr(mapping.buildXdrEntry(values[i]));
|
||||
}
|
||||
finalizeXdr();
|
||||
}
|
||||
void Handle127488(const tN2kMsg &msg){
|
||||
unsigned char instance=-1;
|
||||
double speed=N2kDoubleNA,pressure=N2kDoubleNA;
|
||||
@@ -1478,6 +1494,7 @@ private:
|
||||
converters.registerConverter(127489UL, &N2kToNMEA0183Functions::Handle127489);
|
||||
converters.registerConverter(127488UL, &N2kToNMEA0183Functions::Handle127488);
|
||||
converters.registerConverter(130316UL, &N2kToNMEA0183Functions::Handle130316);
|
||||
converters.registerConverter(127257UL, &N2kToNMEA0183Functions::Handle127257);
|
||||
#define HANDLE_AIS
|
||||
#ifdef HANDLE_AIS
|
||||
converters.registerConverter(129038UL, &N2kToNMEA0183Functions::HandleAISClassAPosReport); // AIS Class A Position Report, Message Type 1
|
||||
|
||||
@@ -53,6 +53,7 @@ GwXDRType *types[] = {
|
||||
new GwXDRType(GwXDRType::FLOW, "R", "I", ps2ph, ph2ps),
|
||||
new GwXDRType(GwXDRType::GENERIC, "G", ""),
|
||||
new GwXDRType(GwXDRType::DISPLACEMENT, "A", "P"),
|
||||
new GwXDRType(GwXDRType::DISPLACEMENTD, "A", "D",DegToRad,RadToDeg),
|
||||
new GwXDRType(GwXDRType::RPM,"T","R"),
|
||||
//important to have 2x NULL!
|
||||
NULL,
|
||||
@@ -121,7 +122,7 @@ bool GwXDRMappingDef::handleToken(String tok, int index, GwXDRMappingDef *def)
|
||||
case 0:
|
||||
//category
|
||||
i = tok.toInt();
|
||||
if (i < XDRTEMP || i > XDRENGINE)
|
||||
if (i < XDRTEMP || i > XDRATTITUDE)
|
||||
return false;
|
||||
def->category = (GwXDRCategory)i;
|
||||
return true;
|
||||
|
||||
@@ -19,7 +19,8 @@ typedef enum {
|
||||
XDRBATCHEM=7, //unused
|
||||
XDRGEAR=8, //unused
|
||||
XDRBAT=9,
|
||||
XDRENGINE=10
|
||||
XDRENGINE=10,
|
||||
XDRATTITUDE=11
|
||||
} GwXDRCategory;
|
||||
class GwXDRType{
|
||||
public:
|
||||
@@ -36,6 +37,7 @@ class GwXDRType{
|
||||
GENERIC=9,
|
||||
DISPLACEMENT=10,
|
||||
RPM=11,
|
||||
DISPLACEMENTD=12,
|
||||
UNKNOWN=99
|
||||
}TypeCode;
|
||||
typedef double (* convert)(double);
|
||||
|
||||
Reference in New Issue
Block a user