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