mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2026-10-31 22:02:17 +01:00
fix: update every group's flags after a group's sun flag command
A SunFlag or Flag frame makes every group work its flags out again, but the same command from a group only updated that group, so other groups holding the shade kept stale sun flags. The group rule now reports the sensor flags as the frame rule does. Reconcile Q20 in SHADE_BEHAVIOUR_PLAN.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
2cf3c4b542
commit
4eff50645d
3 changed files with 9 additions and 4 deletions
|
|
@ -89,7 +89,7 @@ The decisions are the user's. Each question comes with a recommended answer, and
|
|||
- Up and My on tilt-only shades differ between the web, a remote and a group (`test_today_up_on_tilt_only_*`, `test_today_my_while_tilt_only_moves`).
|
||||
- An integrated tilt sent to a lift target without a tilt turns its slats back with an Up after the stop (`test_today_integrated_tilt_turns_back_after_a_lift_target`).
|
||||
- ~~A remote step uses the step size this shade last *sent*.~~ Fixed (Q19).
|
||||
- A group's SunFlag or Flag doesn't make other groups work their flags out again (`test_group_sun_flag_needs_a_sensor`).
|
||||
- ~~A group's SunFlag or Flag doesn't make other groups work their flags out again.~~ Fixed (Q20).
|
||||
- The self-echo (Q5) and merging group commands into the frame rule (Q8).
|
||||
- `lastFrame` doing two jobs (the Q6 revisit).
|
||||
- The 500 ms long-press deadline is compared as `now > await`, which isn't wrap-safe (not tested).
|
||||
|
|
|
|||
|
|
@ -786,6 +786,8 @@ void ShadeBehaviour::onGroupCommand(somfy_commands cmd, uint8_t repeat, uint32_t
|
|||
break;
|
||||
case somfy_commands::Flag:
|
||||
this->p_sunFlag(false);
|
||||
// Every group works its flags out again, as for a Flag frame.
|
||||
this->events.onSensorFlags();
|
||||
if(this->settings.sunSensor) {
|
||||
this->events.onSaveWanted();
|
||||
this->emitState();
|
||||
|
|
@ -803,6 +805,7 @@ void ShadeBehaviour::onGroupCommand(somfy_commands cmd, uint8_t repeat, uint32_t
|
|||
this->applySensorMove(this->sensors.onSunFlag(isSunny, isWindy));
|
||||
this->events.onSaveWanted();
|
||||
this->emitState();
|
||||
this->events.onSensorFlags();
|
||||
}
|
||||
else
|
||||
ESP_LOGW(TAG, "Shade does not have sensor %d", joinShadeFlags(this->settings, false, this->s.stateFlags));
|
||||
|
|
|
|||
|
|
@ -522,9 +522,11 @@ static void test_group_sun_flag_needs_a_sensor() {
|
|||
r.b.onGroupCommand(somfy_commands::SunFlag, 1, r.now);
|
||||
TEST_ASSERT_TRUE(r.st().stateFlags & static_cast<uint8_t>(somfy_flags_t::SunFlag));
|
||||
TEST_ASSERT_EQUAL(1, r.events.saves);
|
||||
// today: unlike the frame rule, the group rule doesn't ask for the group
|
||||
// flags to be worked out again; SomfyGroup does that for its own group.
|
||||
TEST_ASSERT_EQUAL(0, r.events.sensorFlags);
|
||||
// As for a frame, every group works its flags out again.
|
||||
TEST_ASSERT_EQUAL(1, r.events.sensorFlags);
|
||||
r.b.onGroupCommand(somfy_commands::Flag, 1, r.now);
|
||||
TEST_ASSERT_FALSE(r.st().stateFlags & static_cast<uint8_t>(somfy_flags_t::SunFlag));
|
||||
TEST_ASSERT_EQUAL(2, r.events.sensorFlags);
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue