51 lines
729 B
C++
51 lines
729 B
C++
#pragma once
|
|
|
|
#include <Arduino.h>
|
|
|
|
struct DeviceConfig {
|
|
String name;
|
|
String hostname;
|
|
};
|
|
|
|
struct MotorConfig {
|
|
long stepsPerRevolution;
|
|
float maxSpeed;
|
|
float acceleration;
|
|
bool reverseDirection;
|
|
bool holdPosition;
|
|
};
|
|
|
|
struct WifiConfig {
|
|
String ssid;
|
|
String password;
|
|
String apName;
|
|
String apPassword;
|
|
};
|
|
|
|
struct LimitConfig {
|
|
bool enabled;
|
|
int leftPin;
|
|
int rightPin;
|
|
bool activeHigh;
|
|
};
|
|
|
|
struct AppConfig {
|
|
DeviceConfig device;
|
|
MotorConfig motor;
|
|
WifiConfig wifi;
|
|
LimitConfig limits;
|
|
};
|
|
|
|
class ConfigManager {
|
|
public:
|
|
bool begin();
|
|
bool load();
|
|
bool save();
|
|
void resetToDefaults();
|
|
const AppConfig& get() const;
|
|
AppConfig& mutableConfig();
|
|
|
|
private:
|
|
AppConfig config_;
|
|
};
|