From 80faaa4f9f5b55b49d395f5fac852364b8e13ad6 Mon Sep 17 00:00:00 2001 From: yuquanjun Date: Thu, 24 Sep 2026 20:48:18 +0800 Subject: [PATCH] fix(pwr): treat all play/UI inputs as auto-off activity Centralize idle-timer reset on touch/volume/tap/transpose in UI task, and on pick, fretboard, side keys, round keys, and string NoteOn. Pause auto power-off countdown while accompaniment is playing. Co-authored-by: Cursor --- APP/app_adc.c | 1 + Global/Global.c | 18 +++++++++++++++++- task/task_init.c | 13 +++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/APP/app_adc.c b/APP/app_adc.c index d3de8e0..fc05b46 100644 --- a/APP/app_adc.c +++ b/APP/app_adc.c @@ -108,6 +108,7 @@ static void app_adc_string_process(uint8_t channel) } if (!string_state[channel]) { string_state[channel] = 1; + ResetAutoPowerCount(); /* 硅胶弦触发视为用户操作 */ SendNoteOnMidiEvent(get_note_by_channel(channel), vel_out); } } diff --git a/Global/Global.c b/Global/Global.c index a2a4045..2d04715 100644 --- a/Global/Global.c +++ b/Global/Global.c @@ -569,6 +569,14 @@ void AutoPowerOff_Scan(void) if (!powon || !AutoCloseFlag || AutoCloseTime == 0) return; + /* 伴奏播放中视为在使用,不倒计时;停奏后再从满额计时 */ + if (StartFlag) + { + ResetAutoPowerCount(); + s_last_sec_tick = rt_tick_get(); + return; + } + now = rt_tick_get(); if (s_last_sec_tick == 0) { @@ -900,6 +908,8 @@ void ADC_IN1_KEY_Handle(uint8_t key,bool on) uint8_t was_playing; (void)on; + /* 侧面键按压/释放均为用户操作 */ + ResetAutoPowerCount(); /* 模式选择页:侧面键不得起奏 */ if (!InModeFlag) return; @@ -912,7 +922,6 @@ void ADC_IN1_KEY_Handle(uint8_t key,bool on) { was_playing = StartFlag; FreeMode_CancelEvenBeatStop(); - //ResetAutoPowerCount(); if(key == 1) { /* 尾奏:与万能模式第4键共用同一起奏路径 */ @@ -974,6 +983,7 @@ void TM1617_Handle(uint8_t key) /* 调音台:段落数字键不得注入假触摸(会打在推子底部,把数值打到 1) */ if (CurrUIProcress == UI_Mixer_Process) return; + ResetAutoPowerCount(); if(mGuiData[GUI_TAB_INDEX].Current == 3) { uint8_t value = 0; @@ -1365,6 +1375,9 @@ void TM1629_Handle(uint8_t key) STRING_MIDI *MIDI; const STRING_MIDI *ORGAN_MIDI; + /* 指板/拍速/停止键均为用户操作 */ + ResetAutoPowerCount(); + /* 万能:指板不改和弦、不启停伴奏;保留拍速/停止/拨片上推快移调 */ if (mGuiData[GUI_TAB_INDEX].Current == 0) { @@ -1540,6 +1553,9 @@ void Pick_Handle() uint8_t note_cnt = 0; uint8_t chord_id = KEY_ID_1629; + /* 拨片为用户操作(含模式选择页误触):打断自动关机 */ + ResetAutoPowerCount(); + /* 未进入演奏模式(开机模式选择页)禁止起奏 */ if (!InModeFlag) { diff --git a/task/task_init.c b/task/task_init.c index 1de1910..ad55d7d 100644 --- a/task/task_init.c +++ b/task/task_init.c @@ -65,6 +65,19 @@ void TaskUIThread_entry(void* parameter) } if (System_LowBat_IsActive()) continue; + /* 任意页面的用户交互统一复位自动关机;避免各 Process 漏调/early-return 漏调 */ + switch (xEvent.MessageType) + { + case MSG_ID_TOUCH: + case MSG_ID_TOUCH_LONG_REPEAT: + case MSG_ID_EC_VOL: + case MSG_ID_TAP_SPEED: + case MSG_ID_BP_TRANSPOSE: + ResetAutoPowerCount(); + break; + default: + break; + } CurrUIProcress(xEvent); } }