micropython-m5stack icon indicating copy to clipboard operation
micropython-m5stack copied to clipboard

Double click & long button press

Open stroobandt opened this issue 7 years ago • 6 comments

Loboris provides a great threading template. Perhaps we ought to provide a similar GUI template for the M5Stack over here. That would speed up M5Stack MicroPython adoption & projects.

stroobandt avatar Feb 11 '18 20:02 stroobandt

The threading template is awesome. Had not seen it before. Full fledged GUI framework is a project by itself. However templates for basic interactions (click, double click etc) might be a good idea.

tuupola avatar Feb 12 '18 05:02 tuupola

Any ideas how a long button press would be best implemented? Obviously, it should involve a button pressed depressed timer. I have a project at hand that might make good use of that.

stroobandt avatar Mar 08 '18 11:03 stroobandt

Good news! Boris is working on it. I also made some publicity for your M5Stack Kitchen Sink.

stroobandt avatar Mar 09 '18 17:03 stroobandt

I think for double clicks and long presses you would need uasyncio library. I remember seeing a discussion about it in MicroPython forums.

https://github.com/peterhinch/micropython-async/blob/master/aswitch.py

tuupola avatar Mar 10 '18 05:03 tuupola

Here is button code in c which handles double clicks and long presses.

https://github.com/espressif/esp-iot-solution/blob/master/components/general/button/button/button.c

tuupola avatar Apr 15 '18 04:04 tuupola

It seems Loboris fork now has improved support for buttons. Will look into this.

tuupola avatar Apr 05 '19 07:04 tuupola