Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ See the examples for basic usage options
- change default PID_MAX_APDU_LENGTH_ROUTER from 220 to 254
- fix broken ConfigReq Responses
- fix programming application when FlashTablesInvalid for 0x091A
- add GroupObject::valueCompareTime() to send a GroupObject only when value changed or after some time without sending

### v2.3.1 - 2026-03-04

Expand Down
17 changes: 17 additions & 0 deletions src/knx/group_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,4 +349,21 @@ bool GroupObject::valueCompare(const KNXValue& value, const Dpt& type)
return true;
}
return false;
}

bool GroupObject::valueCompareTime(const KNXValue& value, const Dpt& type, uint32_t& lastTime, const uint32_t time)
{
if (valueNoSendCompare(value, type))
{
objectWritten();
lastTime = millis();
return true;
}
else if(millis() - lastTime >= time)
{
objectWritten();
lastTime = millis();
return true;
}
return false;
}
15 changes: 15 additions & 0 deletions src/knx/group_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,21 @@ class GroupObject
*/
bool valueCompare(const KNXValue& value, const Dpt& type);


/**
* Check if the value (after conversion to dpt) will differ from current value of the group object and send only when the value differs or the time since last sending exceeds a threshold.
* Use this method only, when the value should not be sent if it was not changed, otherwise value(const KNXValue&, const Dpt&) will do the same (without overhead for comparing)
* @param value the value the group object is set to
* @param type the datapoint type used for the conversion.
* @param lastTime the variable where the last sending time of this KO can be stored, will be passed as reference
* @param time the threshold in milliseconds used to calculate if group object is sent regardless if the value differs
*
* The parameters must fit the group object. Otherwise it will stay unchanged.
*
* @returns true if the value of the group object has been sent, false if not or conversion failed.
*/
bool valueCompareTime(const KNXValue& value, const Dpt& type, uint32_t& lastTime, const uint32_t time);

/**
* set the current value of the group object and show success.
* @param value the value the group object is set to
Expand Down
Loading