Moved settings from preprocessor directives to variables. Also added a way to (for now only) display them via HTTP server.
This commit is contained in:
@ -3,6 +3,7 @@
|
||||
#include <Arduino.h>
|
||||
#define FASTLED_INTERNAL
|
||||
#include <FastLED.h>
|
||||
#include "prototypes.h"
|
||||
|
||||
//#define DEBUG // Uncomment this to enable Debug messages via Serial and, if enabled, MQTT.
|
||||
//#define CONFIG_USABLE // Uncomment this by removing the // at the beginning!
|
||||
@ -49,39 +50,35 @@
|
||||
#define MONITOR_LOOP_TIME_THRESHOLD 500
|
||||
#define MONITOR_LOOP_TIME_COUNT_MAX 10
|
||||
|
||||
#define EFFECT_CYCLE_TIME 300 // Time in seconds between cycling effects.
|
||||
#define EFFECT_CYCLE_RANDOM true
|
||||
// settings.effects.cycle.time = 300; // Time in seconds between cycling effects.
|
||||
// settings.effects.cycle.random = true;
|
||||
|
||||
#define EFFECT_MATRIX_LENGTH_MIN 4
|
||||
#define EFFECT_MATRIX_LENGTH_MAX 20
|
||||
#define EFFECT_MATRIX_SPEED_MIN 50
|
||||
#define EFFECT_MATRIX_SPEED_MAX 135
|
||||
// settings.effects.matrix.length_min = 4;
|
||||
// settings.effects.matrix.length_max = 20;
|
||||
// settings.effects.matrix.speed_min = 1;
|
||||
// settings.effects.matrix.speed_max = 10;
|
||||
|
||||
#define EFFECT_SINGLE_DYNAMIC_LOOP_TIME 40
|
||||
#define EFFECT_MULTI_DYNAMIC_LOOP_TIME 1400
|
||||
#define EFFECT_BIG_DYNAMIC_LOOP_TIME 50
|
||||
#define EFFECT_BIG_DYNAMIC_SIZE 3
|
||||
// .dynamic.single_loop_time = 40;
|
||||
// .dynamic.multi_loop_time = 1400;
|
||||
// .dynamic.big_loop_time = 50;
|
||||
// .dynamic.big_size = 3;
|
||||
|
||||
#define EFFECT_CONFETTI_PIXELS_PER_LOOP 2
|
||||
// .fire.cooldown = 192;
|
||||
// .fire.spark_chance = 5;
|
||||
|
||||
#define EFFECT_SNAKE_DIRECTION_CHANGE 10
|
||||
#define EFFECT_SNAKE_SLOWDOWN 2
|
||||
// .firework.drag = 255;
|
||||
// .firework.bounce = 200;
|
||||
// .firework.gravity = 10;
|
||||
// .firework.sparks = 12;
|
||||
|
||||
#define EFFECT_FIRE_COOLDOWN 192
|
||||
#define EFFECT_FIRE_SPARK_CHANCE 5
|
||||
// .gol.start_percentage = 90;
|
||||
// .gol.blend_speed = 10;
|
||||
// .gol.restart_after_steps = 100;
|
||||
|
||||
#define EFFECT_FIREWORK_SHOT_CHANCE 200
|
||||
#define EFFECT_FIREWORK_BLUR 200
|
||||
#define EFFECT_FIREWORK_FADEOUT_SPEED 5
|
||||
// .sines.count = 5;
|
||||
|
||||
#define EFFECT_GOL_START_PERCENTAGE 90
|
||||
#define EFFECT_GOL_BLEND_SPEED 10
|
||||
#define EFFECT_GOL_RESTART_AFTER_STEPS 100
|
||||
|
||||
#define EFFECT_DVD_WIDTH 3
|
||||
#define EFFECT_DVD_HEIGHT 2
|
||||
|
||||
#define EFFECT_SINES_COUNT 5
|
||||
// .snake.direction_change = 5;
|
||||
// .snake.slowdown = 2;
|
||||
|
||||
// Stop editing here
|
||||
|
||||
|
@ -6,11 +6,6 @@
|
||||
|
||||
enum FireworkDotType { FIREWORK_DOT_NONE, FIREWORK_DOT_SHELL, FIREWORK_DOT_SPARK };
|
||||
|
||||
#define EFFECT_FIREWORK_DRAG 255
|
||||
#define EFFECT_FIREWORK_BOUNCE 200
|
||||
#define EFFECT_FIREWORK_GRAVITY 10
|
||||
#define EFFECT_FIREWORK_SPARKS 12
|
||||
|
||||
class FireworkEffect;
|
||||
|
||||
class FireworkEffectDot {
|
||||
@ -49,7 +44,7 @@ private:
|
||||
CRGB _burst_color;
|
||||
|
||||
FireworkEffectDot* _dot;
|
||||
FireworkEffectDot* _sparks[EFFECT_FIREWORK_SPARKS];
|
||||
FireworkEffectDot** _sparks;
|
||||
public:
|
||||
FireworkEffect();
|
||||
~FireworkEffect();
|
||||
|
@ -20,7 +20,7 @@ public:
|
||||
|
||||
class SinesEffect : public Effect {
|
||||
private:
|
||||
SinesEffectSinus* _sinus[EFFECT_SINES_COUNT];
|
||||
SinesEffectSinus** _sinus;
|
||||
uint8_t _step = 0;
|
||||
public:
|
||||
SinesEffect();
|
||||
|
@ -2,6 +2,9 @@
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
extern uint8_t baseHue;
|
||||
extern char hostname[30];
|
||||
|
||||
typedef struct {
|
||||
uint8_t width;
|
||||
uint8_t height;
|
||||
@ -27,5 +30,78 @@ typedef struct {
|
||||
uint16_t y;
|
||||
} Coords;
|
||||
|
||||
extern uint8_t baseHue;
|
||||
extern char hostname[30];
|
||||
enum SettingType {
|
||||
TYPE_UINT8,
|
||||
TYPE_UINT16,
|
||||
TYPE_BOOL
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
const char* name;
|
||||
uint16_t* value;
|
||||
SettingType type;
|
||||
} Setting;
|
||||
|
||||
struct /* settings */{
|
||||
uint16_t fps = 50;
|
||||
|
||||
struct /* effects */ {
|
||||
struct /* cycle */ {
|
||||
uint16_t time = 300;
|
||||
uint16_t random = 1;
|
||||
} cycle ;
|
||||
|
||||
struct /* matrix */ {
|
||||
uint16_t length_min = 4;
|
||||
uint16_t length_max = 20;
|
||||
uint16_t speed_min = 1;
|
||||
uint16_t speed_max = 10;
|
||||
} matrix;
|
||||
|
||||
struct /* confetti */ {
|
||||
uint16_t pixels_per_loop = 2;
|
||||
} confetti;
|
||||
|
||||
struct /* dvd */ {
|
||||
uint16_t width = 3;
|
||||
uint16_t height = 2;
|
||||
} dvd;
|
||||
|
||||
struct /* dynamic */ {
|
||||
uint16_t single_loop_time = 40;
|
||||
uint16_t multi_loop_time = 1400;
|
||||
uint16_t big_loop_time = 50;
|
||||
uint16_t big_size = 3;
|
||||
} dynamic;
|
||||
|
||||
struct /* fire */ {
|
||||
uint16_t cooldown = 192;
|
||||
uint16_t spark_chance = 5;
|
||||
} fire;
|
||||
|
||||
struct /* firework */ {
|
||||
uint16_t drag = 255;
|
||||
uint16_t bounce = 200;
|
||||
uint16_t gravity = 10;
|
||||
uint16_t sparks = 12;
|
||||
} firework;
|
||||
|
||||
struct /* gol */ {
|
||||
uint16_t start_percentage = 90;
|
||||
uint16_t blend_speed = 10;
|
||||
uint16_t restart_after_steps = 100;
|
||||
} gol;
|
||||
|
||||
struct /* sines */ {
|
||||
uint16_t count = 5;
|
||||
} sines;
|
||||
|
||||
struct /* snake */ {
|
||||
uint16_t direction_change = 5;
|
||||
uint16_t slowdown = 2;
|
||||
} snake;
|
||||
} effects;
|
||||
} settings;
|
||||
|
||||
extern Setting all_settings[];
|
||||
extern const uint8_t all_settings_size;
|
||||
|
Reference in New Issue
Block a user