Fixed problem with timeVal() function

had forgotten to initialize updateTime to zero at startup (how did this ever work?)
This commit is contained in:
Gregg 2020-12-12 18:34:39 -06:00
parent 58d0177df2
commit a9bc186a90
2 changed files with 4 additions and 4 deletions

View File

@ -1556,7 +1556,7 @@ void SpanCharacteristic::setVal(double val){
///////////////////////////////
int SpanCharacteristic::timeVal(){
unsigned long SpanCharacteristic::timeVal(){
return(homeSpan.snapTime-updateTime);
}

View File

@ -227,7 +227,7 @@ struct SpanCharacteristic{
uint32_t aid=0; // Accessory ID - passed through from Service containing this Characteristic
boolean isUpdated=false; // set to true when new value has been requested by PUT /characteristic
unsigned long updateTime; // last time value was updated (in millis) either by PUT /characteristic OR by setVal()
unsigned long updateTime=0; // last time value was updated (in millis) either by PUT /characteristic OR by setVal()
UVal newValue; // the updated value requested by PUT /characteristic
SpanService *service=NULL; // pointer to Service containing this Characteristic
@ -252,7 +252,7 @@ struct SpanCharacteristic{
void setVal(double value); // sets value of UVal value for FLOAT Characteristic type
boolean updated(){return(isUpdated);} // returns isUpdated
int timeVal(); // returns time elapsed (in millis) since value was last updated
unsigned long timeVal(); // returns time elapsed (in millis) since value was last updated
};