** Function: InputHandler ** Handles the variables PrevPress, NextPress, SelPress, AnyKeyPress and EscPress **********************************************************************/
| 73 | ** Handles the variables PrevPress, NextPress, SelPress, AnyKeyPress and EscPress |
| 74 | **********************************************************************/ |
| 75 | void InputHandler(void) { |
| 76 | static unsigned long tm = 0; |
| 77 | if (launcherMillis() - tm > 200 || LongPress) { |
| 78 | if (touch.touched()) { |
| 79 | auto t = touch.getPointScaled(); |
| 80 | auto t2 = touch.getPointRaw(); |
| 81 | launcherConsolePrintf("\nRAW: Touch Pressed on x=%d, y=%d, rot: %d", t2.x, t2.y, rotation); |
| 82 | launcherConsolePrintf("\nBEF: Touch Pressed on x=%d, y=%d, rot: %d", t.x, t.y, rotation); |
| 83 | if (rotation == 3) { |
| 84 | t.y = (tftHeight + 20) - t.y; |
| 85 | t.x = tftWidth - t.x; |
| 86 | } |
| 87 | if (rotation == 0) { |
| 88 | int tmp = t.x; |
| 89 | t.x = tftWidth - t.y; |
| 90 | t.y = tmp; |
| 91 | } |
| 92 | if (rotation == 2) { |
| 93 | int tmp = t.x; |
| 94 | t.x = t.y; |
| 95 | t.y = (tftHeight + 20) - tmp; |
| 96 | } |
| 97 | launcherConsolePrintf("\nAFT: Touch Pressed on x=%d, y=%d, rot: %d\n", t.x, t.y, rotation); |
| 98 | tm = launcherMillis(); |
| 99 | if (!wakeUpScreen()) AnyKeyPress = true; |
| 100 | else return; |
| 101 | |
| 102 | // Touch point global variable |
| 103 | touchPoint.x = t.x; |
| 104 | touchPoint.y = t.y; |
| 105 | touchPoint.pressed = true; |
| 106 | touchHeatMap(touchPoint); |
| 107 | } else touchPoint.pressed = false; |
| 108 | } |
| 109 | |
| 110 | #ifdef WAVESENTRY |
| 111 | static int posDifference = 0; |
| 112 | static int lastPos = 0; |
| 113 | bool sel = !BTN_ACT; |
| 114 | |
| 115 | int newPos = encoder->getPosition(); |
| 116 | if (newPos != lastPos) { |
| 117 | posDifference += (newPos - lastPos); |
| 118 | lastPos = newPos; |
| 119 | } |
| 120 | |
| 121 | if (launcherMillis() - tm < 200 && !LongPress) return; |
| 122 | |
| 123 | sel = launcherGpioRead(ENCODER_KEY); |
| 124 | |
| 125 | if (posDifference != 0 || sel == BTN_ACT) { |
| 126 | if (!wakeUpScreen()) AnyKeyPress = true; |
| 127 | else return; |
| 128 | } |
| 129 | if (posDifference > 0) { |
| 130 | PrevPress = true; |
| 131 | posDifference--; |
| 132 | } |
nothing calls this directly
no test coverage detected