fix(mixer): ignore section keys and lock the grabbed fader
TM1617 keys injected fake touches at y=255 which slammed mixer sliders to 1. Lock the pressed fader until release and shrink overlapping hit boxes. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
cb4443f0e4
commit
6d01d2cbb1
|
|
@ -68,19 +68,25 @@ app_touch_result_t app_touch_process(uint16_t x, uint16_t y, uint8_t pressed)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!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_WAIT_STABLE ||
|
||||||
touch_state == TOUCH_PRESS_STABLE ||
|
touch_state == TOUCH_PRESS_STABLE ||
|
||||||
touch_state == TOUCH_SLIDING))
|
touch_state == TOUCH_SLIDING))
|
||||||
{
|
{
|
||||||
/* 导航页:抬起时发一次点击(坐标更稳,避免按下瞬间误触底栏) */
|
/* 导航页:抬起时发一次点击(坐标更稳,避免按下瞬间误触底栏) */
|
||||||
if (CurrUIProcress != UI_Mixer_Process) {
|
r.gesture = GESTURE_RELEASE;
|
||||||
r.gesture = GESTURE_RELEASE;
|
r.x = down_x;
|
||||||
r.x = down_x;
|
r.y = down_y;
|
||||||
r.y = down_y;
|
LOG_TPI("release x=%u y=%u -> MSG", (unsigned)down_x, (unsigned)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);
|
||||||
MainTask_Sendmsg(MSG_ID_TOUCH, 1, down_x, down_y);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
touch_state = TOUCH_IDLE;
|
touch_state = TOUCH_IDLE;
|
||||||
down_x = down_y = 0;
|
down_x = down_y = 0;
|
||||||
|
|
|
||||||
|
|
@ -747,6 +747,9 @@ void ADC_IN1_KEY_Handle(uint8_t key,bool on)
|
||||||
|
|
||||||
void TM1617_Handle(uint8_t key)
|
void TM1617_Handle(uint8_t key)
|
||||||
{
|
{
|
||||||
|
/* 调音台:段落数字键不得注入假触摸(会打在推子底部,把数值打到 1) */
|
||||||
|
if (CurrUIProcress == UI_Mixer_Process)
|
||||||
|
return;
|
||||||
if(mGuiData[GUI_TAB_INDEX].Current == 3)
|
if(mGuiData[GUI_TAB_INDEX].Current == 3)
|
||||||
{
|
{
|
||||||
uint8_t value = 0;
|
uint8_t value = 0;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
extern const Touch_AreaTypeDef *pCurrentTouch_Area;
|
extern const Touch_AreaTypeDef *pCurrentTouch_Area;
|
||||||
static int8_t s_mixer_focus = -1;
|
static int8_t s_mixer_focus = -1;
|
||||||
|
static int8_t s_mixer_grab = -1; /* 按下锁定的推子,松手前不换轨 */
|
||||||
|
|
||||||
/* 0902-06 调音台:返回 + 标题;无底栏 */
|
/* 0902-06 调音台:返回 + 标题;无底栏 */
|
||||||
const Touch_AreaTypeDef Touch_Mixer_Areas[] = {
|
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++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
Fader_t *f = &faders[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) {
|
y >= f->y && y <= f->y + f->h) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
@ -200,6 +202,7 @@ int CheckTouchFader(uint16_t x, uint16_t y)
|
||||||
void UI_Mixer_Init(void)
|
void UI_Mixer_Init(void)
|
||||||
{
|
{
|
||||||
s_mixer_focus = -1;
|
s_mixer_focus = -1;
|
||||||
|
s_mixer_grab = -1;
|
||||||
UI_ClearFocus();
|
UI_ClearFocus();
|
||||||
LCD_FillByColor(0, 0, 240, 320, UI0902_BG_COLOR);
|
LCD_FillByColor(0, 0, 240, 320, UI0902_BG_COLOR);
|
||||||
UI_DrawSubPageHeader((const uint8_t*)"\xB5\xF7\xD2\xF4\xCC\xA8");
|
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:
|
case MSG_ID_TOUCH:
|
||||||
tx = msg.HiByte;
|
tx = msg.HiByte;
|
||||||
ty = msg.LoByte;
|
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);
|
fader_idx = CheckTouchFader(tx, ty);
|
||||||
if (fader_idx >= 0)
|
if (fader_idx >= 0)
|
||||||
{
|
{
|
||||||
|
s_mixer_grab = (int8_t)fader_idx;
|
||||||
UpdateFaderByTouch(fader_idx, ty);
|
UpdateFaderByTouch(fader_idx, ty);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue