| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- /*
- * ConfigManager.h
- *
- * Created on: 21.06.2026
- * Author: FSmilari
- */
-
- #ifndef CONFIGMANAGER_H_
- #define CONFIGMANAGER_H_
-
- #include <Arduino.h>
- #include <ArduinoJson.h>
- #include <EEPROM.h>
- #include "LEDModes.h"
-
- #define CONFIG_VERSION 3
-
- typedef struct __attribute__((packed)) {
- uint8_t r;
- uint8_t g;
- uint8_t b;
- uint8_t w;
- } RGBWColor;
-
- typedef struct __attribute__((packed)) {
- uint8_t version;
-
- char ssid[32];
- char pass[64];
- bool wifiValid;
- LEDModes mode;
- uint8_t brightness;
- RGBWColor singleColor;
- RGBWColor segmentColor1;
- RGBWColor segmentColor2;
- RGBWColor segmentColor3;
- uint32_t rainbowDelay;
- uint32_t spectralStepTime;
- uint32_t fadingHoldTime;
- uint32_t fadingFadeTime;
- uint32_t flashOnTime;
- uint32_t flashOffTime;
- } Config;
-
- class ConfigManager {
-
- public:
- ConfigManager();
- virtual ~ConfigManager();
-
- bool loadConfig();
- bool saveConfig(const Config &config);
- void resetConfig();
- Config& setToDefaultConfig();
- Config& setToDefaultWiFiConfig(Config &config);
- Config& setToDefaultLEDConfig(Config &config);
- Config& getConfig();
- void getConfig(JsonDocument &doc);
-
-
- private:
- Config _config;
-
- void rgbwToJson(const RGBWColor &c, JsonObject obj);
- };
-
- #endif /* CONFIGMANAGER_H_ */
|