mirror of
https://github.com/thooge/esp32-nmea2000-obp60.git
synced 2025-12-13 05:53:06 +01:00
also set water temperature (MTW) from PGN 130312 - with condition
This commit is contained in:
@@ -70,6 +70,7 @@ class GwConverterConfig{
|
||||
int min2KInterval=50;
|
||||
int rmcInterval=1000;
|
||||
int rmcCheckTime=4000;
|
||||
int winst312=256;
|
||||
std::vector<WindMapping> windMappings;
|
||||
void init(GwConfigHandler *config, GwLog*logger){
|
||||
minXdrInterval=config->getInt(GwConfigDefinitions::minXdrInterval,100);
|
||||
@@ -82,6 +83,7 @@ class GwConverterConfig{
|
||||
rmcInterval=config->getInt(GwConfigDefinitions::sendRMCi,1000);
|
||||
if (rmcInterval < 0) rmcInterval=0;
|
||||
if (rmcInterval > 0 && rmcInterval <100) rmcInterval=100;
|
||||
winst312=config->getInt(GwConfigDefinitions::winst312,256);
|
||||
for (auto && it:windConfigs){
|
||||
String cfg=config->getString(it.second);
|
||||
WindMapping mapping(it.first,cfg);
|
||||
|
||||
@@ -1344,7 +1344,6 @@ private:
|
||||
return;
|
||||
|
||||
SendMessage(NMEA0183Msg);
|
||||
i++;
|
||||
}
|
||||
|
||||
GwXDRFoundMapping mapping=xdrMappings->getMapping(XDRTEMP,TempSource,0,0);
|
||||
@@ -1379,6 +1378,21 @@ private:
|
||||
LOG_DEBUG(GwLog::DEBUG,"unable to parse PGN %d",msg.PGN);
|
||||
return;
|
||||
}
|
||||
if (TemperatureSource == N2kts_SeaTemperature &&
|
||||
(config.winst312 == TemperatureInstance || config.winst312 == 256)) {
|
||||
updateDouble(boatData->WTemp, Temperature);
|
||||
tNMEA0183Msg NMEA0183Msg;
|
||||
|
||||
if (!NMEA0183Msg.Init("MTW", talkerId))
|
||||
return;
|
||||
if (!NMEA0183Msg.AddDoubleField(KelvinToC(Temperature)))
|
||||
return;
|
||||
if (!NMEA0183Msg.AddStrField("C"))
|
||||
return;
|
||||
|
||||
SendMessage(NMEA0183Msg);
|
||||
}
|
||||
|
||||
GwXDRFoundMapping mapping=xdrMappings->getMapping(XDRTEMP,(int)TemperatureSource,0,TemperatureInstance);
|
||||
if (updateDouble(&mapping,Temperature)){
|
||||
LOG_DEBUG(GwLog::DEBUG+1,"found temperature mapping %s",mapping.definition->toString().c_str());
|
||||
|
||||
Reference in New Issue
Block a user