ShadeTypes.h
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #ifndef SHADE_TYPES_H | ||
| 2 | #define SHADE_TYPES_H | ||
| 3 | #include <Arduino.h> | ||
| 4 | |||
| 5 | // The kinds of shade, tilt and group, and how many of each the shade model | ||
| 6 | // holds. Kept free of the shade model so the shade maths can use them in the | ||
| 7 | // unit tests on the PC (pio test -e native). | ||
| 8 | |||
| 9 | #define SOMFY_MAX_SHADES 32 | ||
| 10 | #define SOMFY_MAX_GROUPS 16 | ||
| 11 | #define SOMFY_MAX_LINKED_REMOTES 7 | ||
| 12 | #define SOMFY_MAX_GROUPED_SHADES 32 | ||
| 13 | #define SOMFY_MAX_ROOMS 16 | ||
| 14 | #define SOMFY_MAX_REPEATERS 7 | ||
| 15 | |||
| 16 | enum class group_types : byte { | ||
| 17 | channel = 0x00 | ||
| 18 | }; | ||
| 19 | enum class shade_types : byte { | ||
| 20 | roller = 0x00, | ||
| 21 | blind = 0x01, | ||
| 22 | ldrapery = 0x02, | ||
| 23 | awning = 0x03, | ||
| 24 | shutter = 0x04, | ||
| 25 | garage1 = 0x05, | ||
| 26 | garage3 = 0x06, | ||
| 27 | rdrapery = 0x07, | ||
| 28 | cdrapery = 0x08, | ||
| 29 | drycontact = 0x09, | ||
| 30 | drycontact2 = 0x0A, | ||
| 31 | lgate = 0x0B, | ||
| 32 | cgate = 0x0C, | ||
| 33 | rgate = 0x0D, | ||
| 34 | lgate1 = 0x0E, | ||
| 35 | cgate1 = 0x0F, | ||
| 36 | rgate1 = 0x10 | ||
| 37 | }; | ||
| 38 | // A garage door or gate worked with one button: each press moves, stops or | ||
| 39 | // reverses it, so it can't be sent to a position. | ||
| 40 | 71 | inline bool isToggleShade(shade_types type) { | |
| 41 | 71 | switch(type) { | |
| 42 | 2 | case shade_types::garage1: | |
| 43 | case shade_types::lgate1: | ||
| 44 | case shade_types::cgate1: | ||
| 45 | case shade_types::rgate1: | ||
| 46 | 2 | return true; | |
| 47 | 69 | default: | |
| 48 | 69 | return false; | |
| 49 | } | ||
| 50 | } | ||
| 51 | // The bits of a shade's or group's flags. | ||
| 52 | enum class somfy_flags_t : byte { | ||
| 53 | SunFlag = 0x01, | ||
| 54 | SunSensor = 0x02, | ||
| 55 | DemoMode = 0x04, | ||
| 56 | Light = 0x08, | ||
| 57 | Windy = 0x10, | ||
| 58 | Sunny = 0x20, | ||
| 59 | Lighted = 0x40, | ||
| 60 | SimMy = 0x80 | ||
| 61 | }; | ||
| 62 | enum class tilt_types : byte { | ||
| 63 | none = 0x00, | ||
| 64 | tiltmotor = 0x01, | ||
| 65 | integrated = 0x02, | ||
| 66 | tiltonly = 0x03, | ||
| 67 | euromode = 0x04 | ||
| 68 | }; | ||
| 69 | #endif | ||
| 70 |