Class OpenSkyhawk::RotaryAcceleratedEncoder
ClassList > OpenSkyhawk > RotaryAcceleratedEncoder
RotaryEncoder plus the two behaviours ofDcsBios::RotaryAcceleratedEncoder , both on by construction. Header-only: the logic lives in theRotaryEncoder family base.More...
#include <RotaryAcceleratedEncoder.h>
Inherits the following classes: OpenSkyhawk::RotaryEncoder
Public Static Attributes inherited from OpenSkyhawk::RotaryEncoder
See OpenSkyhawk::RotaryEncoder
| Type | Name |
|---|---|
| constexpr int16_t | DEFAULT_STEP = 3200REL per-detent magnitude (DCS suggested_step). |
| constexpr uint32_t | FAST_THRESHOLD_MS = 175A detent completing sooner than this after the previous one is "fast" (ms). DCS-BIOS value. |
| constexpr int8_t | MAX_MOMENTUM = 4Momentum cap, in detents' worth of transitions (± MAX_MOMENTUM × stepsPerDetent). DCS-BIOS value. |
| constexpr uint32_t | STOPPED_THRESHOLD_MS = 500With no detent for this long, momentum resets to zero (ms). DCS-BIOS value. |
Public Functions
| Type | Name |
|---|---|
| RotaryAcceleratedEncoder (uint16_t controlId, PinRef pinA, PinRef pinB, EncoderStepsPerDetent stepsPerDetent, int16_t step, int16_t fastStep) REL (variable_step) knob: momentum filter + speed-up. |
|
| RotaryAcceleratedEncoder (uint16_t controlId, PinRef pinA, PinRef pinB, EncoderStepsPerDetent stepsPerDetent, EncoderMode mode) Momentum filter only — for DIR (fixed_step) selectors. |
Public Functions inherited from OpenSkyhawk::RotaryEncoder
See OpenSkyhawk::RotaryEncoder
| Type | Name |
|---|---|
| RotaryEncoder (uint16_t controlId, PinRef pinA, PinRef pinB, EncoderStepsPerDetent stepsPerDetent=EncoderStepsPerDetent::One, EncoderMode mode=EncoderMode::Rel, int16_t step=DEFAULT_STEP) Construct a quadrature encoder. |
|
| virtual void | configure () override Configure both pins as inputs. Called by PanelGroup::setup() . |
| virtual void | forceReport () override Resync the last state; emit nothing (relative control — no baseline). |
| virtual void | poll () override Decode at loop rate (unless a sampler ticks), then drain pending detents → EVTs. |
| virtual void | sampleTick () override ISR-safe quadrature decode of one sample → pending detents. No CAN. |
Public Functions inherited from OpenSkyhawk::InputBase
| Type | Name |
|---|---|
| virtual void | configure () Configure hardware pins for this input. |
| virtual void | forceReport () = 0 Read hardware state and emit a CAN EVT unconditionally. |
| InputBase * | next () const Next input in the list; nullptr at end. |
| virtual void | poll () = 0 Read hardware state and emit a CAN EVT if state changed. |
| virtual void | sampleTick () High-rate sample hook — called from a sampling ISR when the node runs one (e.g. ShiftBus timer sampling, -DSHIFTBUS_ISR_HZ). Default no-op. |
Public Static Functions inherited from OpenSkyhawk::InputBase
| Type | Name |
|---|---|
| InputBase * | head () Head of the self-registered linked list. |
Protected Functions inherited from OpenSkyhawk::RotaryEncoder
See OpenSkyhawk::RotaryEncoder
| Type | Name |
|---|---|
| RotaryEncoder (uint16_t controlId, PinRef pinA, PinRef pinB, EncoderStepsPerDetent stepsPerDetent, EncoderMode mode, int16_t step, bool momentumFilter, int16_t fastStep) Family constructor — used by RotaryAcceleratedEncoder (D16). |
|
| uint8_t | readState () (pinA << 1) | pinB → 0..3. |
Protected Functions inherited from OpenSkyhawk::InputBase
| Type | Name |
|---|---|
| InputBase () Registers this instance into the linked list. |
Detailed Description
- Momentum filter — the DCS-BIOS class's stated purpose ("noisy/faulty rotaries"). Momentum builds by one per transition in the current direction, up to ±(MAX_MOMENTUM × stepsPerDetent); a transition against it is dropped and only decays it; after STOPPED_THRESHOLD_MS (500 ms) with no detent it resets, so a deliberate reversal from rest registers normally.
- Speed (REL only) — a detent completing less than FAST_THRESHOLD_MS (175 ms) after the previous one sends
fastStepinstead ofstep. Two-tier, not a ramp. The first detent after a resync is always slow. A fast detent is just a bigger±stepon the REL frame — no wire, bridge or input-map change (supersedes D9).
DIR mode gets the filter only: the DIR frame carries ±1 and PanelBridge drops anything else, so there is no speed to add — the way DCS-BIOS users apply the class to INC/DEC controls.
Public Functions Documentation
function RotaryAcceleratedEncoder [1/2]
REL (variable_step) knob: momentum filter + speed-up.
inline OpenSkyhawk::RotaryAcceleratedEncoder::RotaryAcceleratedEncoder (
uint16_t controlId,
PinRef pinA,
PinRef pinB,
EncoderStepsPerDetent stepsPerDetent,
int16_t step,
int16_t fastStep
)
Parameters:
controlIdDCSIN_* or CTRL_* constant. Determines PanelBridge routing.pinAquadrature channel A.pinBquadrature channel B (swap A/B to reverse the sensed direction).stepsPerDetentquadrature transitions per emitted click (match the encoder).stepREL magnitude for a normal detent (DCS suggested_step is 3200).fastStepREL magnitude for a fast detent, same sign asstep(e.g. 4× step). 0 turns the speed-up off, leaving only the filter.
function RotaryAcceleratedEncoder [2/2]
Momentum filter only — for DIR (fixed_step) selectors.
inline OpenSkyhawk::RotaryAcceleratedEncoder::RotaryAcceleratedEncoder (
uint16_t controlId,
PinRef pinA,
PinRef pinB,
EncoderStepsPerDetent stepsPerDetent,
EncoderMode mode
)
Parameters:
modeEncoderMode::Dir. Passing EncoderMode::Rel here gives a REL knob with the filter and no speed-up (use the other constructor to setfastStep).
The documentation for this class was generated from the following file Firmware/Libraries/PanelGroup/Inputs/RotaryAcceleratedEncoder/RotaryAcceleratedEncoder.h