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

add changed flag to BoatDataValue in API

This commit is contained in:
wellenvogel
2021-12-16 11:45:35 +01:00
parent c3482dbb3a
commit 20187fcb1d
3 changed files with 13 additions and 9 deletions

View File

@@ -412,12 +412,20 @@ public:
virtual void getBoatDataValues(int numValues,BoatValue **list){
for (int i=0;i<numValues;i++){
GwBoatItemBase *item=boatData.getBase(list[i]->getName());
list[i]->changed=false;
if (item){
list[i]->valid=item->isValid();
if (list[i]->valid) list[i]->value=item->getDoubleValue();
bool newValid=item->isValid();
if (newValid != list[i]->valid) list[i]->changed=true;
list[i]->valid=newValid;
if (newValid){
double newValue=item->getDoubleValue();
if (newValue != list[i]->value) list[i]->changed=true;
list[i]->value=newValue;
}
list[i]->setFormat(item->getFormat());
}
else{
if (list[i]->valid) list[i]->changed=true;
list[i]->valid=false;
}
}