mirror of
https://github.com/ratspeak/ratdeck.git
synced 2026-04-25 10:22:08 +00:00
- GPS time sync via UBlox MIA-M10Q (38400 baud auto-detect) - Custom zero-dependency NMEA parser with XOR checksum validation - Only trust GPS time when satellites > 0 (no stale RTC cache) - DST-aware timezone picker at first boot (21 cities, POSIX TZ strings) - Timezone also configurable in Settings > GPS/Time - GPS Time on by default, GPS Location off by default (opt-in) - Status bar: clock (top-left), Ratspeak.org (center), battery (right) - 12h time default (no AM/PM), configurable 24h in settings - NVS persistence of GPS time for approximate timestamps across reboots - Fix factory reset Enter key bleed-through (600ms input guard) - Fix hardcoded UTC-5 NTP timezone (now uses DST-aware POSIX TZ)
93 lines
2.5 KiB
C++
93 lines
2.5 KiB
C++
#pragma once
|
|
|
|
#include <Arduino.h>
|
|
#include <ArduinoJson.h>
|
|
#include <vector>
|
|
#include "storage/FlashStore.h"
|
|
#include "storage/SDStore.h"
|
|
#include "config/Config.h"
|
|
#include "config/BoardConfig.h"
|
|
|
|
enum RatWiFiMode : uint8_t { RAT_WIFI_OFF = 0, RAT_WIFI_AP = 1, RAT_WIFI_STA = 2 };
|
|
|
|
struct TCPEndpoint {
|
|
String host;
|
|
uint16_t port = TCP_DEFAULT_PORT;
|
|
bool autoConnect = true;
|
|
};
|
|
|
|
struct UserSettings {
|
|
// Radio
|
|
uint32_t loraFrequency = LORA_DEFAULT_FREQ;
|
|
uint8_t loraSF = LORA_DEFAULT_SF;
|
|
uint32_t loraBW = LORA_DEFAULT_BW;
|
|
uint8_t loraCR = LORA_DEFAULT_CR;
|
|
int8_t loraTxPower = LORA_DEFAULT_TX_POWER;
|
|
long loraPreamble = LORA_DEFAULT_PREAMBLE;
|
|
|
|
// WiFi
|
|
RatWiFiMode wifiMode = RAT_WIFI_STA;
|
|
String wifiAPSSID;
|
|
String wifiAPPassword = WIFI_AP_PASSWORD;
|
|
String wifiSTASSID;
|
|
String wifiSTAPassword;
|
|
|
|
// TCP outbound connections (STA mode only)
|
|
std::vector<TCPEndpoint> tcpConnections;
|
|
|
|
// Display
|
|
uint16_t screenDimTimeout = 30; // seconds
|
|
uint16_t screenOffTimeout = 60; // seconds
|
|
uint8_t brightness = 100; // Percentage 1-100
|
|
bool denseFontMode = false; // T-Deck Plus: adaptive font toggle
|
|
|
|
// Trackball
|
|
uint8_t trackballSpeed = 3; // 1-5 sensitivity
|
|
|
|
// Touch
|
|
uint8_t touchSensitivity = 3; // 1-5
|
|
|
|
// BLE
|
|
bool bleEnabled = false;
|
|
|
|
// GPS & Time
|
|
bool gpsTimeEnabled = true; // GPS time sync (default ON)
|
|
bool gpsLocationEnabled = false; // GPS position tracking (default OFF, user must opt in)
|
|
uint8_t timezoneIdx = 6; // Index into TIMEZONE_TABLE (default: New York EST/EDT)
|
|
bool timezoneSet = false; // false = show timezone picker at boot
|
|
bool use24HourTime = false; // false = 12h (no AM/PM), true = 24h
|
|
|
|
// Audio
|
|
bool audioEnabled = true;
|
|
uint8_t audioVolume = 80; // 0-100
|
|
|
|
// Identity
|
|
String displayName;
|
|
|
|
// Announce
|
|
uint16_t announceInterval = 5; // minutes, 5-360
|
|
|
|
// Developer mode — unlocks custom radio parameters
|
|
bool devMode = false;
|
|
};
|
|
|
|
class UserConfig {
|
|
public:
|
|
// Flash-only (original API, kept for compatibility)
|
|
bool load(FlashStore& flash);
|
|
bool save(FlashStore& flash);
|
|
|
|
// Dual-backend: SD primary, flash fallback
|
|
bool load(SDStore& sd, FlashStore& flash);
|
|
bool save(SDStore& sd, FlashStore& flash);
|
|
|
|
UserSettings& settings() { return _settings; }
|
|
const UserSettings& settings() const { return _settings; }
|
|
|
|
private:
|
|
bool parseJson(const String& json);
|
|
String serializeToJson() const;
|
|
|
|
UserSettings _settings;
|
|
};
|