config: first version of storing pixel maps and configs in SPIFFS
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
This commit is contained in:
50
src/main.cpp
50
src/main.cpp
@@ -12,17 +12,13 @@
|
||||
#include "Static.h"
|
||||
#include "Config.h"
|
||||
|
||||
#include "Sequencer.h"
|
||||
#include "LogService.h"
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#include "animations/Power.h"
|
||||
#include "animations/SolidAnimation.h"
|
||||
#include "animations/Chimes.h"
|
||||
#include "animations/Flashlight.h"
|
||||
#include "animations/Drain.h"
|
||||
#include "animations/UpdateStatus.h"
|
||||
#include "animations/InputBlip.h"
|
||||
|
||||
#include "inputs/ColorCycle.h"
|
||||
#include "inputs/Buttons.h"
|
||||
@@ -65,32 +61,6 @@ REGISTER_TASK(power);
|
||||
}
|
||||
});*/
|
||||
|
||||
class InputBlip: public Figment {
|
||||
public:
|
||||
InputBlip() : Figment("InputBlip", Task::Stopped) {}
|
||||
|
||||
void handleEvent(const InputEvent& evt) override {
|
||||
if (evt.intent != InputEvent::None) {
|
||||
m_time = qadd8(m_time, 5);
|
||||
}
|
||||
}
|
||||
void loop() override {
|
||||
if (m_time > 0) {
|
||||
m_time--;
|
||||
}
|
||||
}
|
||||
void render(Display* dpy) const override {
|
||||
if (m_time > 0) {
|
||||
dpy->pixelAt(0) = CRGB(0, brighten8_video(ease8InOutApprox(m_time)), 0);
|
||||
}
|
||||
}
|
||||
private:
|
||||
uint8_t m_time = 0;
|
||||
};
|
||||
|
||||
InputBlip inputBlip;
|
||||
REGISTER_TASK(inputBlip);
|
||||
|
||||
InputFunc randomPulse([]() {
|
||||
static unsigned int pulse = 0;
|
||||
EVERY_N_MILLISECONDS(25) {
|
||||
@@ -131,22 +101,6 @@ InputMapper keyMap([](const InputEvent& evt) {
|
||||
|
||||
REGISTER_TASK(keyMap);
|
||||
|
||||
|
||||
#ifndef DEFAULT_PATTERN_INDEX
|
||||
#define DEFAULT_PATTERN_INDEX 0
|
||||
#endif
|
||||
|
||||
Sequencer sequencer{{
|
||||
{"Idle", {"Solid", "MPU5060", "Pulse", "IdleColors", "CircadianRhythm"}},
|
||||
{"Acid", {"Chimes", "Pulse", "MPU5060", "IdleColors", "Rainbow"}},
|
||||
{"Solid", {"Solid", "MPU5060", "Pulse", "CircadianRhythm"}},
|
||||
{"Interactive", {"Drain", "MPU5060", "CircadianRhythm"}},
|
||||
{"Flashlight", {"Flashlight"}},
|
||||
{"Gay", {"Solid", "Pulse", "Rainbow"}},
|
||||
}, DEFAULT_PATTERN_INDEX};
|
||||
|
||||
REGISTER_TASK(sequencer);
|
||||
|
||||
class BPM : public InputSource {
|
||||
public:
|
||||
BPM() : InputSource("BPM") {}
|
||||
@@ -218,7 +172,7 @@ REGISTER_TASK(renderer);
|
||||
|
||||
Renderer configRenderer{
|
||||
{&dpy},
|
||||
{Static<DrainAnimation>::instance(), /*&configDisplay,*/ &inputBlip, &power}
|
||||
{Static<DrainAnimation>::instance(), /*&configDisplay,*/ Static<InputBlip>::instance(), &power}
|
||||
};
|
||||
|
||||
// Cycle some random colors
|
||||
|
Reference in New Issue
Block a user