mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2026-10-31 22:02:17 +01:00
The p_* setters and emitState() no longer publish or emit straight away:
they set SHADE_CHANGED_* / GROUP_CHANGED_* bits on the shade or group.
At the end of every loop() pass SomfyShadeController::sendChanges()
publishes the MQTT topics whose bits are set and sends one shadeState or
groupState, then clears the bits. emitState(evt) with an event name and
emitState(num) for one client still go out at once.
publishShadeTopics() (ShadeChanges.cpp, tested natively) writes the topics
from a shade snapshot; publishState() on connect uses it too. That fixes
MQTT position and target, a constant 50 since c94819e, and direction, a
constant 0 on connect. position and tiltPosition are now retained when
they change, as they were on connect, and a group whose flags change sends
one groupState instead of two. somfy_flags_t moves to ShadeTypes.h.
8 new native tests, 327 in all. Flash: esp32devdbg +196 bytes, esp32dev
+228 bytes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
56 lines
1.2 KiB
C
56 lines
1.2 KiB
C
#ifndef SHADE_TYPES_H
|
|
#define SHADE_TYPES_H
|
|
#include <Arduino.h>
|
|
|
|
// The kinds of shade, tilt and group, and how many of each the shade model
|
|
// holds. Kept free of the shade model so the shade maths can use them in the
|
|
// unit tests on the PC (pio test -e native).
|
|
|
|
#define SOMFY_MAX_SHADES 32
|
|
#define SOMFY_MAX_GROUPS 16
|
|
#define SOMFY_MAX_LINKED_REMOTES 7
|
|
#define SOMFY_MAX_GROUPED_SHADES 32
|
|
#define SOMFY_MAX_ROOMS 16
|
|
#define SOMFY_MAX_REPEATERS 7
|
|
|
|
enum class group_types : byte {
|
|
channel = 0x00
|
|
};
|
|
enum class shade_types : byte {
|
|
roller = 0x00,
|
|
blind = 0x01,
|
|
ldrapery = 0x02,
|
|
awning = 0x03,
|
|
shutter = 0x04,
|
|
garage1 = 0x05,
|
|
garage3 = 0x06,
|
|
rdrapery = 0x07,
|
|
cdrapery = 0x08,
|
|
drycontact = 0x09,
|
|
drycontact2 = 0x0A,
|
|
lgate = 0x0B,
|
|
cgate = 0x0C,
|
|
rgate = 0x0D,
|
|
lgate1 = 0x0E,
|
|
cgate1 = 0x0F,
|
|
rgate1 = 0x10
|
|
};
|
|
// The bits of a shade's or group's flags.
|
|
enum class somfy_flags_t : byte {
|
|
SunFlag = 0x01,
|
|
SunSensor = 0x02,
|
|
DemoMode = 0x04,
|
|
Light = 0x08,
|
|
Windy = 0x10,
|
|
Sunny = 0x20,
|
|
Lighted = 0x40,
|
|
SimMy = 0x80
|
|
};
|
|
enum class tilt_types : byte {
|
|
none = 0x00,
|
|
tiltmotor = 0x01,
|
|
integrated = 0x02,
|
|
tiltonly = 0x03,
|
|
euromode = 0x04
|
|
};
|
|
#endif
|