Wemos D1 Mini Frimware zur Steuerung einer RGBW-LED-Lampe
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

ConfigManager.h 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * ConfigManager.h
  3. *
  4. * Created on: 21.06.2026
  5. * Author: FSmilari
  6. */
  7. #ifndef CONFIGMANAGER_H_
  8. #define CONFIGMANAGER_H_
  9. #include <Arduino.h>
  10. #include <EEPROM.h>
  11. #include "LEDModes.h"
  12. #define CONFIG_VERSION 3
  13. typedef struct __attribute__((packed)) {
  14. uint8_t r;
  15. uint8_t g;
  16. uint8_t b;
  17. uint8_t w;
  18. } RGBWColor;
  19. typedef struct __attribute__((packed)) {
  20. uint8_t version;
  21. char ssid[32];
  22. char pass[64];
  23. bool wifiValid;
  24. LEDModes mode;
  25. uint8_t brightness;
  26. RGBWColor singleColor;
  27. RGBWColor segmentColor1;
  28. RGBWColor segmentColor2;
  29. RGBWColor segmentColor3;
  30. uint32_t rainbowDelay;
  31. uint32_t spectralStepTime;
  32. uint32_t fadingHoldTime;
  33. uint32_t fadingFadeTime;
  34. uint32_t flashOnTime;
  35. uint32_t flashOffTime;
  36. } Config;
  37. class ConfigManager {
  38. public:
  39. ConfigManager();
  40. virtual ~ConfigManager();
  41. bool loadConfig();
  42. bool saveConfig(const Config &config);
  43. void resetConfig();
  44. Config& setToDefaultConfig();
  45. Config& setToDefaultWiFiConfig(Config &config);
  46. Config& setToDefaultLEDConfig(Config &config);
  47. Config& getConfig();
  48. private:
  49. Config _config;
  50. };
  51. #endif /* CONFIGMANAGER_H_ */