init
This commit is contained in:
41
include/settings_service.h
Normal file
41
include/settings_service.h
Normal file
@@ -0,0 +1,41 @@
|
||||
#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();
|
||||
};
|
||||
Reference in New Issue
Block a user