Change analogWrite to ledcWrite, configuration improvements

This commit is contained in:
2026-01-28 15:46:37 +01:00
parent 107339b3d3
commit 564ed20720
11 changed files with 340 additions and 304 deletions

View File

@@ -1,5 +1,4 @@
#pragma once
#include <Preferences.h>
#include <ArduinoJson.h>
#include <variant>
@@ -45,8 +44,8 @@ static const ConfigDef configdefs[] = {
{"apMask", ConfigType::STRING, String("255.255.255.0")},
{"stopApTime", ConfigType::SHORT, int16_t(0)},
{"cpuSpeed", ConfigType::SHORT, int16_t(160)},
{"ledBrightness", ConfigType::BYTE, uint8_t(96)},
{"ledRgbBrightness", ConfigType::BYTE, uint8_t(96)},
{"ledBrightness", ConfigType::SHORT, int16_t(96)},
{"ledRgbBrightness", ConfigType::SHORT, int16_t(96)},
{"tempFormat", ConfigType::CHAR, 'C'},
{"switchBank", ConfigType::BYTE, uint8_t(0)},
{"key1", ConfigType::BYTE, uint8_t(1)},
@@ -76,6 +75,7 @@ private:
Preferences& prefs;
std::map<String, ConfigValue> values;
std::map<String, const ConfigDef*> defs;
[[noreturn]] void error_abort() const;
public:
explicit Config(Preferences& prefs);
void load();
@@ -92,4 +92,8 @@ public:
float getFloat(const char* key) const;
char getChar(const char* key) const;
const String& getString(const char* key) const;
const char* getCString(const char* key) const;
};
extern Config config;