diff --git a/radio/src/lua/widgets.cpp b/radio/src/lua/widgets.cpp index 5bb1fe870..dc46a9756 100644 --- a/radio/src/lua/widgets.cpp +++ b/radio/src/lua/widgets.cpp @@ -34,7 +34,6 @@ #if defined(HARDWARE_TOUCH) #include "touch.h" -#define EVT_TOUCH_TAP_TIME 25 #define EVT_TOUCH_SWIPE_LOCK 4 #define EVT_TOUCH_SWIPE_SPEED 60 #define EVT_TOUCH_SWIPE_TIMEOUT 50 diff --git a/radio/src/targets/simu/opentxsimulator.cpp b/radio/src/targets/simu/opentxsimulator.cpp index a2cedccb2..b212b3665 100644 --- a/radio/src/targets/simu/opentxsimulator.cpp +++ b/radio/src/targets/simu/opentxsimulator.cpp @@ -32,6 +32,11 @@ int16_t g_anas[Analogs::NUM_ANALOGS]; QVector OpenTxSimulator::tracebackDevices; +tmr10ms_t downTime = 0; +tmr10ms_t tapTime = 0; +short tapCount = 0; +#define TAP_TIME 25 + uint16_t anaIn(uint8_t chan) { return g_anas[chan]; @@ -301,6 +306,9 @@ void OpenTxSimulator::rotaryEncoderEvent(int steps) void OpenTxSimulator::touchEvent(int type, int x, int y) { + tmr10ms_t now = get_tmr10ms(); + touchState.tapCount = 0; + switch (type) { case TouchDown: TRACE_WINDOWS("[Mouse Press] %d %d", x, y); @@ -309,6 +317,7 @@ void OpenTxSimulator::touchEvent(int type, int x, int y) touchState.event = TE_DOWN; touchState.startX = touchState.x = x; touchState.startY = touchState.y = y; + downTime = now; #endif break; @@ -320,6 +329,14 @@ void OpenTxSimulator::touchEvent(int type, int x, int y) touchState.event = TE_UP; touchState.x = touchState.startX; touchState.y = touchState.startY; + if (now - downTime <= TAP_TIME) { + if (now - tapTime > TAP_TIME) + tapCount = 1; + else + tapCount++; + touchState.tapCount = tapCount; + tapTime = now; + } } else { touchState.event = TE_SLIDE_END; }