convert ROT from/to, add conv doc
This commit is contained in:
parent
ff4b3b5c10
commit
32f9badda2
Binary file not shown.
|
@ -21,6 +21,7 @@ class GwBoatItemBase{
|
|||
GWSC(kelvinToC);
|
||||
GWSC(mtr2nm);
|
||||
GWSC(formatDop);
|
||||
GWSC(formatRot);
|
||||
typedef std::vector<GwBoatItemBase*> GwBoatItemMap;
|
||||
protected:
|
||||
unsigned long lastSet=0;
|
||||
|
@ -224,6 +225,7 @@ class GwBoatData{
|
|||
GWBOATDATA(double,AWA,4000,formatWind)
|
||||
GWBOATDATA(double,Heading,4000,formatCourse) //true
|
||||
GWBOATDATA(double,MagneticHeading,4000,formatCourse)
|
||||
GWBOATDATA(double,ROT,4000,formatRot)
|
||||
GWBOATDATA(double,Variation,4000,formatCourse)
|
||||
GWBOATDATA(double,Deviation,4000,formatCourse)
|
||||
GWBOATDATA(double,HDOP,4000,formatDop)
|
||||
|
|
|
@ -714,6 +714,18 @@ private:
|
|||
send(n2kMsg);
|
||||
}
|
||||
|
||||
void convertROT(const SNMEA0183Msg &msg){
|
||||
double ROT=NMEA0183DoubleNA;
|
||||
if (! NMEA0183ParseROT_nc(msg,ROT)){
|
||||
LOG_DEBUG(GwLog::DEBUG,"unable to parse ROT %s",msg.line);
|
||||
return;
|
||||
}
|
||||
if (! updateDouble(boatData->ROT,ROT,msg.sourceId)) return;
|
||||
tN2kMsg n2kMsg;
|
||||
SetN2kRateOfTurn(n2kMsg,1,ROT);
|
||||
send(n2kMsg);
|
||||
}
|
||||
|
||||
//shortcut for lambda converters
|
||||
#define CVL [](const SNMEA0183Msg &msg, NMEA0183DataToN2KFunctions *p) -> void
|
||||
void registerConverters()
|
||||
|
@ -777,6 +789,9 @@ private:
|
|||
converters.registerConverter(
|
||||
129025UL,
|
||||
String(F("GLL")), &NMEA0183DataToN2KFunctions::convertGLL);
|
||||
converters.registerConverter(
|
||||
127251UL,
|
||||
String(F("ROT")), &NMEA0183DataToN2KFunctions::convertROT);
|
||||
unsigned long *aispgns=new unsigned long[7]{129810UL,129809UL,129040UL,129039UL,129802UL,129794UL,129038UL};
|
||||
converters.registerConverter(7,&aispgns[0],
|
||||
String(F("AIVDM")),&NMEA0183DataToN2KFunctions::convertAIVDX);
|
||||
|
|
|
@ -73,13 +73,13 @@ private:
|
|||
return;
|
||||
maxItem->updateMax(item->getData(),sourceId);
|
||||
}
|
||||
void updateDouble(GwBoatItem<double> *item, double value)
|
||||
bool updateDouble(GwBoatItem<double> *item, double value)
|
||||
{
|
||||
if (value == N2kDoubleNA)
|
||||
return;
|
||||
return false;
|
||||
if (!item)
|
||||
return;
|
||||
item->update(value,sourceId);
|
||||
return false;
|
||||
return item->update(value,sourceId);
|
||||
}
|
||||
|
||||
unsigned long LastPosSend;
|
||||
|
@ -1017,6 +1017,19 @@ private:
|
|||
if (DaysSince1970 != N2kUInt16NA) boatData->DaysSince1970->update(DaysSince1970,sourceId);
|
||||
if (LocalOffset != N2kInt16NA) boatData->Timezone->update(LocalOffset,sourceId);
|
||||
}
|
||||
void HandleROT(const tN2kMsg &msg){
|
||||
unsigned char SID=0;
|
||||
double ROT=N2kDoubleNA;
|
||||
if (! ParseN2kRateOfTurn(msg,SID,ROT)){
|
||||
LOG_DEBUG(GwLog::DEBUG,"unable to parse PGN %d",msg.PGN);
|
||||
return;
|
||||
}
|
||||
if (!updateDouble(boatData->ROT,ROT)) return;
|
||||
tNMEA0183Msg nmeamsg;
|
||||
if (NMEA0183SetROT(nmeamsg,ROT,talkerId)){
|
||||
SendMessage(nmeamsg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void registerConverters()
|
||||
|
@ -1041,6 +1054,7 @@ private:
|
|||
converters.registerConverter(129033UL, &N2kToNMEA0183Functions::HandleTimeOffset);
|
||||
converters.registerConverter(129539UL, &N2kToNMEA0183Functions::HandleDop);
|
||||
converters.registerConverter(129540UL, &N2kToNMEA0183Functions::HandleSats);
|
||||
converters.registerConverter(127251UL, &N2kToNMEA0183Functions::HandleROT);
|
||||
#define HANDLE_AIS
|
||||
#ifdef HANDLE_AIS
|
||||
converters.registerConverter(129038UL, &N2kToNMEA0183Functions::HandleAISClassAPosReport); // AIS Class A Position Report, Message Type 1
|
||||
|
|
Loading…
Reference in New Issue