diff --git a/data-src/index.html b/data-src/index.html index 3875bb35..e64b0e69 100644 --- a/data-src/index.html +++ b/data-src/index.html @@ -992,7 +992,7 @@

-
KeyAddressCommandCodeRSSIBitsTime
+
KeyAddressCommandCodeRSSIBitsTimeRaw
diff --git a/data-src/index.js b/data-src/index.js index 19518632..69dcb70d 100644 --- a/data-src/index.js +++ b/data-src/index.js @@ -2934,7 +2934,8 @@ class Somfy { proto = '-V'; break; } - let html = `${frame.encKey}${frame.address}${frame.command}${frame.stepSize ? frame.stepSize : ''}${frame.rcode}${frame.rssi}dBm${frame.bits}${proto}${fnFmtTime(frame.time)}
`; + let rawCmdHex = (typeof frame.rawCmd === 'number') ? `0x${frame.rawCmd.toString(16).toUpperCase()}` : ''; + let html = `${frame.encKey}${frame.address}${frame.command}${frame.stepSize ? frame.stepSize : ''}${frame.rcode}${frame.rssi}dBm${frame.bits}${proto}${fnFmtTime(frame.time)}${rawCmdHex}
`; for (let i = 0; i < frame.pulses.length; i++) { if (i !== 0) html += ','; html += `${frame.pulses[i]}`; diff --git a/data-src/main.css b/data-src/main.css index f84458df..25d716b8 100644 --- a/data-src/main.css +++ b/data-src/main.css @@ -832,6 +832,11 @@ div.frame-header > span { text-align: right; white-space:nowrap; } + div.frame-row > span:nth-child(8), + div.frame-header > span:nth-child(8) { + width: 40px; + text-align: center; + } div.frame-list > div:nth-child(2n+1) { background: beige; diff --git a/src/Somfy.cpp b/src/Somfy.cpp index 04665207..70ba1791 100644 --- a/src/Somfy.cpp +++ b/src/Somfy.cpp @@ -153,7 +153,8 @@ void somfy_frame_t::decodeFrame(byte* frame) { this->checksum = decoded[1] & 0b1111; this->encKey = decoded[0]; // Lets first determine the protocol. - this->cmd = (somfy_commands)((decoded[1] >> 4)); + this->rawCmd = decoded[1] >> 4; + this->cmd = (somfy_commands)(this->rawCmd); if(this->cmd == somfy_commands::RTWProto) { if(this->encKey >= 160) { this->proto = radio_proto::RTS; @@ -165,7 +166,7 @@ void somfy_frame_t::decodeFrame(byte* frame) { } else if(this->encKey >= 133) { this->proto = radio_proto::RTW; - this->cmd = this->encKey == 133 ? somfy_commands::My : (somfy_commands)(this->encKey - 133); + this->cmd = (somfy_commands)(this->encKey - 132); } } else this->proto = radio_proto::RTS; @@ -4418,6 +4419,11 @@ bool Transceiver::receive(somfy_rx_t *rx) { //Serial.printf("Processing receive %d\n", rx_queue.length); rx_queue.pop(rx); this->frame.decodeFrame(rx); + if(this->frame.valid) { + ESP_LOGI(TAG, "RX ADDR:%d CMD:%s RAW_CMD:0x%X KEY:0x%02X PROTO:%u", + this->frame.remoteAddress, translateSomfyCommand(this->frame.cmd).c_str(), + this->frame.rawCmd, this->frame.encKey, (uint8_t)this->frame.proto); + } this->emitFrame(&this->frame, rx); return this->frame.valid; } @@ -4431,6 +4437,7 @@ void Transceiver::emitFrame(somfy_frame_t *frame, somfy_rx_t *rx) { json->addElem("address", (uint32_t)frame->remoteAddress); json->addElem("rcode", (uint32_t)frame->rollingCode); json->addElem("command", translateSomfyCommand(frame->cmd).c_str()); + json->addElem("rawCmd", frame->rawCmd); json->addElem("rssi", (int32_t)frame->rssi); json->addElem("bits", rx->bit_length); json->addElem("proto", static_cast(frame->proto)); diff --git a/src/Somfy.h b/src/Somfy.h index 6630db68..b70163e7 100644 --- a/src/Somfy.h +++ b/src/Somfy.h @@ -189,6 +189,7 @@ struct somfy_frame_t { uint8_t bitLength = 56; uint16_t pulseCount = 0; uint8_t stepSize = 0; + uint8_t rawCmd = 0; void print(); void encode80BitFrame(byte *frame, uint8_t repeat); byte calc80Checksum(byte b0, byte b1, byte b2);