Dev #26

Open
overseer wants to merge 65 commits from dev into main
3 changed files with 19 additions and 11 deletions
Showing only changes of commit f6a25fc324 - Show all commits
+11 -6
View File
@@ -27,20 +27,25 @@ lib_deps =
build_flags = build_flags =
-D CORE_DEBUG_LEVEL=0 -D CORE_DEBUG_LEVEL=0
; ── ESP8266: Camera Bridge ────────────────────────────────── ; ── ESP-01S: Camera Bridge ──────────────────────────────────
; Flashed onto D1 Mini. Talks to GoPro over Wi-Fi, relays to ; Flashed onto an ESP-01S (ESP8266, 1MB flash). Talks to the GoPro
; ESP32 over UART (TX/RX pins). No MQTT, no router connection. ; over Wi-Fi, relays to the XIAO over the hardware UART (GPIO1/3).
; No MQTT, no router connection.
;
; Flash with a 3.3V USB-UART adapter: tie GPIO0 → GND, power up /
; reset into bootloader, then upload. ESP-01S flash is qio/dout;
; keep upload_speed modest for adapter reliability.
[env:esp8266-camera] [env:esp8266-camera]
platform = espressif8266 platform = espressif8266
board = d1_mini board = esp01_1m
framework = arduino framework = arduino
monitor_speed = 115200 monitor_speed = 115200
upload_speed = 921600 upload_speed = 115200
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
build_flags = ${common.build_flags} build_flags = ${common.build_flags}
-D PIO_FRAMEWORK_ARDUINO_MMU_CACHE16_IRAM48_SECHEAP_SHARED -D PIO_FRAMEWORK_ARDUINO_MMU_CACHE16_IRAM48_SECHEAP_SHARED
board_build.flash_mode = dio board_build.flash_mode = dout
board_build.f_cpu = 160000000L board_build.f_cpu = 160000000L
build_src_filter = build_src_filter =
-<*.cpp> -<*.cpp>
+8 -5
View File
@@ -30,12 +30,12 @@
#include <WiFiClient.h> #include <WiFiClient.h>
#include <PubSubClient.h> #include <PubSubClient.h>
#include <ArduinoJson.h> #include <ArduinoJson.h>
#include <SPIFFS.h> #include <LittleFS.h>
#include <Wire.h> #include <Wire.h>
#include <U8g2lib.h> #include <U8g2lib.h>
// ──────────────────────────────────────────── // ────────────────────────────────────────────
// Configuration (SPIFFS) // Configuration (LittleFS)
// ──────────────────────────────────────────── // ────────────────────────────────────────────
struct Config { struct Config {
@@ -54,8 +54,8 @@ struct Config {
} cfg; } cfg;
bool loadConfig() { bool loadConfig() {
if (!SPIFFS.begin(true)) { Serial.println("[CFG] SPIFFS mount failed"); return false; } if (!LittleFS.begin(true)) { Serial.println("[CFG] LittleFS mount failed"); return false; }
File f = SPIFFS.open("/config.json", "r"); File f = LittleFS.open("/config.json", "r");
if (!f) { Serial.println("[CFG] No config — using defaults"); return false; } if (!f) { Serial.println("[CFG] No config — using defaults"); return false; }
JsonDocument doc; JsonDocument doc;
@@ -71,11 +71,14 @@ bool loadConfig() {
cfg.heartbeat_sec = doc["heartbeat_interval_sec"] | cfg.heartbeat_sec; cfg.heartbeat_sec = doc["heartbeat_interval_sec"] | cfg.heartbeat_sec;
cfg.bat_raw_min = doc["bat_raw_min"] | cfg.bat_raw_min; cfg.bat_raw_min = doc["bat_raw_min"] | cfg.bat_raw_min;
cfg.bat_raw_max = doc["bat_raw_max"] | cfg.bat_raw_max; cfg.bat_raw_max = doc["bat_raw_max"] | cfg.bat_raw_max;
Serial.printf("[CFG] Loaded: ssid=%s broker=%s:%d cam=%s\n",
cfg.wifi_ssid.c_str(), cfg.mqtt_broker.c_str(), cfg.mqtt_port,
cfg.camera_id.length() ? cfg.camera_id.c_str() : "-");
return true; return true;
} }
bool saveConfig() { bool saveConfig() {
File f = SPIFFS.open("/config.json", "w"); File f = LittleFS.open("/config.json", "w");
if (!f) return false; if (!f) return false;
JsonDocument doc; JsonDocument doc;
doc["wifi_ssid"] = cfg.wifi_ssid; doc["wifi_ssid"] = cfg.wifi_ssid;