mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2025-12-13 11:02:12 +01:00
Somfy: add Sun/Wind auto movement logic
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
This commit is contained in:
parent
48545310f8
commit
1be1fe4fba
1 changed files with 22 additions and 4 deletions
26
Somfy.cpp
26
Somfy.cpp
|
|
@ -1081,10 +1081,28 @@ void SomfyShade::processFrame(somfy_frame_t &frame, bool internal) {
|
|||
// will need to see what the shade does when you press both.
|
||||
switch(frame.cmd) {
|
||||
case somfy_commands::Sensor:
|
||||
if((frame.rollingCode << 4) & static_cast<uint8_t>(somfy_flags_t::Sunny)) this->flags |= static_cast<uint8_t>(somfy_flags_t::Sunny);
|
||||
else this->flags &= ~(static_cast<uint8_t>(somfy_flags_t::Sunny));
|
||||
if((frame.rollingCode << 4) & static_cast<uint8_t>(somfy_flags_t::Windy)) this->flags |= static_cast<uint8_t>(somfy_flags_t::Windy);
|
||||
else this->flags &= ~(static_cast<uint8_t>(somfy_flags_t::Windy));
|
||||
if ((frame.rollingCode << 4) & static_cast<uint8_t>(somfy_flags_t::Sunny))
|
||||
this->flags |= static_cast<uint8_t>(somfy_flags_t::Sunny);
|
||||
else
|
||||
this->flags &= ~(static_cast<uint8_t>(somfy_flags_t::Sunny));
|
||||
|
||||
if ((frame.rollingCode << 4) & static_cast<uint8_t>(somfy_flags_t::Windy))
|
||||
this->flags |= static_cast<uint8_t>(somfy_flags_t::Windy);
|
||||
else
|
||||
this->flags &= ~(static_cast<uint8_t>(somfy_flags_t::Windy));
|
||||
|
||||
if (this->flags & static_cast<uint8_t>(somfy_flags_t::Windy))
|
||||
{
|
||||
this->target = 0.0f;
|
||||
}
|
||||
else if (this->flags & static_cast<uint8_t>(somfy_flags_t::SunFlag))
|
||||
{
|
||||
if (this->flags & static_cast<uint8_t>(somfy_flags_t::Sunny))
|
||||
this->target = 100.0f;
|
||||
else
|
||||
this->target = 0.0f;
|
||||
}
|
||||
|
||||
this->emitState();
|
||||
break;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue