WS刚连接成功可以进行 对话,超过30sWS断开后,语音上行停止,需要修复

This commit is contained in:
CSBOOK\44744
2026-06-26 15:56:26 +08:00
parent 8c6f5c7a78
commit c61d1a5043
10 changed files with 218 additions and 11 deletions
@@ -94,6 +94,7 @@ typedef struct {
int raw_level;
bool debounced_pressed;
bool debounce_pending;
bool wait_inactive_before_press;
bool long_press_sent;
bool click_pending;
int64_t debounce_deadline_ms;
@@ -252,6 +253,14 @@ static void control_plane_handle_debounced_transition(const control_plane_key_co
int level,
int64_t now_ms)
{
if (state->wait_inactive_before_press) {
if (pressed) {
state->debounced_pressed = false;
return;
}
state->wait_inactive_before_press = false;
}
if (pressed == state->debounced_pressed) {
return;
}
@@ -374,8 +383,14 @@ static void control_plane_key_input_task(void *arg)
const control_plane_key_config_t *config = &s_key_configs[i];
s_key_states[i].initialized = true;
s_key_states[i].raw_level = gpio_get_level(config->gpio_num);
s_key_states[i].debounced_pressed =
control_plane_key_level_is_pressed(config, s_key_states[i].raw_level);
bool initial_pressed = control_plane_key_level_is_pressed(config, s_key_states[i].raw_level);
s_key_states[i].debounced_pressed = initial_pressed;
if (config->key_id == CONTROL_PLANE_KEY_ID_PTT && initial_pressed) {
ESP_LOGW(TAG,
"PTT initial level is active; wait for next stable press before emitting press event");
s_key_states[i].debounced_pressed = false;
s_key_states[i].wait_inactive_before_press = true;
}
setup_err = control_plane_configure_key_gpio(config);
if (setup_err != ESP_OK) {