From f7f7c9e6ff6d9cca041cd16ace28ad7d1b3a91a6 Mon Sep 17 00:00:00 2001 From: Artem Sheremet Date: Thu, 21 May 2026 20:51:28 +0000 Subject: [PATCH] Print packet contents when receiving --- components/ratgdo/secplus2.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/components/ratgdo/secplus2.cpp b/components/ratgdo/secplus2.cpp index 8aaa14a..7788616 100644 --- a/components/ratgdo/secplus2.cpp +++ b/components/ratgdo/secplus2.cpp @@ -250,10 +250,10 @@ namespace secplus2 { data &= ~0xf000; // clear parity nibble if ((fixed & 0xFFFFFFFF) == this->client_id_) { // my commands - ESP_LOG1(TAG, "[%ld] received mine: rolling=%07" PRIx32 " fixed=%010" PRIx64 " data=%08" PRIx32, millis(), rolling, fixed, data); + ESP_LOGD(TAG, " mine: rolling=%07" PRIx32 " fixed=%010" PRIx64 " data=%08" PRIx32, rolling, fixed, data); return { }; } else { - ESP_LOG1(TAG, "[%ld] received rolling=%07" PRIx32 " fixed=%010" PRIx64 " data=%08" PRIx32, millis(), rolling, fixed, data); + ESP_LOGD(TAG, " rolling=%07" PRIx32 " fixed=%010" PRIx64 " data=%08" PRIx32, rolling, fixed, data); } CommandType cmd_type = to_CommandType(cmd, CommandType::UNKNOWN); @@ -261,15 +261,13 @@ namespace secplus2 { uint8_t byte1 = (data >> 16) & 0xff; uint8_t byte2 = (data >> 24) & 0xff; - ESP_LOG1(TAG, "cmd=%03x (%s) byte2=%02x byte1=%02x nibble=%01x", cmd, LOG_STR_ARG(CommandType_to_string(cmd_type)), byte2, byte1, nibble); + ESP_LOGD(TAG, " cmd=%03x (%s) byte2=%02x byte1=%02x nibble=%01x", cmd, LOG_STR_ARG(CommandType_to_string(cmd_type)), byte2, byte1, nibble); return Command { cmd_type, nibble, byte1, byte2 }; } void Secplus2::handle_command(const Command& cmd) { - ESP_LOG1(TAG, "Handle command: %s", LOG_STR_ARG(CommandType_to_string(cmd.type))); - if (cmd.type == CommandType::STATUS) { this->ratgdo_->received(to_DoorState(cmd.nibble, DoorState::UNKNOWN)); @@ -280,8 +278,6 @@ namespace secplus2 { } else if (cmd.type == CommandType::OPENINGS) { this->ratgdo_->received(Openings { static_cast((cmd.byte1 << 8) | cmd.byte2), cmd.nibble }); } - - ESP_LOG1(TAG, "Done handle command: %s", LOG_STR_ARG(CommandType_to_string(cmd.type))); } void Secplus2::send_command(Command command, IncrementRollingCode increment) @@ -315,7 +311,7 @@ namespace secplus2 { uint64_t fixed = ((cmd & ~0xff) << 24) | this->client_id_; uint32_t data = (static_cast(command.byte2) << 24) | (static_cast(command.byte1) << 16) | (static_cast(command.nibble) << 8) | (cmd & 0xff); - ESP_LOG2(TAG, "[%ld] Encode for transmit rolling=%07" PRIx32 " fixed=%010" PRIx64 " data=%08" PRIx32, millis(), *this->rolling_code_counter_, fixed, data); + ESP_LOGD(TAG, " transmit: rolling=%07" PRIx32 " fixed=%010" PRIx64 " data=%08" PRIx32, *this->rolling_code_counter_, fixed, data); encode_wireline(*this->rolling_code_counter_, fixed, data, packet); }