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); return(homeSpan.snapTime-updateTime);
} }

View File

@ -225,9 +225,9 @@ struct SpanCharacteristic{
SpanRange *range=NULL; // Characteristic min/max/step; NULL = default values (optional) SpanRange *range=NULL; // Characteristic min/max/step; NULL = default values (optional)
boolean *ev; // Characteristic Event Notify Enable (per-connection) boolean *ev; // Characteristic Event Notify Enable (per-connection)
uint32_t aid=0; // Accessory ID - passed through from Service containing this Characteristic 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 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 UVal newValue; // the updated value requested by PUT /characteristic
SpanService *service=NULL; // pointer to Service containing this 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 void setVal(double value); // sets value of UVal value for FLOAT Characteristic type
boolean updated(){return(isUpdated);} // returns isUpdated 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
}; };