SimpleRotaryAdapter

Defines

LONG_PRESS_DURATION

Duration for a long press in milliseconds.

This value defines the duration (in milliseconds) that a button must be pressed to be considered a long press. The default value is 1000 milliseconds.

DOUBLE_PRESS_THRESHOLD

Threshold for detecting a double press in milliseconds.

This value defines the maximum time interval (in milliseconds) between two consecutive button presses to be considered a double press. The default value is 300 milliseconds.

class SimpleRotaryAdapter : public InputInterface
#include <SimpleRotaryAdapter.h>

Adapter for handling rotary input for an LCD menu.

This class interfaces with a rotary encoder to manage user input for navigating and selecting options in an LCD menu.

It processes rotary encoder rotations to navigate through menu options and handles button presses for various actions, including:

  • Short press for selecting an option

  • Long press for going back

  • Double press for backspacing

The values for long press duration (defined as #LONG_PRESS_DURATION) and double press threshold (defined as #DOUBLE_PRESS_THRESHOLD) can be overwritten by defining new ones with #define.

Param menu:

Pointer to the LcdMenu instance that this adapter will control.

Param encoder:

Pointer to the SimpleRotary instance representing the rotary encoder.

Public Functions

inline SimpleRotaryAdapter(LcdMenu *menu, SimpleRotary *encoder)
inline virtual void observe() override

Private Members

unsigned long lastPressTime = 0
bool pendingEnter = false
SimpleRotary *encoder