From b4d5e976195424932e139849b8282a642ab8cf1c Mon Sep 17 00:00:00 2001 From: wellenvogel Date: Wed, 16 Nov 2022 11:46:14 +0100 Subject: [PATCH] #44: implement workaround factor for ROT --- lib/boatData/GwBoatData.h | 4 ++++ lib/nmea0183ton2k/NMEA0183DataToN2K.cpp | 1 + lib/nmea2kto0183/N2kDataToNMEA0183.cpp | 3 +-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/boatData/GwBoatData.h b/lib/boatData/GwBoatData.h index 5ddebde2..71742cf1 100644 --- a/lib/boatData/GwBoatData.h +++ b/lib/boatData/GwBoatData.h @@ -7,6 +7,10 @@ #define GW_BOAT_VALUE_LEN 32 #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 GwBoatItemBase{ public: diff --git a/lib/nmea0183ton2k/NMEA0183DataToN2K.cpp b/lib/nmea0183ton2k/NMEA0183DataToN2K.cpp index 0258f8cc..cd4fbc83 100644 --- a/lib/nmea0183ton2k/NMEA0183DataToN2K.cpp +++ b/lib/nmea0183ton2k/NMEA0183DataToN2K.cpp @@ -887,6 +887,7 @@ class NMEA0183DataToN2KFunctions : public NMEA0183DataToN2K LOG_DEBUG(GwLog::DEBUG,"unable to parse ROT %s",msg.line); return; } + ROT=ROT / ROT_WA_FACTOR; if (! updateDouble(boatData->ROT,ROT,msg.sourceId)) return; tN2kMsg n2kMsg; SetN2kRateOfTurn(n2kMsg,1,ROT); diff --git a/lib/nmea2kto0183/N2kDataToNMEA0183.cpp b/lib/nmea2kto0183/N2kDataToNMEA0183.cpp index 3e900fde..1e61d8e6 100644 --- a/lib/nmea2kto0183/N2kDataToNMEA0183.cpp +++ b/lib/nmea2kto0183/N2kDataToNMEA0183.cpp @@ -32,7 +32,6 @@ - N2kDataToNMEA0183::N2kDataToNMEA0183(GwLog * logger, GwBoatData *boatData, SendNMEA0183MessageCallback callback, String talkerId) { @@ -1055,7 +1054,7 @@ class N2kToNMEA0183Functions : public N2kDataToNMEA0183 } if (!updateDouble(boatData->ROT,ROT)) return; tNMEA0183Msg nmeamsg; - if (NMEA0183SetROT(nmeamsg,ROT,talkerId)){ + if (NMEA0183SetROT(nmeamsg,ROT * ROT_WA_FACTOR,talkerId)){ SendMessage(nmeamsg); } }