also set water temperature (MTW) from PGN 130312 - with condition

This commit is contained in:
andreas 2024-10-11 16:14:22 +02:00
parent 0cd552d590
commit 09b583ebd6
3 changed files with 72 additions and 45 deletions

View File

@ -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);

View File

@ -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());

View File

@ -219,16 +219,56 @@
"category":"converter"
},
{
"name":"checkRMCt",
"name": "checkRMCt",
"label": "check RMC time",
"type": "number",
"description": "start sending RMC if we did not see an external RMC after this much ms",
"default":"4000",
"default": "4000",
"min": 1000,
"check":"checkMinMax",
"category":"converter"
},
{
"check": "checkMinMax",
"category": "converter"
},
{
"name": "timeouts",
"type": "array",
"replace": [
{
"n": "Default",
"d": "4000",
"l": "default",
"t": "NMEA"
},
{
"n": "Sensor",
"d": "60000",
"l": "sensor",
"t": "sensor"
},
{
"n": "Long",
"d": "32000",
"l": "long",
"t": "special NMEA"
},
{
"n": "Ais",
"d": "120000",
"l": "ais",
"t": "ais"
}
],
"children": [
{
"name": "timo$n",
"label": "timeout $l",
"default": "$d",
"type": "number",
"description": "data timeouts(ms) for $t data",
"category": "converter"
}
]
},
{
"name": "stbRudderI",
"label":"stb rudder instance",
"type": "number",
@ -305,44 +345,15 @@
]
},
{
"name": "timeouts",
"type": "array",
"replace":[
{
"n":"Default",
"d":"4000",
"l": "default",
"t": "NMEA"
},
{
"n":"Sensor",
"d":"60000",
"l": "sensor",
"t": "sensor"
},
{
"n":"Long",
"d":"32000",
"l": "long",
"t": "special NMEA"
},
{
"n":"Ais",
"d":"120000",
"l": "ais",
"t": "ais"
}
],
"children":[
{
"name":"timo$n",
"label":"timeout $l",
"default": "$d",
"type": "number",
"description": "data timeouts(ms) for $t data",
"category": "converter"
}
]
"name": "winst312",
"label": "130312 WTemp iid",
"type": "number",
"check": "checkMinMax",
"min": -1,
"max": 256,
"description": "the temp instance of PGN 130312 used for water temperature, use -1 for none, 256 for any",
"default": "256",
"category":"converter"
},
{
"name": "usbActisense",