|
Lamp-Da 0.1
A compact lantern project
|
Output user action signals on the serial and bluetooth links. More...
Go to the source code of this file.
Classes | |
| struct | lampda::logic::user_signals::detail::Slot |
| Rate limiting state of one signal. More... | |
Namespaces | |
| namespace | lampda |
| Program scope. | |
| namespace | lampda::logic |
| Handle the main high level logics. | |
Enumerations | |
| enum | SlotId : size_t { slotBrightness = 0 , slotMode , slotRamp , slotIndicator , slotCount } |
Functions | |
| size_t | lampda::logic::user_signals::format (char *buffer, const char *name, const uint32_t *values, const size_t valueCount) |
| Format a signal, without the line end. | |
| void | lampda::logic::user_signals::send (const char *name, const uint32_t *values, const size_t valueCount) |
| Format and send a signal immediately (no rate limiting) | |
| Slot & | lampda::logic::user_signals::detail::slot (const SlotId id) |
| bool | lampda::logic::user_signals::detail::same_as_sent (const Slot &s) |
| void | lampda::logic::user_signals::detail::flush (Slot &s, const uint32_t nowMs) |
| Send the pending value if there is one and the interval since the latest send is over. | |
| void | lampda::logic::user_signals::detail::submit (const SlotId id, const uint32_t *values, const bool forceSend=false) |
| Record the latest value of a signal and send it now if the interval allows. | |
| void | lampda::logic::user_signals::loop () |
| Send the pending signals whose interval is over Call it regularly, more often than signalIntervalMs. | |
| void | lampda::logic::user_signals::send_brightness (const uint32_t brightness) |
| void | lampda::logic::user_signals::send_mode (const uint8_t groupId, const uint8_t modeId) |
| void | lampda::logic::user_signals::send_ramp (const uint32_t ramp, const bool forceSend=false) |
| void | lampda::logic::user_signals::send_indicator (const uint32_t level) |
Output user action signals on the serial and bluetooth links.
Each signal is a single line: '$' + name + ':' + values separated by ':' + "\r\n". The '$' prefix separates them from timestamped logs ("<time>> ..."). Names are short to avoid saturating slow outputs (BLE). This format is a public interface for external apps: do not change existing signals, only add new ones.
Rate limiting: each signal is sent at most once every signalIntervalMs. A change that arrives while the interval is running is not sent at once, only the latest value is kept and sent when the interval ends.
Call user_signals::loop() regularly (more often than signalIntervalMs) so that pending values get sent.
|
inline |
Format a signal, without the line end.
| [out] | buffer | Output, of size maxFormatLenght |
| [in] | name | Signal name |
| [in] | values | Signal values |
| [in] | valueCount | Number of values |