[zwave_proxy] Use new socket wake infrastructure to reduce latency, convert to C++17 namespace style (#12135)

Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
Keith Burzinski
2025-12-01 14:27:20 -06:00
committed by GitHub
parent 6a79ce8eff
commit 52fe3de78f
3 changed files with 9 additions and 8 deletions

View File

@@ -41,3 +41,6 @@ async def to_code(config):
await cg.register_component(var, config)
await uart.register_uart_device(var, config)
cg.add_define("USE_ZWAVE_PROXY")
# Request UART to wake the main loop when data arrives for low-latency processing
uart.request_wake_loop_on_rx()

View File

@@ -5,8 +5,7 @@
#include "esphome/core/log.h"
#include "esphome/core/util.h"
namespace esphome {
namespace zwave_proxy {
namespace esphome::zwave_proxy {
static const char *const TAG = "zwave_proxy";
@@ -144,6 +143,7 @@ void ZWaveProxy::zwave_proxy_request(api::APIConnection *api_connection, api::en
this->api_connection_ = api_connection;
ESP_LOGV(TAG, "API connection is now subscribed");
break;
case api::enums::ZWAVE_PROXY_REQUEST_TYPE_UNSUBSCRIBE:
if (this->api_connection_ != api_connection) {
ESP_LOGV(TAG, "API connection is not subscribed");
@@ -151,6 +151,7 @@ void ZWaveProxy::zwave_proxy_request(api::APIConnection *api_connection, api::en
}
this->api_connection_ = nullptr;
break;
default:
ESP_LOGW(TAG, "Unknown request type: %d", type);
break;
@@ -342,5 +343,4 @@ bool ZWaveProxy::response_handler_() {
ZWaveProxy *global_zwave_proxy = nullptr; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
} // namespace zwave_proxy
} // namespace esphome
} // namespace esphome::zwave_proxy

View File

@@ -8,8 +8,7 @@
#include <array>
namespace esphome {
namespace zwave_proxy {
namespace esphome::zwave_proxy {
static constexpr size_t MAX_ZWAVE_FRAME_SIZE = 257; // Maximum Z-Wave frame size
@@ -89,5 +88,4 @@ class ZWaveProxy : public uart::UARTDevice, public Component {
extern ZWaveProxy *global_zwave_proxy; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
} // namespace zwave_proxy
} // namespace esphome
} // namespace esphome::zwave_proxy