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 795B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 1
  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 color;
  27. } Config;
  28. class ConfigManager {
  29. public:
  30. ConfigManager();
  31. virtual ~ConfigManager();
  32. bool loadConfig();
  33. bool saveConfig(const Config &config);
  34. void resetConfig();
  35. Config& setToDefaultConfig();
  36. Config& getConfig();
  37. private:
  38. Config _config;
  39. };
  40. #endif /* CONFIGMANAGER_H_ */