From 426b4a1332291db43c27adb4a499bca495db9684 Mon Sep 17 00:00:00 2001 From: Rune Harlyk Date: Tue, 12 Nov 2024 11:54:10 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=BC=20Removes=20the=20need=20to=20pass?= =?UTF-8?q?=20reference=20to=20fs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- esp32/lib/ESP32-sveltekit/CameraSettingsService.h | 2 +- esp32/lib/ESP32-sveltekit/FSPersistence.h | 5 ++--- esp32/lib/ESP32-sveltekit/LEDService.h | 1 - esp32/lib/ESP32-sveltekit/Peripherals.h | 3 +-- esp32/lib/ESP32-sveltekit/ServoController.h | 2 +- esp32/lib/ESP32-sveltekit/ap_service.cpp | 2 +- esp32/lib/ESP32-sveltekit/ntp_service.cpp | 2 +- esp32/lib/ESP32-sveltekit/wifi_service.cpp | 2 +- 8 files changed, 8 insertions(+), 11 deletions(-) diff --git a/esp32/lib/ESP32-sveltekit/CameraSettingsService.h b/esp32/lib/ESP32-sveltekit/CameraSettingsService.h index 90e186e7..4df09009 100644 --- a/esp32/lib/ESP32-sveltekit/CameraSettingsService.h +++ b/esp32/lib/ESP32-sveltekit/CameraSettingsService.h @@ -24,7 +24,7 @@ class CameraSettingsService : public StatefulService { CameraSettingsService() : endpoint(CameraSettings::read, CameraSettings::update, this), _eventEndpoint(CameraSettings::read, CameraSettings::update, this, EVENT_CAMERA_SETTINGS), - _persistence(CameraSettings::read, CameraSettings::update, this, &ESPFS, CAMERA_SETTINGS_FILE) { + _persistence(CameraSettings::read, CameraSettings::update, this, CAMERA_SETTINGS_FILE) { addUpdateHandler([&](const String &originId) { updateCamera(); }, false); } diff --git a/esp32/lib/ESP32-sveltekit/FSPersistence.h b/esp32/lib/ESP32-sveltekit/FSPersistence.h index b1448aff..6431b42d 100644 --- a/esp32/lib/ESP32-sveltekit/FSPersistence.h +++ b/esp32/lib/ESP32-sveltekit/FSPersistence.h @@ -24,11 +24,10 @@ template class FSPersistence { public: FSPersistence(JsonStateReader stateReader, JsonStateUpdater stateUpdater, StatefulService *statefulService, - FS *fs, const char *filePath) + const char *filePath) : _stateReader(stateReader), _stateUpdater(stateUpdater), _statefulService(statefulService), - _fs(fs), _filePath(filePath), _updateHandlerId(0) { enableUpdateHandler(); @@ -98,7 +97,7 @@ class FSPersistence { JsonStateReader _stateReader; JsonStateUpdater _stateUpdater; StatefulService *_statefulService; - FS *_fs; + FS *_fs {&ESPFS}; const char *_filePath; size_t _bufferSize; update_handler_id_t _updateHandlerId; diff --git a/esp32/lib/ESP32-sveltekit/LEDService.h b/esp32/lib/ESP32-sveltekit/LEDService.h index bc390c31..d83bea70 100644 --- a/esp32/lib/ESP32-sveltekit/LEDService.h +++ b/esp32/lib/ESP32-sveltekit/LEDService.h @@ -2,7 +2,6 @@ #define LEDService_h #include -#include #ifndef WS2812_PIN #define WS2812_PIN 12 diff --git a/esp32/lib/ESP32-sveltekit/Peripherals.h b/esp32/lib/ESP32-sveltekit/Peripherals.h index f08dd56f..de484cc4 100644 --- a/esp32/lib/ESP32-sveltekit/Peripherals.h +++ b/esp32/lib/ESP32-sveltekit/Peripherals.h @@ -68,8 +68,7 @@ class Peripherals : public StatefulService { #if FT_ENABLED(USE_BMP) _bmp(10085), #endif - _persistence(PeripheralsConfiguration::read, PeripheralsConfiguration::update, this, &ESPFS, - DEVICE_CONFIG_FILE) { + _persistence(PeripheralsConfiguration::read, PeripheralsConfiguration::update, this, DEVICE_CONFIG_FILE) { _accessMutex = xSemaphoreCreateMutex(); addUpdateHandler([&](const String &originId) { updatePins(); }, false); }; diff --git a/esp32/lib/ESP32-sveltekit/ServoController.h b/esp32/lib/ESP32-sveltekit/ServoController.h index 07912815..49b2a869 100644 --- a/esp32/lib/ESP32-sveltekit/ServoController.h +++ b/esp32/lib/ESP32-sveltekit/ServoController.h @@ -20,7 +20,7 @@ class ServoController : public StatefulService { ServoController(Peripherals *peripherals) : _peripherals(peripherals), endpoint(ServoSettings::read, ServoSettings::update, this), - _persistence(ServoSettings::read, ServoSettings::update, this, &ESPFS, SERVO_SETTINGS_FILE) {} + _persistence(ServoSettings::read, ServoSettings::update, this, SERVO_SETTINGS_FILE) {} void begin() { socket.onEvent(EVENT_SERVO_CONFIGURATION_SETTINGS, diff --git a/esp32/lib/ESP32-sveltekit/ap_service.cpp b/esp32/lib/ESP32-sveltekit/ap_service.cpp index 0cd3d110..007fbff2 100644 --- a/esp32/lib/ESP32-sveltekit/ap_service.cpp +++ b/esp32/lib/ESP32-sveltekit/ap_service.cpp @@ -4,7 +4,7 @@ static const char *TAG = "APService"; APService::APService() : endpoint(APSettings::read, APSettings::update, this), - _persistence(APSettings::read, APSettings::update, this, &ESPFS, NTP_SETTINGS_FILE) { + _persistence(APSettings::read, APSettings::update, this, NTP_SETTINGS_FILE) { addUpdateHandler([&](const String &originId) { reconfigureAP(); }, false); } diff --git a/esp32/lib/ESP32-sveltekit/ntp_service.cpp b/esp32/lib/ESP32-sveltekit/ntp_service.cpp index b1532954..be1a8c2e 100644 --- a/esp32/lib/ESP32-sveltekit/ntp_service.cpp +++ b/esp32/lib/ESP32-sveltekit/ntp_service.cpp @@ -4,7 +4,7 @@ static const char *TAG = "NPT Service"; NTPService::NTPService() : endpoint(NTPSettings::read, NTPSettings::update, this), - _persistence(NTPSettings::read, NTPSettings::update, this, &ESPFS, NTP_SETTINGS_FILE) { + _persistence(NTPSettings::read, NTPSettings::update, this, NTP_SETTINGS_FILE) { addUpdateHandler([&](const String &originId) { configureNTP(); }, false); } diff --git a/esp32/lib/ESP32-sveltekit/wifi_service.cpp b/esp32/lib/ESP32-sveltekit/wifi_service.cpp index bb51510a..e4af65bb 100644 --- a/esp32/lib/ESP32-sveltekit/wifi_service.cpp +++ b/esp32/lib/ESP32-sveltekit/wifi_service.cpp @@ -2,7 +2,7 @@ WiFiService::WiFiService() : endpoint(WiFiSettings::read, WiFiSettings::update, this), - _persistence(WiFiSettings::read, WiFiSettings::update, this, &ESPFS, WIFI_SETTINGS_FILE) { + _persistence(WiFiSettings::read, WiFiSettings::update, this, WIFI_SETTINGS_FILE) { addUpdateHandler([&](const String &originId) { reconfigureWiFiConnection(); }, false); }