1
0
mirror of https://github.com/thooge/esp32-nmea2000-obp60.git synced 2026-02-11 15:13:06 +01:00

avoid creating unmapped XDR entries for unset N2K values

This commit is contained in:
wellenvogel
2025-09-29 17:53:14 +02:00
parent c21592599f
commit 32862b9e29
4 changed files with 28 additions and 26 deletions

View File

@@ -431,7 +431,8 @@ GwXDRFoundMapping GwXDRMappings::getMapping(String xName,String xType,String xUn
}
return selectMapping(&(it->second),instance,n183Key.c_str());
}
GwXDRFoundMapping GwXDRMappings::getMapping(GwXDRCategory category,int selector,int field,int instance){
GwXDRFoundMapping GwXDRMappings::getMapping(double value,GwXDRCategory category,int selector,int field,int instance){
if (value == N2kDoubleNA) return GwXDRFoundMapping(); //do not add to unknown mappings
unsigned long n2kKey=GwXDRMappingDef::n2kKey(category,selector,field);
auto it=n2kMap.find(n2kKey);
if (it == n2kMap.end()){

View File

@@ -244,7 +244,7 @@ class GwXDRMappings{
//get the mappings
//the returned mapping will exactly contain one mapping def
GwXDRFoundMapping getMapping(String xName,String xType,String xUnit);
GwXDRFoundMapping getMapping(GwXDRCategory category,int selector,int field=0,int instance=-1);
GwXDRFoundMapping getMapping(double value,GwXDRCategory category,int selector,int field=0,int instance=-1);
String getXdrEntry(String mapping, double value,int instance=0);
const char * getUnMapped();
const GwXDRType * findType(const String &typeString, const String &unitString) const;