diff --git a/src/ArduinoIoTCloud.cpp b/src/ArduinoIoTCloud.cpp index 92c8557fd..ee45521a6 100644 --- a/src/ArduinoIoTCloud.cpp +++ b/src/ArduinoIoTCloud.cpp @@ -64,7 +64,7 @@ void ArduinoIoTCloudClass::addPropertyReal(Property& property, String name, int } if (seconds == ON_CHANGE) { - addPropertyToContainer(_property_container, property, name, permission, tag).publishOnChange(minDelta, DEFAULT_MIN_TIME_BETWEEN_UPDATES_MILLIS).onUpdate(fn).onSync(synFn); + addPropertyToContainer(_property_container, property, name, permission, tag).publishOnChange(minDelta, Property::DEFAULT_MIN_TIME_BETWEEN_UPDATES_MILLIS).onUpdate(fn).onSync(synFn); } else { addPropertyToContainer(_property_container, property, name, permission, tag).publishEvery(seconds).onUpdate(fn).onSync(synFn); } diff --git a/src/ArduinoIoTCloud.h b/src/ArduinoIoTCloud.h index 23e3b3a80..c15bc50dd 100644 --- a/src/ArduinoIoTCloud.h +++ b/src/ArduinoIoTCloud.h @@ -101,8 +101,6 @@ class ArduinoIoTCloudClass #define addProperty( v, ...) addPropertyReal(v, #v, __VA_ARGS__) - static unsigned long const DEFAULT_MIN_TIME_BETWEEN_UPDATES_MILLIS = 500; /* Data rate throttled to 2 Hz */ - /* The following methods are used for non-LoRa boards which can use the * name of the property to identify a given property within a CBOR message. */ diff --git a/src/property/Property.cpp b/src/property/Property.cpp index f5e187946..062e352fe 100644 --- a/src/property/Property.cpp +++ b/src/property/Property.cpp @@ -29,25 +29,26 @@ CTOR/DTOR ******************************************************************************/ Property::Property() - : _name(""), - _min_delta_property(0.0f), - _min_time_between_updates_millis(0), - _permission(Permission::Read), - _get_time_func{nullptr}, - _update_callback_func(nullptr), - _sync_callback_func(nullptr), - _has_been_updated_once(false), - _has_been_modified_in_callback(false), - _last_updated_millis(0), - _update_interval_millis(0), - _last_local_change_timestamp(0), - _last_cloud_change_timestamp(0), - _identifier(0), - _attributeIdentifier(0), - _lightPayload(false), - _update_requested(false), - _encode_timestamp(false), - _timestamp(0) +: _name{""} +, _min_delta_property{0.0f} +, _min_time_between_updates_millis{DEFAULT_MIN_TIME_BETWEEN_UPDATES_MILLIS} +, _permission{Permission::Read} +, _get_time_func{nullptr} +, _update_callback_func{nullptr} +, _sync_callback_func{nullptr} +, _update_policy{UpdatePolicy::OnChange} +, _has_been_updated_once{false} +, _has_been_modified_in_callback{false} +, _last_updated_millis{0} +, _update_interval_millis{0} +, _last_local_change_timestamp{0} +, _last_cloud_change_timestamp{0} +, _identifier{0} +, _attributeIdentifier{0} +, _lightPayload{false} +, _update_requested{false} +, _encode_timestamp{false} +, _timestamp{0} { } diff --git a/src/property/Property.h b/src/property/Property.h index fa4423d3f..48fe45357 100644 --- a/src/property/Property.h +++ b/src/property/Property.h @@ -188,6 +188,9 @@ class Property { virtual bool isPrimitive() { return false; }; + + static unsigned long const DEFAULT_MIN_TIME_BETWEEN_UPDATES_MILLIS = 500; /* Data rate throttled to 2 Hz */ + protected: /* Variables used for UpdatePolicy::OnChange */ String _name;