2019-05-10 05:17:29 +00:00
|
|
|
#include "./Figment.h"
|
2023-12-20 08:17:10 +00:00
|
|
|
#include "./Animation.h"
|
|
|
|
#include "./Input.h"
|
2019-05-10 05:17:29 +00:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
class Display;
|
|
|
|
|
|
|
|
struct Renderer: public Task {
|
|
|
|
public:
|
2022-06-11 09:02:27 +00:00
|
|
|
Renderer(std::vector<Display*>&& displays, const std::vector<Figment*> &figments) : Task("Renderer"), m_figments(figments), m_displays(std::move(displays)) {}
|
2019-05-10 05:17:29 +00:00
|
|
|
|
|
|
|
void loop() override;
|
|
|
|
void onStart() override;
|
2023-12-20 08:17:10 +00:00
|
|
|
void handleEvent(const InputEvent& evt) override;
|
2019-05-10 05:17:29 +00:00
|
|
|
|
2023-12-11 06:50:28 +00:00
|
|
|
static const char* lastFigmentName();
|
|
|
|
|
2023-12-20 08:17:10 +00:00
|
|
|
const std::vector<Command>& commands() const override;
|
|
|
|
|
2019-05-10 05:17:29 +00:00
|
|
|
private:
|
|
|
|
const std::vector<Figment*> m_figments;
|
|
|
|
const std::vector<Display*> m_displays;
|
2023-12-20 08:17:10 +00:00
|
|
|
|
|
|
|
AnimatedNumber m_powerState = 255;
|
|
|
|
AnimatedNumber m_brightness = 255;
|
|
|
|
bool m_powerManaged = true;
|
|
|
|
|
2023-12-23 10:06:50 +00:00
|
|
|
uint16_t m_voltage = 5;
|
|
|
|
uint16_t m_milliamps = 500;
|
2023-12-20 08:17:10 +00:00
|
|
|
|
|
|
|
uint8_t powerScale(uint8_t target, uint32_t totalPower) const;
|
|
|
|
|
|
|
|
void doBrightness(Args& args, Print& print);
|
|
|
|
void doOn(Args& args, Print& print);
|
|
|
|
void doOff(Args& args, Print& print);
|
2019-05-10 05:17:29 +00:00
|
|
|
};
|