fix feature timeout reset on volume adjust

Reset feature_timeout_ticks to 0 whenever VOL+ or VOL- causes an effective step in feature mode (short press and repeat), so active adjustments do not timeout and exit feature mode unexpectedly.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Steven Dan
2026-06-01 11:16:27 +08:00
parent 63c4ca3ccd
commit 1c7fd2706a

View File

@@ -1862,6 +1862,9 @@ void AudioHwRemote2(streaming chanend c, chanend cc_mic_level, client interface
if (!vol_plus_long_fired if (!vol_plus_long_fired
&& (now - vol_plus_press_time) < TX1_LONG_PRESS_TICKS) { && (now - vol_plus_press_time) < TX1_LONG_PRESS_TICKS) {
if (tx1_vol_plus_step(feature_mode, feature_volume)) { if (tx1_vol_plus_step(feature_mode, feature_volume)) {
/* 改动原因:在 feature 模式下检测到 VOL+ 有效加值后,立即清零超时计数,
* 防止用户持续调节时被 TX1_FEATURE_TIMEOUT_MAX 误判超时退出。 */
feature_timeout_ticks = 0;
gpio_leds_dirty = 1; gpio_leds_dirty = 1;
debug_printf("TX1: VOL+ short press feature_mode=%d\n", debug_printf("TX1: VOL+ short press feature_mode=%d\n",
feature_mode); feature_mode);
@@ -1878,6 +1881,9 @@ void AudioHwRemote2(streaming chanend c, chanend cc_mic_level, client interface
if ((now - last_vol_plus_trigger) >= TX1_VOL_REPEAT_TICKS) { if ((now - last_vol_plus_trigger) >= TX1_VOL_REPEAT_TICKS) {
last_vol_plus_trigger = now; last_vol_plus_trigger = now;
if (tx1_vol_plus_step(feature_mode, feature_volume)) { if (tx1_vol_plus_step(feature_mode, feature_volume)) {
/* 改动原因:长按连发期间每次检测到 VOL+ 有效加值都重置 feature_timeout_ticks
* 保证 feature 页面在用户连续操作时保持激活。 */
feature_timeout_ticks = 0;
gpio_leds_dirty = 1; gpio_leds_dirty = 1;
} }
} }
@@ -1892,6 +1898,9 @@ void AudioHwRemote2(streaming chanend c, chanend cc_mic_level, client interface
if (!vol_minus_long_fired if (!vol_minus_long_fired
&& (now - vol_minus_press_time) < TX1_LONG_PRESS_TICKS) { && (now - vol_minus_press_time) < TX1_LONG_PRESS_TICKS) {
if (tx1_vol_minus_step(feature_mode, feature_volume)) { if (tx1_vol_minus_step(feature_mode, feature_volume)) {
/* 改动原因:在 feature 模式下检测到 VOL- 有效减值后,立即清零超时计数,
* 避免用户调整参数时触发 feature 超时返回。 */
feature_timeout_ticks = 0;
gpio_leds_dirty = 1; gpio_leds_dirty = 1;
debug_printf("TX1: VOL- short press feature_mode=%d\n", debug_printf("TX1: VOL- short press feature_mode=%d\n",
feature_mode); feature_mode);
@@ -1908,6 +1917,9 @@ void AudioHwRemote2(streaming chanend c, chanend cc_mic_level, client interface
if ((now - last_vol_minus_trigger) >= TX1_VOL_REPEAT_TICKS) { if ((now - last_vol_minus_trigger) >= TX1_VOL_REPEAT_TICKS) {
last_vol_minus_trigger = now; last_vol_minus_trigger = now;
if (tx1_vol_minus_step(feature_mode, feature_volume)) { if (tx1_vol_minus_step(feature_mode, feature_volume)) {
/* 改动原因:长按连发期间每次检测到 VOL- 有效减值都重置 feature_timeout_ticks
* 与短按行为一致,避免连续减值过程中超时退出。 */
feature_timeout_ticks = 0;
gpio_leds_dirty = 1; gpio_leds_dirty = 1;
} }
} }