@@ -153,7 +153,8 @@ void somfy_frame_t::decodeFrame(byte* frame) {
153153 this ->checksum = decoded[1 ] & 0b1111 ;
154154 this ->encKey = decoded[0 ];
155155 // Lets first determine the protocol.
156- this ->cmd = (somfy_commands)((decoded[1 ] >> 4 ));
156+ this ->rawCmd = decoded[1 ] >> 4 ;
157+ this ->cmd = (somfy_commands)(this ->rawCmd );
157158 if (this ->cmd == somfy_commands::RTWProto) {
158159 if (this ->encKey >= 160 ) {
159160 this ->proto = radio_proto::RTS;
@@ -165,7 +166,7 @@ void somfy_frame_t::decodeFrame(byte* frame) {
165166 }
166167 else if (this ->encKey >= 133 ) {
167168 this ->proto = radio_proto::RTW;
168- this ->cmd = this -> encKey == 133 ? somfy_commands::My : (somfy_commands)(this ->encKey - 133 );
169+ this ->cmd = (somfy_commands)(this ->encKey - 132 );
169170 }
170171 }
171172 else this ->proto = radio_proto::RTS;
@@ -4418,6 +4419,11 @@ bool Transceiver::receive(somfy_rx_t *rx) {
44184419 // Serial.printf("Processing receive %d\n", rx_queue.length);
44194420 rx_queue.pop (rx);
44204421 this ->frame .decodeFrame (rx);
4422+ if (this ->frame .valid ) {
4423+ ESP_LOGI (TAG, " RX ADDR:%d CMD:%s RAW_CMD:0x%X KEY:0x%02X PROTO:%u" ,
4424+ this ->frame .remoteAddress , translateSomfyCommand (this ->frame .cmd ).c_str (),
4425+ this ->frame .rawCmd , this ->frame .encKey , (uint8_t )this ->frame .proto );
4426+ }
44214427 this ->emitFrame (&this ->frame , rx);
44224428 return this ->frame .valid ;
44234429 }
@@ -4431,6 +4437,7 @@ void Transceiver::emitFrame(somfy_frame_t *frame, somfy_rx_t *rx) {
44314437 json->addElem (" address" , (uint32_t )frame->remoteAddress );
44324438 json->addElem (" rcode" , (uint32_t )frame->rollingCode );
44334439 json->addElem (" command" , translateSomfyCommand (frame->cmd ).c_str ());
4440+ json->addElem (" rawCmd" , frame->rawCmd );
44344441 json->addElem (" rssi" , (int32_t )frame->rssi );
44354442 json->addElem (" bits" , rx->bit_length );
44364443 json->addElem (" proto" , static_cast <uint8_t >(frame->proto ));
0 commit comments