Skip to content

Commit 6de046a

Browse files
authored
Merge branch 'master' into add_presets_to_Sdk
2 parents 7a4f4fd + 77824ed commit 6de046a

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

src/app/clusters/level-control/level-control.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ static void reallyUpdateCoupledColorTemp(EndpointId endpoint)
369369
/*
370370
* @brief
371371
* This function is used to update the current level attribute
372-
* while respecting it's defined quiet reporting quality:
372+
* while respecting its defined quiet reporting quality:
373373
* The attribute will be reported:
374374
* - At most once per second, or
375375
* - At the start of the movement/transition, or
@@ -386,8 +386,7 @@ static Status SetCurrentLevelQuietReport(EndpointId endpoint, EmberAfLevelContro
386386
DataModel::Nullable<uint8_t> newValue, bool isStartOrEndOfTransition)
387387
{
388388
AttributeDirtyState dirtyState;
389-
MarkAttributeDirty markDirty = MarkAttributeDirty::kNo;
390-
auto now = System::SystemClock().GetMonotonicTimestamp();
389+
auto now = System::SystemClock().GetMonotonicTimestamp();
391390

392391
if (isStartOrEndOfTransition)
393392
{
@@ -406,9 +405,10 @@ static Status SetCurrentLevelQuietReport(EndpointId endpoint, EmberAfLevelContro
406405
dirtyState = state->quietCurrentLevel.SetValue(newValue, now, predicate);
407406
}
408407

408+
MarkAttributeDirty markDirty = MarkAttributeDirty::kNo;
409409
if (dirtyState == AttributeDirtyState::kMustReport)
410410
{
411-
markDirty = MarkAttributeDirty::kIfChanged;
411+
markDirty = MarkAttributeDirty::kYes;
412412
}
413413
return Attributes::CurrentLevel::Set(endpoint, state->quietCurrentLevel.value(), markDirty);
414414
}
@@ -542,7 +542,7 @@ static void writeRemainingTime(EndpointId endpoint, uint16_t remainingTimeMs)
542542
// - kMarkDirtyOnIncrement : When the value increases.
543543
if (state->quietRemainingTime.SetValue(remainingTimeDs, now) == AttributeDirtyState::kMustReport)
544544
{
545-
markDirty = MarkAttributeDirty::kIfChanged;
545+
markDirty = MarkAttributeDirty::kYes;
546546
}
547547

548548
Attributes::RemainingTime::Set(endpoint, state->quietRemainingTime.value().ValueOr(0), markDirty);

src/app/util/af-types.h

+5
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,11 @@ enum class MarkAttributeDirty
307307
{
308308
kIfChanged,
309309
kNo,
310+
// kYes might need to be used if the attribute value was previously changed
311+
// without reporting, and now is being set in a situation where we know
312+
// reporting needs to be triggered (e.g. because QuieterReportingAttribute
313+
// indicated that).
314+
kYes,
310315
};
311316

312317
} // namespace app

src/app/util/attribute-table.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,12 @@ Status emAfWriteAttribute(EndpointId endpoint, ClusterId cluster, AttributeId at
408408

409409
if (!valueChanging)
410410
{
411-
// Just do nothing.
411+
// Just do nothing, except triggering reporting if forced.
412+
if (markDirty == MarkAttributeDirty::kYes)
413+
{
414+
MatterReportingAttributeChangeCallback(endpoint, cluster, attributeID);
415+
}
416+
412417
return Status::Success;
413418
}
414419

0 commit comments

Comments
 (0)