#pragma once #include #include #include #include #include #include "leds/preset.hpp" #include "leds/ws2812.hpp" class Pattern; class Presets { public: static constexpr size_t kStripCount = 8; Presets(); ~Presets(); bool select(const std::string& name, int step = -1); bool edit(const std::string& name, const Preset& preset); bool remove(const std::string& name); void tick(); void fill(RGB color); void fill_n(RGB color, int first, int last); bool set(size_t strip, int reference_index, RGB color); RGB apply_brightness(RGB color, int local = 255) const; void show_all(); void show_all_parallel(); void off(); void on(Preset* preset); uint16_t strip_length(size_t strip) const; std::array, kStripCount> strips; std::array strip_midpoints{}; std::array, kStripCount> scale_map; std::unordered_map presets; std::unique_ptr current; std::string selected; int step = 0; int last_roll_head = 0; uint8_t b = 255; private: std::unique_ptr make_pattern(const std::string& name) const; };