Fix bug in encoder-only mode.

encoder_driver
Peter Hinch 2023-09-18 09:27:31 +01:00
rodzic 11b9ab655e
commit a5cdc85562
2 zmienionych plików z 11 dodań i 10 usunięć

Wyświetl plik

@ -312,17 +312,17 @@ runtime. A disabled `active` widget is shown "greyed-out" and cannot accept the
### 1.4.1 Encoder only mode ### 1.4.1 Encoder only mode
This uses a rotary encoder with a pushbutton as the sole means of navigation, a This uses a rotary encoder with a built-in pushbutton as the sole means of
mode suggested by @eudoxos. By default, turning the dial moves the currency navigation, a mode suggested by @eudoxos. By default, turning the dial moves
between widgets. Clicking the button selects a widget; the widget with the the currency between widgets; the widget with the focus has a white border.
focus has a white border. Supporting widgets such as sliders and dropdown lists Widgets for numeric entry such as sliders and scales may be put into "adjust"
enter "adjust" mode such that turning the dial adjusts the widget. mode with a double click. In that mode turning the dial adjusts the widget.
[Floating Point Widgets](./README.md#112-floating-point-widgets) can enter [Floating Point Widgets](./README.md#112-floating-point-widgets) can enter
precision adjustment mode with a long press of the button. "Adjust" mode is "precision" adjustment mode with a long press of the button. "Adjust" and
cleared with a short button press. "precision" modes are cleared with a short button press.
This mode works well and its use is quite intuitive. The rapid navigation makes This mode works well and its use is quite intuitive. Navigation by turning a
it particularly useful when a screen has a large number of widgets. dial makes it particularly useful when a screen has a large number of widgets.
###### [Contents](./README.md#0-contents) ###### [Contents](./README.md#0-contents)

Wyświetl plik

@ -132,6 +132,7 @@ class InputEnc:
self._sel = Pushbutton(sel, suppress=True) self._sel = Pushbutton(sel, suppress=True)
self._sel.release_func(self.release) # Widgets are selected on release. self._sel.release_func(self.release) # Widgets are selected on release.
self._sel.long_func(self.precision, (True,)) # Long press -> precision mode self._sel.long_func(self.precision, (True,)) # Long press -> precision mode
self._sel.double_func(self.adj_mode, (True,)) # Double press -> adjust mode
# Screen.adjust: adjust the value of a widget. In this case 1st button arg # Screen.adjust: adjust the value of a widget. In this case 1st button arg
# is an int (discarded), val is the delta. (With button interface 1st arg # is an int (discarded), val is the delta. (With button interface 1st arg
@ -143,7 +144,7 @@ class InputEnc:
Screen.ctrl_move(_NEXT if delta > 0 else _PREV) Screen.ctrl_move(_NEXT if delta > 0 else _PREV)
def release(self): def release(self):
self.adj_mode() #False) # Cancel adjust and precision self.adj_mode(False) # Cancel adjust and precision
Screen.sel_ctrl() Screen.sel_ctrl()
def precision(self, val): # Also called by Screen.ctrl_move to cancel mode def precision(self, val): # Also called by Screen.ctrl_move to cancel mode