Closed gigs2go closed 4 years ago
The current default values (in Thing.h) for minimum and maximum are :
double minimum = 0; double maximum = -1;
In order to check a new value is in range, I put (in ESPWebThingAdapter::setThingProperty):
ESPWebThingAdapter::setThingProperty
case NUMBER: { ThingPropertyValue value; value.number = newValue.as<double>(); // Added to account for min/max range - just ignores invalid values if ( value.number >= property->minimum && value.number <= property->maximum ) { property->setValue(value); } break; }
I believe the default values for min/max should be :
double minimum = -DBL_MAX; double maximum = DBL_MAX;
so the above logic will work even if the values are not set explicitly.
It seems like the code which uses the library should be the one validating the value before setting it, since it is also that code which is defining the min/max.
The current default values (in Thing.h) for minimum and maximum are :
In order to check a new value is in range, I put (in
ESPWebThingAdapter::setThingProperty
):I believe the default values for min/max should be :
so the above logic will work even if the values are not set explicitly.