mirror of
https://github.com/opentx/opentx.git
synced 2025-07-24 16:55:20 +03:00
Slide energy taken into account
This commit is contained in:
parent
1e25fba4ba
commit
76bc7b5c29
4 changed files with 24 additions and 20 deletions
|
@ -282,7 +282,7 @@ long OpenTxSim::onMouseUp(FXObject*,FXSelector,void*v)
|
|||
touchState.y = touchState.startY;
|
||||
}
|
||||
else {
|
||||
touchState.event = TE_NONE;
|
||||
touchState.event = TE_SLIDE_END;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -451,8 +451,8 @@ void handleTouch()
|
|||
unsigned short touchY;
|
||||
uint32_t tEvent = 0;
|
||||
ft6x06_TS_GetXY(TOUCH_FT6236_I2C_ADDRESS, &touchX, &touchY, &tEvent);
|
||||
//uint32_t gesture;
|
||||
//ft6x06_TS_GetGestureID(TOUCH_FT6236_I2C_ADDRESS, &gesture);
|
||||
// uint32_t gesture;
|
||||
// ft6x06_TS_GetGestureID(TOUCH_FT6236_I2C_ADDRESS, &gesture);
|
||||
#if defined( LCD_DIRECTION ) && (LCD_DIRECTION == LCD_VERTICAL)
|
||||
touchX = LCD_WIDTH - touchX;
|
||||
touchY = LCD_HEIGHT - touchY;
|
||||
|
@ -468,20 +468,18 @@ void handleTouch()
|
|||
touchState.x = touchX;
|
||||
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.startY = touchState.y;
|
||||
touchState.event = TE_DOWN;
|
||||
if (g_eeGeneral.backlightMode & e_backlight_mode_keys)
|
||||
backlightOn(); // TODO is that the best place ?
|
||||
}
|
||||
else if (touchState.event == TE_DOWN)
|
||||
{
|
||||
if ((dx >= SLIDE_RANGE) || (dx <= -SLIDE_RANGE) || (dy >= SLIDE_RANGE)|| (dy <= -SLIDE_RANGE)) {
|
||||
else if (touchState.event == TE_DOWN) {
|
||||
if (dx >= SLIDE_RANGE || dx <= -SLIDE_RANGE || dy >= SLIDE_RANGE || dy <= -SLIDE_RANGE) {
|
||||
touchState.event = TE_SLIDE;
|
||||
touchState.deltaX = (short)dx;
|
||||
touchState.deltaY = (short)dy;
|
||||
touchState.deltaX = (short) dx;
|
||||
touchState.deltaY = (short) dy;
|
||||
}
|
||||
else {
|
||||
touchState.event = TE_DOWN;
|
||||
|
@ -489,11 +487,10 @@ void handleTouch()
|
|||
touchState.deltaY = 0;
|
||||
}
|
||||
}
|
||||
else if (touchState.event == TE_SLIDE)
|
||||
{
|
||||
else if (touchState.event == TE_SLIDE) {
|
||||
touchState.event = TE_SLIDE; //no change
|
||||
touchState.deltaX = (short)dx;
|
||||
touchState.deltaY = (short)dy;
|
||||
touchState.deltaX = (short) dx;
|
||||
touchState.deltaY = (short) dy;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -512,19 +509,24 @@ bool touchPanelEventOccured()
|
|||
return touchEventOccured;
|
||||
}
|
||||
|
||||
void touchPanelRead() {
|
||||
if(!touchEventOccured) return;
|
||||
void touchPanelRead()
|
||||
{
|
||||
if (!touchEventOccured)
|
||||
return;
|
||||
|
||||
touchEventOccured = false;
|
||||
|
||||
if (ft6x06_TS_DetectTouch(TOUCH_FT6236_I2C_ADDRESS)) {
|
||||
handleTouch();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if (touchState.event == TE_DOWN) {
|
||||
touchState.event = TE_UP;
|
||||
}
|
||||
else {
|
||||
touchState.x = LCD_WIDTH;
|
||||
touchState.y = LCD_HEIGHT;
|
||||
touchState.event = TE_NONE;
|
||||
touchState.event = TE_SLIDE_END;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
2
radio/src/thirdparty/libopenui
vendored
2
radio/src/thirdparty/libopenui
vendored
|
@ -1 +1 @@
|
|||
Subproject commit d0634734b4a4edf7505368333daff0a118cb2f17
|
||||
Subproject commit 2b515b888a440c575049b219f26784ed59f6cf26
|
|
@ -27,7 +27,7 @@ enum TouchEvent
|
|||
TE_DOWN,
|
||||
TE_UP,
|
||||
TE_SLIDE,
|
||||
TE_END
|
||||
TE_SLIDE_END
|
||||
};
|
||||
|
||||
struct TouchState
|
||||
|
@ -39,6 +39,8 @@ struct TouchState
|
|||
short startY;
|
||||
short deltaX;
|
||||
short deltaY;
|
||||
short lastDeltaX;
|
||||
short lastDeltaY;
|
||||
};
|
||||
|
||||
constexpr uint8_t SLIDE_RANGE = 6;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue