From fb9b7b7b0c4b292e1579889a90e40dee4c0b1e85 Mon Sep 17 00:00:00 2001 From: gelidusresearch Date: Thu, 3 Oct 2024 22:44:43 -0500 Subject: [PATCH 1/2] Reduce tx and cmd intervals --- gdo.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gdo.c b/gdo.c index 3d36440..d51f77f 100755 --- a/gdo.c +++ b/gdo.c @@ -86,7 +86,7 @@ static gdo_status_t g_status = { .close_ms = 0, .door_position = -1, .door_target = -1, - .client_id = 0x666, + .client_id = 0x5AFE, .rolling_code = 0, }; @@ -101,7 +101,7 @@ static esp_timer_handle_t motion_detect_timer; static esp_timer_handle_t door_position_sync_timer; static esp_timer_handle_t obst_timer; static void *g_user_cb_arg; -static uint32_t g_tx_delay_ms = 50; +static uint32_t g_tx_delay_ms = 250; // Less than 250 is too frequent and brownouts many wall controllers static portMUX_TYPE gdo_spinlock = portMUX_INITIALIZER_UNLOCKED; @@ -753,7 +753,7 @@ esp_err_t gdo_set_close_duration(uint16_t ms) { * @return ESP_OK on success, ESP_ERR_INVALID_ARG if the time is invalid. */ esp_err_t gdo_set_min_command_interval(uint32_t ms) { - if (ms < 50) { + if (ms < 250) { ESP_LOGE(TAG, "Invalid minimum command interval: %" PRIu32, ms); return ESP_ERR_INVALID_ARG; } From d124a3e8d37924adebeba92d45a840ebac7f3fce Mon Sep 17 00:00:00 2001 From: descipher <120155735+GelidusResearch@users.noreply.github.com> Date: Mon, 7 Oct 2024 16:05:21 -0500 Subject: [PATCH 2/2] Move tx cmd interval to component --- gdo.c | 4 ++-- include/gdo.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/gdo.c b/gdo.c index d51f77f..5b3522a 100755 --- a/gdo.c +++ b/gdo.c @@ -101,7 +101,7 @@ static esp_timer_handle_t motion_detect_timer; static esp_timer_handle_t door_position_sync_timer; static esp_timer_handle_t obst_timer; static void *g_user_cb_arg; -static uint32_t g_tx_delay_ms = 250; // Less than 250 is too frequent and brownouts many wall controllers +static uint32_t g_tx_delay_ms = 50; static portMUX_TYPE gdo_spinlock = portMUX_INITIALIZER_UNLOCKED; @@ -753,7 +753,7 @@ esp_err_t gdo_set_close_duration(uint16_t ms) { * @return ESP_OK on success, ESP_ERR_INVALID_ARG if the time is invalid. */ esp_err_t gdo_set_min_command_interval(uint32_t ms) { - if (ms < 250) { + if (ms < 50) { ESP_LOGE(TAG, "Invalid minimum command interval: %" PRIu32, ms); return ESP_ERR_INVALID_ARG; } diff --git a/include/gdo.h b/include/gdo.h index b7ffed8..34339ee 100755 --- a/include/gdo.h +++ b/include/gdo.h @@ -157,6 +157,8 @@ typedef struct { gpio_num_t uart_tx_pin; // UART TX pin gpio_num_t uart_rx_pin; // UART RX pin gpio_num_t obst_in_pin; // Obstruction input pin + gpio_num_t rf_tx_pin; // UART TX pin + gpio_num_t rf_rx_pin; // UART RX pin } gdo_config_t; #define GDO_PAIRED_DEVICE_COUNT_UNKNOWN 0xff