mirror of
https://github.com/xoseperez/espurna.git
synced 2026-03-23 00:27:06 +01:00
Implement strongly-typed time units via std::chrono, compile-time checks with static delays and limit possible values in the pattern parser. Clamp 'repeats' as well, instead of relying on overflow Rework internal loop & template runners, so there's no need to proxy status and led struct all over. Instead, simply declare two separate funcs that are supposed to be run during the pattern and at it's end. Instead of cloning the 'delays' array, implement a sequence iterator that is tracking the currently used delay and it's repeats, and which also jumps to the next entry in the list. (but, this uses c++ iterators, and *may* be prone to errors) Implement small terminal command 'led <ID> [<PATTERN STRING>]'. Running without the 'PATTERN STRING' resets the LED to the values in settings. Move re2c-generated parser back into a separate file, use .cpp.inc as include and .re as the source ref. #2476, fix 'finite' pattern handling
31 lines
380 B
C++
31 lines
380 B
C++
/*
|
|
|
|
LED MODULE
|
|
|
|
Copyright (C) 2016-2019 by Xose Pérez <xose dot perez at gmail dot com>
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <cstdint>
|
|
|
|
enum class LedMode {
|
|
Manual,
|
|
WiFi,
|
|
Follow,
|
|
FollowInverse,
|
|
FindMe,
|
|
FindMeWiFi,
|
|
On,
|
|
Off,
|
|
Relay,
|
|
RelayWiFi
|
|
};
|
|
|
|
size_t ledCount();
|
|
|
|
bool ledStatus(size_t id, bool status);
|
|
bool ledStatus(size_t id);
|
|
void ledSetup();
|