** Function: InputHandler ** Handles the variables PrevPress, NextPress, SelPress, AnyKeyPress and EscPress **********************************************************************/
| 36 | ** Handles the variables PrevPress, NextPress, SelPress, AnyKeyPress and EscPress |
| 37 | **********************************************************************/ |
| 38 | void InputHandler(void) { |
| 39 | static unsigned long tm = 0; |
| 40 | if (millis() - tm < 200 && !LongPress) return; |
| 41 | M5.update(); |
| 42 | auto t = M5.Touch.getDetail(); |
| 43 | if (t.isPressed() || t.isHolding()) { |
| 44 | tm = millis(); |
| 45 | if (bruceConfigPins.rotation == 3) { |
| 46 | t.y = (tftHeight + 20) - t.y; |
| 47 | t.x = tftWidth - t.x; |
| 48 | } |
| 49 | if (bruceConfigPins.rotation == 0) { |
| 50 | int tmp = t.x; |
| 51 | t.x = tftWidth - t.y; |
| 52 | t.y = tmp; |
| 53 | } |
| 54 | if (bruceConfigPins.rotation == 2) { |
| 55 | int tmp = t.x; |
| 56 | t.x = t.y; |
| 57 | t.y = (tftHeight + 20) - tmp; |
| 58 | } |
| 59 | if (!wakeUpScreen()) AnyKeyPress = true; |
| 60 | else return; |
| 61 | |
| 62 | // Touch point global variable |
| 63 | touchPoint.x = t.x; |
| 64 | touchPoint.y = t.y; |
| 65 | touchPoint.pressed = true; |
| 66 | touchHeatMap(touchPoint); |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | /********************************************************************* |
| 71 | ** Function: powerOff |
nothing calls this directly
no test coverage detected