From 49cb277bf832449001c461975bf6536a12e2c911 Mon Sep 17 00:00:00 2001 From: Peter Feerick Date: Wed, 15 Sep 2021 09:51:16 +1000 Subject: [PATCH] Hardware touch specific variables behind defines --- radio/src/simu.cpp | 16 +++++++++------- radio/src/targets/simu/opentxsimulator.cpp | 16 ++++++++++------ 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/radio/src/simu.cpp b/radio/src/simu.cpp index 87fe7f778..490ec3ac6 100644 --- a/radio/src/simu.cpp +++ b/radio/src/simu.cpp @@ -42,12 +42,14 @@ #define W2 LCD_W*LCD_ZOOM #define H2 LCD_H*LCD_ZOOM -#define TAP_TIME 25 +#if defined(HARDWARE_TOUCH) + #define TAP_TIME 25 -tmr10ms_t now = 0; -tmr10ms_t downTime = 0; -tmr10ms_t tapTime = 0; -short tapCount = 0; + tmr10ms_t now = 0; + tmr10ms_t downTime = 0; + tmr10ms_t tapTime = 0; + short tapCount = 0; +#endif class OpenTxSim: public FXMainWindow { @@ -266,10 +268,10 @@ long OpenTxSim::onMouseDown(FXObject *, FXSelector, void * v) TRACE_WINDOWS("[Mouse Press] %d %d", evt->win_x, evt->win_y); +#if defined(HARDWARE_TOUCH) now = get_tmr10ms(); touchState.tapCount = 0; -#if defined(HARDWARE_TOUCH) touchState.event = TE_DOWN; touchState.startX = touchState.x = evt->win_x; touchState.startY = touchState.y = evt->win_y; @@ -286,9 +288,9 @@ long OpenTxSim::onMouseUp(FXObject*,FXSelector,void*v) TRACE_WINDOWS("[Mouse Release] %d %d", evt->win_x, evt->win_y); +#if defined(HARDWARE_TOUCH) now = get_tmr10ms(); -#if defined(HARDWARE_TOUCH) if (touchState.event == TE_DOWN) { touchState.event = TE_UP; touchState.x = touchState.startX; diff --git a/radio/src/targets/simu/opentxsimulator.cpp b/radio/src/targets/simu/opentxsimulator.cpp index b212b3665..84afaeef2 100644 --- a/radio/src/targets/simu/opentxsimulator.cpp +++ b/radio/src/targets/simu/opentxsimulator.cpp @@ -32,10 +32,12 @@ 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 +#if defined(HARDWARE_TOUCH) + tmr10ms_t downTime = 0; + tmr10ms_t tapTime = 0; + short tapCount = 0; + #define TAP_TIME 25 +#endif uint16_t anaIn(uint8_t chan) { @@ -306,8 +308,10 @@ void OpenTxSimulator::rotaryEncoderEvent(int steps) void OpenTxSimulator::touchEvent(int type, int x, int y) { - tmr10ms_t now = get_tmr10ms(); - touchState.tapCount = 0; + #if defined(HARDWARE_TOUCH) + tmr10ms_t now = get_tmr10ms(); + touchState.tapCount = 0; + #endif switch (type) { case TouchDown: