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 <cursoragent@cursor.com>
This commit is contained in:
yuquanjun 2026-09-24 20:48:18 +08:00
parent 91b33a4515
commit 80faaa4f9f
3 changed files with 31 additions and 1 deletions

View File

@ -108,6 +108,7 @@ static void app_adc_string_process(uint8_t channel)
} }
if (!string_state[channel]) { if (!string_state[channel]) {
string_state[channel] = 1; string_state[channel] = 1;
ResetAutoPowerCount(); /* 硅胶弦触发视为用户操作 */
SendNoteOnMidiEvent(get_note_by_channel(channel), vel_out); SendNoteOnMidiEvent(get_note_by_channel(channel), vel_out);
} }
} }

View File

@ -569,6 +569,14 @@ void AutoPowerOff_Scan(void)
if (!powon || !AutoCloseFlag || AutoCloseTime == 0) if (!powon || !AutoCloseFlag || AutoCloseTime == 0)
return; return;
/* 伴奏播放中视为在使用,不倒计时;停奏后再从满额计时 */
if (StartFlag)
{
ResetAutoPowerCount();
s_last_sec_tick = rt_tick_get();
return;
}
now = rt_tick_get(); now = rt_tick_get();
if (s_last_sec_tick == 0) if (s_last_sec_tick == 0)
{ {
@ -900,6 +908,8 @@ void ADC_IN1_KEY_Handle(uint8_t key,bool on)
uint8_t was_playing; uint8_t was_playing;
(void)on; (void)on;
/* 侧面键按压/释放均为用户操作 */
ResetAutoPowerCount();
/* 模式选择页:侧面键不得起奏 */ /* 模式选择页:侧面键不得起奏 */
if (!InModeFlag) if (!InModeFlag)
return; return;
@ -912,7 +922,6 @@ void ADC_IN1_KEY_Handle(uint8_t key,bool on)
{ {
was_playing = StartFlag; was_playing = StartFlag;
FreeMode_CancelEvenBeatStop(); FreeMode_CancelEvenBeatStop();
//ResetAutoPowerCount();
if(key == 1) if(key == 1)
{ {
/* 尾奏:与万能模式第4键共用同一起奏路径 */ /* 尾奏:与万能模式第4键共用同一起奏路径 */
@ -974,6 +983,7 @@ void TM1617_Handle(uint8_t key)
/* 调音台:段落数字键不得注入假触摸(会打在推子底部,把数值打到 1) */ /* 调音台:段落数字键不得注入假触摸(会打在推子底部,把数值打到 1) */
if (CurrUIProcress == UI_Mixer_Process) if (CurrUIProcress == UI_Mixer_Process)
return; return;
ResetAutoPowerCount();
if(mGuiData[GUI_TAB_INDEX].Current == 3) if(mGuiData[GUI_TAB_INDEX].Current == 3)
{ {
uint8_t value = 0; uint8_t value = 0;
@ -1365,6 +1375,9 @@ void TM1629_Handle(uint8_t key)
STRING_MIDI *MIDI; STRING_MIDI *MIDI;
const STRING_MIDI *ORGAN_MIDI; const STRING_MIDI *ORGAN_MIDI;
/* 指板/拍速/停止键均为用户操作 */
ResetAutoPowerCount();
/* 万能:指板不改和弦、不启停伴奏;保留拍速/停止/拨片上推快移调 */ /* 万能:指板不改和弦、不启停伴奏;保留拍速/停止/拨片上推快移调 */
if (mGuiData[GUI_TAB_INDEX].Current == 0) if (mGuiData[GUI_TAB_INDEX].Current == 0)
{ {
@ -1540,6 +1553,9 @@ void Pick_Handle()
uint8_t note_cnt = 0; uint8_t note_cnt = 0;
uint8_t chord_id = KEY_ID_1629; uint8_t chord_id = KEY_ID_1629;
/* 拨片为用户操作(含模式选择页误触):打断自动关机 */
ResetAutoPowerCount();
/* 未进入演奏模式(开机模式选择页)禁止起奏 */ /* 未进入演奏模式(开机模式选择页)禁止起奏 */
if (!InModeFlag) if (!InModeFlag)
{ {

View File

@ -65,6 +65,19 @@ void TaskUIThread_entry(void* parameter)
} }
if (System_LowBat_IsActive()) if (System_LowBat_IsActive())
continue; 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); CurrUIProcress(xEvent);
} }
} }