figments: command: rewrite command api to use Task instances instead of static functions

This commit is contained in:
Torrie Fischer
2023-12-20 09:13:23 +01:00
parent 214825c1d3
commit 6e138175be
14 changed files with 76 additions and 81 deletions

View File

@@ -30,26 +30,6 @@ doForceBrightness(Args& args, Print& out)
Static<Power>::instance()->forceBrightness(newBrightness);
}
void
Power::forceBrightness(uint8_t v)
{
m_forced = true;
FastLED.setBrightness(v);
}
const std::vector<Command> _commands = {
{"brightness", doBrightness},
{"brightness-force", doForceBrightness},
{"on", doOn},
{"off", doOff}
};
const std::vector<Command>&
Power::commands() const
{
return _commands;
}
void
Power::handleConfigChange(const Configuration& config)
{

View File

@@ -53,9 +53,6 @@ public:
}
void forceBrightness(uint8_t v);
const std::vector<Command>& commands() const override;
private:
AnimatedNumber m_powerState = 255;
AnimatedNumber m_brightness = 255;