From 630bab7678983b913422709b260afffb4c1525e7 Mon Sep 17 00:00:00 2001 From: Rune Harlyk Date: Thu, 25 Dec 2025 13:37:05 +0100 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Remove=20duplicate=20ping?= =?UTF-8?q?=20pong=20handling?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- esp32/include/communication/comm_base.hpp | 24 +++++------------------ 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/esp32/include/communication/comm_base.hpp b/esp32/include/communication/comm_base.hpp index 8b469bb..6bd97a7 100644 --- a/esp32/include/communication/comm_base.hpp +++ b/esp32/include/communication/comm_base.hpp @@ -110,35 +110,21 @@ class CommAdapterBase { } case message_type_t::PING: { ESP_LOGI("Comm Base", "PING (cid=%d)", cid); -#if USE_MSGPACK - static const uint8_t pong[] = {0x91, 0x04}; - send(pong, sizeof(pong), cid); -#else - send("[4]", cid); -#endif + ping(cid); break; } + case message_type_t::PONG: ESP_LOGI("Comm Base", "PONG (cid=%d)", cid); break; default: ESP_LOGW("Comm Base", "Unknown message type: %d", static_cast(type)); break; } - - if (type == PONG) { - ESP_LOGV("EventSocket", "Pong"); - return; - } else if (type == PING) { - ESP_LOGV("EventSocket", "Ping"); - ping(cid); - return; - } } void ping(int cid) { #if USE_MSGPACK - const uint8_t out[] = {0x91, 0x04}; - send(out, sizeof(out), cid); + static const uint8_t pong[] = {0x91, 0x04}; + send(pong, sizeof(pong), cid); #else - const char *out = "[4]"; - send(out, strlen(out), cid); + send("[4]", cid); #endif }