41 lines
808 B
C++
41 lines
808 B
C++
#pragma once
|
|
#include <Arduino.h>
|
|
#include <Preferences.h>
|
|
#include <WebServer.h>
|
|
|
|
struct AppSettings
|
|
{
|
|
// Camera
|
|
int contrast = 0; // -2 to 2
|
|
int brightness = 0; // -2 to 2
|
|
bool vFlip = false;
|
|
bool hMirror = false;
|
|
|
|
// Printer
|
|
int heatTime = 120; // 0-255 (Higher = darker but slower)
|
|
int heatInterval = 50; // 0-255
|
|
|
|
// Upload
|
|
String uploadUrl = ""; // e.g., "http://192.168.1.10:3000/upload"
|
|
bool enableUpload = false;
|
|
};
|
|
|
|
class SettingsService
|
|
{
|
|
private:
|
|
Preferences prefs;
|
|
WebServer server;
|
|
AppSettings currentSettings;
|
|
bool wifiConnected = false;
|
|
|
|
void setupRoutes();
|
|
void loadSettings();
|
|
|
|
public:
|
|
SettingsService();
|
|
void begin();
|
|
void handle();
|
|
|
|
AppSettings &get() { return currentSettings; }
|
|
void save();
|
|
}; |