diff --git a/APP/app_touch.c b/APP/app_touch.c index b59ec72..4f65240 100644 --- a/APP/app_touch.c +++ b/APP/app_touch.c @@ -68,19 +68,25 @@ app_touch_result_t app_touch_process(uint16_t x, uint16_t y, uint8_t pressed) } if (!pressed) { - if (!long_press_fired && !click_sent && + if (CurrUIProcress == UI_Mixer_Process && + (touch_state == TOUCH_PRESS_WAIT_STABLE || + touch_state == TOUCH_PRESS_STABLE || + touch_state == TOUCH_SLIDING)) + { + /* 调音台:抬起只解锁推子(按下已报过,不能再当点击) */ + MainTask_Sendmsg(MSG_ID_TOUCH, 0, x, y); + } + else if (!long_press_fired && !click_sent && (touch_state == TOUCH_PRESS_WAIT_STABLE || touch_state == TOUCH_PRESS_STABLE || touch_state == TOUCH_SLIDING)) { /* 导航页:抬起时发一次点击(坐标更稳,避免按下瞬间误触底栏) */ - if (CurrUIProcress != UI_Mixer_Process) { - r.gesture = GESTURE_RELEASE; - r.x = down_x; - r.y = down_y; - LOG_TPI("release x=%u y=%u -> MSG", (unsigned)down_x, (unsigned)down_y); - MainTask_Sendmsg(MSG_ID_TOUCH, 1, down_x, down_y); - } + r.gesture = GESTURE_RELEASE; + r.x = down_x; + r.y = down_y; + LOG_TPI("release x=%u y=%u -> MSG", (unsigned)down_x, (unsigned)down_y); + MainTask_Sendmsg(MSG_ID_TOUCH, 1, down_x, down_y); } touch_state = TOUCH_IDLE; down_x = down_y = 0; diff --git a/Global/Global.c b/Global/Global.c index 94f23fd..cfdc079 100644 --- a/Global/Global.c +++ b/Global/Global.c @@ -747,6 +747,9 @@ void ADC_IN1_KEY_Handle(uint8_t key,bool on) void TM1617_Handle(uint8_t key) { + /* 调音台:段落数字键不得注入假触摸(会打在推子底部,把数值打到 1) */ + if (CurrUIProcress == UI_Mixer_Process) + return; if(mGuiData[GUI_TAB_INDEX].Current == 3) { uint8_t value = 0; diff --git a/UI/UI_Mixer.c b/UI/UI_Mixer.c index 5ea5ccc..d4af8f9 100644 --- a/UI/UI_Mixer.c +++ b/UI/UI_Mixer.c @@ -1,6 +1,7 @@ #include "includes.h" extern const Touch_AreaTypeDef *pCurrentTouch_Area; static int8_t s_mixer_focus = -1; +static int8_t s_mixer_grab = -1; /* 按下锁定的推子,松手前不换轨 */ /* 0902-06 调音台:返回 + 标题;无底栏 */ const Touch_AreaTypeDef Touch_Mixer_Areas[] = { @@ -188,7 +189,8 @@ int CheckTouchFader(uint16_t x, uint16_t y) { for (int i = 0; i < 4; i++) { Fader_t *f = &faders[i]; - if (x >= f->x - 10 && x <= f->x + f->w + 10 && + /* 热区不超过轨宽+两侧小余量,避免与邻轨重叠误触 */ + if (x >= f->x - 4 && x <= f->x + f->w + 4 && y >= f->y && y <= f->y + f->h) { return i; } @@ -200,6 +202,7 @@ int CheckTouchFader(uint16_t x, uint16_t y) void UI_Mixer_Init(void) { s_mixer_focus = -1; + s_mixer_grab = -1; UI_ClearFocus(); LCD_FillByColor(0, 0, 240, 320, UI0902_BG_COLOR); UI_DrawSubPageHeader((const uint8_t*)"\xB5\xF7\xD2\xF4\xCC\xA8"); @@ -217,11 +220,23 @@ void UI_Mixer_Process(DisplayTaskMessage_Type msg) case MSG_ID_TOUCH: tx = msg.HiByte; ty = msg.LoByte; + /* ID=0:抬起,解开推子锁定 */ + if (msg.ID == 0) + { + s_mixer_grab = -1; + break; + } + + if (s_mixer_grab >= 0) + { + UpdateFaderByTouch(s_mixer_grab, ty); + return; + } - // 1. ????????? fader_idx = CheckTouchFader(tx, ty); if (fader_idx >= 0) { + s_mixer_grab = (int8_t)fader_idx; UpdateFaderByTouch(fader_idx, ty); return; }