mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2025-12-15 20:02:13 +01:00
Somfy: add Sun status command
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
This commit is contained in:
parent
f632dc9c54
commit
8ed5346992
2 changed files with 14 additions and 2 deletions
|
|
@ -91,6 +91,8 @@ String translateSomfyCommand(const somfy_commands cmd) {
|
||||||
return "Step Up";
|
return "Step Up";
|
||||||
case somfy_commands::StepDown:
|
case somfy_commands::StepDown:
|
||||||
return "Step Down";
|
return "Step Down";
|
||||||
|
case somfy_commands::Status:
|
||||||
|
return "Status";
|
||||||
default:
|
default:
|
||||||
return "Unknown(" + String((uint8_t)cmd) + ")";
|
return "Unknown(" + String((uint8_t)cmd) + ")";
|
||||||
}
|
}
|
||||||
|
|
@ -173,9 +175,12 @@ void somfy_frame_t::decodeFrame(byte* frame) {
|
||||||
case somfy_commands::SunFlag:
|
case somfy_commands::SunFlag:
|
||||||
case somfy_commands::Flag:
|
case somfy_commands::Flag:
|
||||||
break;
|
break;
|
||||||
|
case somfy_commands::Status:
|
||||||
|
this->rollingCode = 0;
|
||||||
|
this->sun = !!(decoded[3] & STATUS_SUN);
|
||||||
|
break;
|
||||||
case somfy_commands::UnknownC:
|
case somfy_commands::UnknownC:
|
||||||
case somfy_commands::UnknownD:
|
case somfy_commands::UnknownD:
|
||||||
case somfy_commands::UnknownE:
|
|
||||||
case somfy_commands::RTWProto:
|
case somfy_commands::RTWProto:
|
||||||
this->valid = false;
|
this->valid = false;
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
9
Somfy.h
9
Somfy.h
|
|
@ -28,7 +28,7 @@ enum class somfy_commands : byte {
|
||||||
StepDown = 0xB,
|
StepDown = 0xB,
|
||||||
UnknownC = 0xC,
|
UnknownC = 0xC,
|
||||||
UnknownD = 0xD,
|
UnknownD = 0xD,
|
||||||
UnknownE = 0xE, // This command byte has been witnessed in the wild but cannot tell if it is from Somfy. No rolling code is sent with this and it is 56-bits.
|
Status = 0xE,
|
||||||
RTWProto = 0xF, // RTW Protocol
|
RTWProto = 0xF, // RTW Protocol
|
||||||
// Command extensions for 80 bit frames
|
// Command extensions for 80 bit frames
|
||||||
StepUp = 0x8B
|
StepUp = 0x8B
|
||||||
|
|
@ -52,6 +52,12 @@ somfy_commands translateSomfyCommand(const String& string);
|
||||||
#define MAX_RX_BUFFER 3
|
#define MAX_RX_BUFFER 3
|
||||||
#define MAX_TX_BUFFER 3
|
#define MAX_TX_BUFFER 3
|
||||||
|
|
||||||
|
#if !defined(BIT)
|
||||||
|
#define BIT(x) (1 << (x))
|
||||||
|
#endif /* BIT */
|
||||||
|
|
||||||
|
#define STATUS_SUN BIT(1)
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
waiting_synchro = 0,
|
waiting_synchro = 0,
|
||||||
receiving_data = 1,
|
receiving_data = 1,
|
||||||
|
|
@ -110,6 +116,7 @@ typedef struct somfy_frame_t {
|
||||||
uint32_t await = 0;
|
uint32_t await = 0;
|
||||||
uint8_t bitLength = 56;
|
uint8_t bitLength = 56;
|
||||||
uint16_t pulseCount = 0;
|
uint16_t pulseCount = 0;
|
||||||
|
bool sun = false;
|
||||||
void print();
|
void print();
|
||||||
void encodeFrame(byte *frame);
|
void encodeFrame(byte *frame);
|
||||||
void decodeFrame(byte* frame);
|
void decodeFrame(byte* frame);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue