1
0
mirror of https://github.com/thooge/esp32-nmea2000-obp60.git synced 2025-12-16 07:23:07 +01:00

add new function getBoatDataValues to api for easier access

This commit is contained in:
wellenvogel
2021-12-03 17:00:51 +01:00
parent b4b08fa12d
commit 04d90447e8
7 changed files with 106 additions and 7 deletions

View File

@@ -329,6 +329,17 @@ String GwBoatData::toString(){
}
return rt;
}
bool GwBoatData::isValid(String name){
auto it=values.find(name);
if (it == values.end()) return false;
return it->second->isValid();
}
double GwBoatData::getDoubleValue(String name,double defaultv){
auto it=values.find(name);
if (it == values.end()) return defaultv;
if (! it->second->isValid()) return defaultv;
return it->second->getDoubleValue();
}
double formatCourse(double cv)
{
double rt = cv * 180.0 / M_PI;