#44: implement workaround factor for ROT

This commit is contained in:
wellenvogel 2022-11-16 11:46:14 +01:00
parent c02be797db
commit b4d5e97619
3 changed files with 6 additions and 2 deletions

View File

@ -7,6 +7,10 @@
#define GW_BOAT_VALUE_LEN 32 #define GW_BOAT_VALUE_LEN 32
#define GWSC(name) static constexpr const __FlashStringHelper* name=F(#name) #define GWSC(name) static constexpr const __FlashStringHelper* name=F(#name)
//see https://github.com/wellenvogel/esp32-nmea2000/issues/44
//factor to convert from N2k/SI rad/s to current NMEA rad/min
#define ROT_WA_FACTOR 60
class GwJsonDocument; class GwJsonDocument;
class GwBoatItemBase{ class GwBoatItemBase{
public: public:

View File

@ -887,6 +887,7 @@ private:
LOG_DEBUG(GwLog::DEBUG,"unable to parse ROT %s",msg.line); LOG_DEBUG(GwLog::DEBUG,"unable to parse ROT %s",msg.line);
return; return;
} }
ROT=ROT / ROT_WA_FACTOR;
if (! updateDouble(boatData->ROT,ROT,msg.sourceId)) return; if (! updateDouble(boatData->ROT,ROT,msg.sourceId)) return;
tN2kMsg n2kMsg; tN2kMsg n2kMsg;
SetN2kRateOfTurn(n2kMsg,1,ROT); SetN2kRateOfTurn(n2kMsg,1,ROT);

View File

@ -32,7 +32,6 @@
N2kDataToNMEA0183::N2kDataToNMEA0183(GwLog * logger, GwBoatData *boatData, N2kDataToNMEA0183::N2kDataToNMEA0183(GwLog * logger, GwBoatData *boatData,
SendNMEA0183MessageCallback callback, String talkerId) SendNMEA0183MessageCallback callback, String talkerId)
{ {
@ -1055,7 +1054,7 @@ private:
} }
if (!updateDouble(boatData->ROT,ROT)) return; if (!updateDouble(boatData->ROT,ROT)) return;
tNMEA0183Msg nmeamsg; tNMEA0183Msg nmeamsg;
if (NMEA0183SetROT(nmeamsg,ROT,talkerId)){ if (NMEA0183SetROT(nmeamsg,ROT * ROT_WA_FACTOR,talkerId)){
SendMessage(nmeamsg); SendMessage(nmeamsg);
} }
} }