Slide energy taken into account
This commit is contained in:
+1
-1
@@ -282,7 +282,7 @@ long OpenTxSim::onMouseUp(FXObject*,FXSelector,void*v)
|
|||||||
touchState.y = touchState.startY;
|
touchState.y = touchState.startY;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
touchState.event = TE_NONE;
|
touchState.event = TE_SLIDE_END;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -451,8 +451,8 @@ void handleTouch()
|
|||||||
unsigned short touchY;
|
unsigned short touchY;
|
||||||
uint32_t tEvent = 0;
|
uint32_t tEvent = 0;
|
||||||
ft6x06_TS_GetXY(TOUCH_FT6236_I2C_ADDRESS, &touchX, &touchY, &tEvent);
|
ft6x06_TS_GetXY(TOUCH_FT6236_I2C_ADDRESS, &touchX, &touchY, &tEvent);
|
||||||
//uint32_t gesture;
|
// uint32_t gesture;
|
||||||
//ft6x06_TS_GetGestureID(TOUCH_FT6236_I2C_ADDRESS, &gesture);
|
// ft6x06_TS_GetGestureID(TOUCH_FT6236_I2C_ADDRESS, &gesture);
|
||||||
#if defined( LCD_DIRECTION ) && (LCD_DIRECTION == LCD_VERTICAL)
|
#if defined( LCD_DIRECTION ) && (LCD_DIRECTION == LCD_VERTICAL)
|
||||||
touchX = LCD_WIDTH - touchX;
|
touchX = LCD_WIDTH - touchX;
|
||||||
touchY = LCD_HEIGHT - touchY;
|
touchY = LCD_HEIGHT - touchY;
|
||||||
@@ -468,20 +468,18 @@ void handleTouch()
|
|||||||
touchState.x = touchX;
|
touchState.x = touchX;
|
||||||
touchState.y = touchY;
|
touchState.y = touchY;
|
||||||
|
|
||||||
if (touchState.event == TE_NONE || touchState.event == TE_UP)
|
if (touchState.event == TE_NONE || touchState.event == TE_UP) {
|
||||||
{
|
|
||||||
touchState.startX = touchState.x;
|
touchState.startX = touchState.x;
|
||||||
touchState.startY = touchState.y;
|
touchState.startY = touchState.y;
|
||||||
touchState.event = TE_DOWN;
|
touchState.event = TE_DOWN;
|
||||||
if (g_eeGeneral.backlightMode & e_backlight_mode_keys)
|
if (g_eeGeneral.backlightMode & e_backlight_mode_keys)
|
||||||
backlightOn(); // TODO is that the best place ?
|
backlightOn(); // TODO is that the best place ?
|
||||||
}
|
}
|
||||||
else if (touchState.event == TE_DOWN)
|
else if (touchState.event == TE_DOWN) {
|
||||||
{
|
if (dx >= SLIDE_RANGE || dx <= -SLIDE_RANGE || dy >= SLIDE_RANGE || dy <= -SLIDE_RANGE) {
|
||||||
if ((dx >= SLIDE_RANGE) || (dx <= -SLIDE_RANGE) || (dy >= SLIDE_RANGE)|| (dy <= -SLIDE_RANGE)) {
|
|
||||||
touchState.event = TE_SLIDE;
|
touchState.event = TE_SLIDE;
|
||||||
touchState.deltaX = (short)dx;
|
touchState.deltaX = (short) dx;
|
||||||
touchState.deltaY = (short)dy;
|
touchState.deltaY = (short) dy;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
touchState.event = TE_DOWN;
|
touchState.event = TE_DOWN;
|
||||||
@@ -489,11 +487,10 @@ void handleTouch()
|
|||||||
touchState.deltaY = 0;
|
touchState.deltaY = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (touchState.event == TE_SLIDE)
|
else if (touchState.event == TE_SLIDE) {
|
||||||
{
|
|
||||||
touchState.event = TE_SLIDE; //no change
|
touchState.event = TE_SLIDE; //no change
|
||||||
touchState.deltaX = (short)dx;
|
touchState.deltaX = (short) dx;
|
||||||
touchState.deltaY = (short)dy;
|
touchState.deltaY = (short) dy;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -512,19 +509,24 @@ bool touchPanelEventOccured()
|
|||||||
return touchEventOccured;
|
return touchEventOccured;
|
||||||
}
|
}
|
||||||
|
|
||||||
void touchPanelRead() {
|
void touchPanelRead()
|
||||||
if(!touchEventOccured) return;
|
{
|
||||||
|
if (!touchEventOccured)
|
||||||
|
return;
|
||||||
|
|
||||||
touchEventOccured = false;
|
touchEventOccured = false;
|
||||||
|
|
||||||
if (ft6x06_TS_DetectTouch(TOUCH_FT6236_I2C_ADDRESS)) {
|
if (ft6x06_TS_DetectTouch(TOUCH_FT6236_I2C_ADDRESS)) {
|
||||||
handleTouch();
|
handleTouch();
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
if (touchState.event == TE_DOWN) {
|
if (touchState.event == TE_DOWN) {
|
||||||
touchState.event = TE_UP;
|
touchState.event = TE_UP;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
touchState.x = LCD_WIDTH;
|
touchState.x = LCD_WIDTH;
|
||||||
touchState.y = LCD_HEIGHT;
|
touchState.y = LCD_HEIGHT;
|
||||||
touchState.event = TE_NONE;
|
touchState.event = TE_SLIDE_END;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
-1
Submodule radio/src/thirdparty/libopenui updated: d0634734b4...2b515b888a
+3
-1
@@ -27,7 +27,7 @@ enum TouchEvent
|
|||||||
TE_DOWN,
|
TE_DOWN,
|
||||||
TE_UP,
|
TE_UP,
|
||||||
TE_SLIDE,
|
TE_SLIDE,
|
||||||
TE_END
|
TE_SLIDE_END
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TouchState
|
struct TouchState
|
||||||
@@ -39,6 +39,8 @@ struct TouchState
|
|||||||
short startY;
|
short startY;
|
||||||
short deltaX;
|
short deltaX;
|
||||||
short deltaY;
|
short deltaY;
|
||||||
|
short lastDeltaX;
|
||||||
|
short lastDeltaY;
|
||||||
};
|
};
|
||||||
|
|
||||||
constexpr uint8_t SLIDE_RANGE = 6;
|
constexpr uint8_t SLIDE_RANGE = 6;
|
||||||
|
|||||||
Reference in New Issue
Block a user