AnalogService
Source:
AnalogService.h
Row¶
src/core/services/AnalogService.h:196One analog input: its wiring, its travel, its target, and its own filter state.
Public Attributes¶
uint32_t id = 0
int8_t pin = -1
uint16_t inMin = 0
: the raw count the travel STARTS at
uint16_t inMax = 0
: and where it ends: set to full scale when a row is added
bool invert = false
: a pot wired the other way round
InputAction action {}
uint16_t raw = 0
: the last reading, unfiltered: what a user calibrates from
uint16_t smoothed = 0
: the running average, in raw counts
uint8_t mapped = 0
: what the target last received
bool primed = false
: the average holds a real reading, so it can be trusted
bool sent = false
: a value has been written, so mapped is a real comparison
AnalogService¶
src/core/services/AnalogService.h:39Inherits:
MoonModule,ListSource
A list of ADC pins, each driving a control with a value rather than an event.
The continuous twin of the button service, which drives the same controls from a contact.

Public Methods¶
virtual inline ModuleRole role() const override
: A service, so the container accepts it as a child.
virtual inline void defineControls() override
: Declare the shared filter settings and the list of input rows.
virtual inline void tick20ms() override
: Poll every configured pin, which 50 Hz follows comfortably.
virtual inline bool isEditableList() const override
: Editable, since the rows are the whole point of this module.
virtual inline uint8_t listRowCount() const override
: How many rows are configured.
virtual inline void writeListRow(JsonSink & sink, uint8_t row) const override
: Append one row's summary, ending with the live reading a calibration is set from.
virtual inline void writeListRowDetail(JsonSink & sink, uint8_t row) const override
: The row's editable fields: its pin, its travel, and its target.
virtual inline void writeListOptionSets(JsonSink & sink) const override
: The target options, shared across every row rather than repeated in each.
virtual inline bool addListRow(uint32_t & outId) override
: Append a row at full scale, so it works end to end before anyone calibrates it.
virtual inline bool deleteListRow(uint32_t id) override
: Remove one row by id.
virtual inline bool setListRowField(uint32_t id, const char * field, const char * valueJson) override
: Set one field of one row, every edit clearing the sent mark so the next poll writes.
virtual inline bool restoreList(const char * json, const char * key) override
: Rebuild the rows from the persisted list.
More info¶
An expression pedal is the shape¶
A pedal's travel is never the full sweep: it rests high and tops out below full scale. A raw reading mapped straight through would give a control that never reaches either end. So a row names the travel that matters, and carries an invert for a pot wired backwards.
It writes the surface, not a driver¶
A row names its target and goes through the same primitive every transport uses. Pointing one at the surface lets the assignment change without touching the pedal.
Smoothed here, not in the platform¶
An ADC pin jitters by a few counts even at rest, and a pot adds its own noise. Jitter is a property of what is wired, which only this module knows. So the seam reports raw counts and the filter lives here, as an average a user can change. A deadband on top of it is what stops a resting pedal writing at all. Polled at 50 Hz, which follows a foot comfortably.