[SOLVED} PaperS3 Touch Screen Latency
-
I'm trying to make some progress on making the PaperS3 touch screen useful. I have the following code:
void loop(void) { // necessary: M5.update(); t = M5.Touch.getDetail(0); if (t.state > 0) { Serial.printf("Index:%d Count:%d IsPressed:%d Touch:%s\n",eventindex,eventcount,t.isPressed(), state_name[t.state]); } if (t.state == 14 || t.state == 10) { // on flick end or drag end drawSomeTextOnScreen(); } delay(2); }
The code properly detects the flick end or drag end event, but then there is about a 10 second delay before anything happens and the text is drawn on the screen.
Am I doing this right?
What is the device doing in the 10 seconds between the flick end or drag end and the time the screen starts to update?(FWIW delays in the loop of up to 50 msec seem reasonable. M5.Power.lightSleep disables interrupts and the device losts its mind (including serial output.) Does using the arduino delay call save any power anyway? )
The sample drawing program works fine, but it is just testing for t.isPressed():
void loop() { M5.update(); delay(20); t = M5.Touch.getDetail(); if (t.isPressed()) { M5.Display.fillCircle(t.x, t.y, 15, BLACK); } }
-
@wsanders This problem was caused by a reference to an uninitialized variable in that drawSomeTextOnScreen() function. As usual, the invalid reference caused weird behavior that was unrelated to the actual problem.