2022-06-19 23:31:24 +02:00
|
|
|
#include "app.h"
|
|
|
|
#include "driver/adc.h"
|
2022-06-19 14:07:40 +02:00
|
|
|
#include "zauberstab.h"
|
|
|
|
#include <vector>
|
|
|
|
|
2022-06-19 23:31:24 +02:00
|
|
|
struct BeatDetectApp beat_detect_app
|
|
|
|
{
|
|
|
|
};
|
|
|
|
struct VuMeterApp vu_meter_app
|
|
|
|
{
|
|
|
|
};
|
|
|
|
struct FFTTestApp fft_test_app
|
|
|
|
{
|
|
|
|
};
|
|
|
|
struct FackelApp fackel_app
|
|
|
|
{
|
|
|
|
};
|
2022-06-20 20:27:03 +02:00
|
|
|
struct FftDetectApp fft_detect_app
|
|
|
|
{
|
|
|
|
};
|
2022-06-19 14:07:40 +02:00
|
|
|
|
|
|
|
std::vector<std::reference_wrapper<App>> apps = {
|
|
|
|
std::ref<App>(beat_detect_app),
|
|
|
|
std::ref<App>(vu_meter_app),
|
|
|
|
std::ref<App>(fft_test_app),
|
2022-06-20 20:27:03 +02:00
|
|
|
std::ref<App>(fackel_app),
|
|
|
|
std::ref<App>(fft_detect_app)};
|
2022-06-19 14:07:40 +02:00
|
|
|
|
2022-06-20 22:18:36 +02:00
|
|
|
unsigned int current_app = 0;
|
2022-06-19 14:07:40 +02:00
|
|
|
unsigned int next_app;
|
|
|
|
|
|
|
|
void setup()
|
|
|
|
{
|
|
|
|
next_app = current_app;
|
|
|
|
zauberstab_init();
|
|
|
|
Serial.begin(115200);
|
|
|
|
|
|
|
|
apps[current_app].get().init();
|
|
|
|
}
|
|
|
|
|
|
|
|
void loop()
|
|
|
|
{
|
2022-06-19 23:31:24 +02:00
|
|
|
/* EVERY_N_SECONDS(30)
|
|
|
|
{
|
|
|
|
next_app++;
|
|
|
|
next_app = next_app % apps.size();
|
|
|
|
} */
|
|
|
|
|
|
|
|
if (next_app != current_app)
|
|
|
|
{
|
2022-06-19 14:07:40 +02:00
|
|
|
apps[current_app].get().deinit();
|
|
|
|
apps[next_app].get().init();
|
|
|
|
current_app = next_app;
|
2022-06-19 15:16:26 +02:00
|
|
|
fadeToBlackBy(leds, NUM_LEDS, 0xFF);
|
2022-06-19 14:07:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
apps[current_app].get().loop();
|
|
|
|
}
|