mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2025-12-15 20:02:13 +01:00
Somfy: improve status
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
This commit is contained in:
parent
8ed5346992
commit
17102a1a7d
2 changed files with 7 additions and 8 deletions
|
|
@ -177,7 +177,7 @@ void somfy_frame_t::decodeFrame(byte* frame) {
|
||||||
break;
|
break;
|
||||||
case somfy_commands::Status:
|
case somfy_commands::Status:
|
||||||
this->rollingCode = 0;
|
this->rollingCode = 0;
|
||||||
this->sun = !!(decoded[3] & STATUS_SUN);
|
this->status = decoded[3];
|
||||||
break;
|
break;
|
||||||
case somfy_commands::UnknownC:
|
case somfy_commands::UnknownC:
|
||||||
case somfy_commands::UnknownD:
|
case somfy_commands::UnknownD:
|
||||||
|
|
|
||||||
13
Somfy.h
13
Somfy.h
|
|
@ -52,12 +52,6 @@ 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,
|
||||||
|
|
@ -100,6 +94,11 @@ typedef struct somfy_tx_queue_t {
|
||||||
bool pop(somfy_tx_t *tx);
|
bool pop(somfy_tx_t *tx);
|
||||||
bool push(uint32_t await, somfy_commands cmd, uint8_t repeats);
|
bool push(uint32_t await, somfy_commands cmd, uint8_t repeats);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
no_sun = 0,
|
||||||
|
sun = 2
|
||||||
|
} somfy_status_t;
|
||||||
typedef struct somfy_frame_t {
|
typedef struct somfy_frame_t {
|
||||||
bool valid = false;
|
bool valid = false;
|
||||||
bool processed = false;
|
bool processed = false;
|
||||||
|
|
@ -116,7 +115,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;
|
somfy_status_t status = no_sun;
|
||||||
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