ESPSomfy-RTS/src/ShadeTypes.h
cjkas 4f8eac03ac refactor: move the shade's behaviour into ShadeBehaviour
PR B of SHADE_BEHAVIOUR_PLAN.md. What a shade does with frames, commands,
group commands and radio events moves unchanged from SomfyShade into
ShadeBehaviour, which builds natively and is pinned by test_shadebehaviour.

ShadeBehaviour reads ShadeSettings and RemoteSettings, gets the time on
every input, and holds the motion state that other files now read through
state(). It sends through MotorLink and reports through ShadeEvents
(changes, commands, save wanted, sensor flags) as things happen.
SomfyShade wraps it: its MotorLink is SomfyRemote::sendCommandAfter, which
now leaves the sender out of the echo and radio hold because the module
hears its own frame. lastFrame stays shared with the send path.

ConfigFile writes through restore() and clearTilt(), SomfyShadeOps through
setPosition(). The pinning tests label where the copies of a rule disagree
"today:", for the reconcile phase.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 21:21:38 +02:00

69 lines
1.5 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
};
// A garage door or gate worked with one button: each press moves, stops or
// reverses it, so it can't be sent to a position.
inline bool isToggleShade(shade_types type) {
switch(type) {
case shade_types::garage1:
case shade_types::lgate1:
case shade_types::cgate1:
case shade_types::rgate1:
return true;
default:
return false;
}
}
// 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