![]() |
Deluge Firmware 1.3.0
Build date: 2026.11.28
|
#include <encoders.h>
Public Member Functions | |
| DetentedEncoder (const DetentedEncoder &)=delete | |
| DetentedEncoder & | operator= (const DetentedEncoder &)=delete |
| void | apply_edges (int8_t edges) |
| bool | pending () const |
| True if any detent steps are waiting to be consumed. | |
| int32_t | take () |
| Returns the accumulated signed detent count and resets pos to 0. | |
| void | restore (int32_t val) |
Static Public Attributes | |
| static constexpr bool | kRestA = true |
| Black encoders rest in a detent with both contacts open (A and B pulled high), as 1.x assumed. | |
| static constexpr bool | kRestB = true |
Private Member Functions | |
| int32_t | positiveThreshold () const |
| int32_t | negativeThreshold () const |
Black function encoders (SCROLL_X/Y, TEMPO, SELECT) are detented. Four quadrature edges = one detent click. The decoder confirms each edge one edge late, so the first click needs three confirmed edges, continuing needs four, and a reversal needs two (the pending edge is retraced before reverse edges confirm). Partial reverse travel cancels on returning to the detent, without undoing the reported click or discarding forward progress.
These thresholds only line up with the physical clicks if the decoder starts at the detent's resting pin state; see initializeDecoderAtBoot().
|
inline |
Puts a value back (used by the SD card-routine retry path). fetch_add rather than store so a detent that arrived from the IRQ since take() isn't clobbered.