1
0
mirror of https://github.com/thooge/esp32-nmea2000-obp60.git synced 2025-12-13 05:53:06 +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

@@ -88,8 +88,6 @@ void exampleTask(GwApi *api){
GwApi::BoatValue *latitude=new GwApi::BoatValue(F("Latitude"));
GwApi::BoatValue *testValue=new GwApi::BoatValue(boatItemName);
GwApi::BoatValue *valueList[]={longitude,latitude,testValue};
double lastTestValue=0;
bool lastTestValueValid=false;
while(true){
delay(1000);
/*
@@ -155,16 +153,13 @@ void exampleTask(GwApi *api){
}
}
if (testValue->valid){
if (! lastTestValueValid || lastTestValue != testValue->value){
if (testValue->changed){
LOG_DEBUG(GwLog::LOG,"%s new value %s",testValue->getName().c_str(),formatValue(testValue).c_str());
lastTestValueValid=true;
lastTestValue=testValue->value;
}
}
else{
if (lastTestValueValid){
if (testValue->changed){
LOG_DEBUG(GwLog::LOG,"%s now invalid",testValue->getName().c_str());
lastTestValueValid=false;
}
}