From 0eb0e63631b4d6a1d2a1178aca6c8883ac2cad38 Mon Sep 17 00:00:00 2001 From: cjkas Date: Tue, 13 Oct 2026 21:08:53 +0200 Subject: [PATCH] refactor: move the shade type enums into ShadeTypes.h group_types, shade_types and tilt_types move out of Somfy.h unchanged into a header without the shade model, so the shade maths in ShadeMotion and the sun and wind rules can use tilt_types in the native tests. Co-Authored-By: Claude Opus 5.5 --- src/ShadeTypes.h | 37 +++++++++++++++++++++++++++++++++++++ src/Somfy.h | 30 +----------------------------- 2 files changed, 38 insertions(+), 29 deletions(-) create mode 100644 src/ShadeTypes.h diff --git a/src/ShadeTypes.h b/src/ShadeTypes.h new file mode 100644 index 0000000..60a8930 --- /dev/null +++ b/src/ShadeTypes.h @@ -0,0 +1,37 @@ +#ifndef SHADE_TYPES_H +#define SHADE_TYPES_H +#include + +// The kinds of shade, tilt and group. Kept free of the shade model so the +// shade maths can use them in the unit tests on the PC (pio test -e native). + +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 +}; +enum class tilt_types : byte { + none = 0x00, + tiltmotor = 0x01, + integrated = 0x02, + tiltonly = 0x03, + euromode = 0x04 +}; +#endif diff --git a/src/Somfy.h b/src/Somfy.h index fe8c895..793d61c 100644 --- a/src/Somfy.h +++ b/src/Somfy.h @@ -25,37 +25,9 @@ #include "SomfyFrame.h" #include "TxBuffer.h" #include "RadioScheduler.h" +#include "ShadeTypes.h" #include "ShadeMotion.h" #include "Transceiver.h" -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 -}; -enum class tilt_types : byte { - none = 0x00, - tiltmotor = 0x01, - integrated = 0x02, - tiltonly = 0x03, - euromode = 0x04 -}; enum class somfy_flags_t : byte { SunFlag = 0x01,