File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change 99 * Support for a menu with a single button, it will add a button on the required pin, and listen for changes
1010 * With the following:
1111 * Short press: increment by 1
12- * Double press (when not editing): select item
13- * Hold down: go back navigation
12+ * Double press (when not editing): back navigation
13+ * Hold down: select
1414 */
1515class TcOneButtonHandler : public SwitchListener {
1616private:
@@ -31,14 +31,20 @@ class TcOneButtonHandler : public SwitchListener {
3131
3232 void onReleased (pinid_t pin, bool held) override {
3333 if (held && pin == buttonPin) {
34- menuMgr.performDirectionMove ( true );
34+ menuMgr.onMenuSelect ( false );
3535 lastPress = 0 ;
3636 } else {
3737 if ((millis () - lastPress) < doubleClickThreshold) {
38- menuMgr.onMenuSelect (held );
38+ menuMgr.performDirectionMove ( true );
3939 lastPress = 0 ;
4040 } else {
41- switches.getEncoder ()->increment (1 );
41+ auto enc = switches.getEncoder ();
42+ if (enc->getCurrentReading () == enc->getMaximumValue ()) {
43+ enc->setCurrentReading (0 );
44+ enc->runCallback (enc->getCurrentReading ());
45+ } else {
46+ enc->increment (1 );
47+ }
4248 lastPress = millis ();
4349 }
4450 }
You can’t perform that action at this time.
0 commit comments