🌗 Make more service feature togglable

This commit is contained in:
Rune Harlyk
2024-06-06 18:28:11 +02:00
committed by Rune Harlyk
parent c9be4873f4
commit f5d9cea236
5 changed files with 6420 additions and 6127 deletions
+5 -4
View File
@@ -4,12 +4,13 @@ build_flags =
-D FT_NTP=1 -D FT_NTP=1
-D FT_SECURITY=0 -D FT_SECURITY=0
-D FT_MQTT=0 -D FT_MQTT=0
-D FT_SLEEP=1 -D FT_SLEEP=0
-D FT_UPLOAD_FIRMWARE=1 -D FT_UPLOAD_FIRMWARE=0
-D FT_DOWNLOAD_FIRMWARE=1 -D FT_DOWNLOAD_FIRMWARE=0
-D FT_ANALYTICS=1 -D FT_ANALYTICS=1
-D FT_MOTION=0
-D FT_IMU=0 -D FT_IMU=0
-D FT_MAG=0 -D FT_MAG=0
-D FT_BMP=0 -D FT_BMP=0
-D FT_GPS=0 -D FT_GPS=0
-D FT_SERVO=0
@@ -64,9 +64,14 @@ ESP32SvelteKit::ESP32SvelteKit(PsychicHttpServer *server,
_factoryResetService(server, &ESPFS, &_securitySettingsService), _factoryResetService(server, &ESPFS, &_securitySettingsService),
_systemStatus(server, &_securitySettingsService), _systemStatus(server, &_securitySettingsService),
_fileExplorer(server, &_securitySettingsService), _fileExplorer(server, &_securitySettingsService),
#if FT_ENABLED(FT_MOTION)
_motionService(_server, &_socket, &_securitySettingsService,&_taskManager), _motionService(_server, &_socket, &_securitySettingsService,&_taskManager),
#endif
#if FT_ENABLED(FT_IMU) || FT_ENABLED(FT_MAG) || FT_ENABLED(FT_BMP) #if FT_ENABLED(FT_IMU) || FT_ENABLED(FT_MAG) || FT_ENABLED(FT_BMP)
_imuService(&_socket), _imuService(&_socket),
#endif
#if FT_ENABLED(FT_SERVO)
_servoController(server, &ESPFS, &_securitySettingsService, &_socket),
#endif #endif
_deviceConfiguration(server, &ESPFS, &_securitySettingsService, &_socket) _deviceConfiguration(server, &ESPFS, &_securitySettingsService, &_socket)
{ } { }
@@ -203,7 +208,9 @@ void ESP32SvelteKit::startServices() {
#endif #endif
_taskManager.begin(); _taskManager.begin();
_fileExplorer.begin(); _fileExplorer.begin();
#if FT_ENABLED(FT_MOTION)
_motionService.begin(); _motionService.begin();
#endif
#if FT_ENABLED(FT_CAMERA) #if FT_ENABLED(FT_CAMERA)
_cameraService.begin(); _cameraService.begin();
_cameraSettingsService.begin(); _cameraSettingsService.begin();
@@ -212,6 +219,10 @@ void ESP32SvelteKit::startServices() {
#if FT_ENABLED(FT_IMU) || FT_ENABLED(FT_MAG) || FT_ENABLED(FT_BMP) #if FT_ENABLED(FT_IMU) || FT_ENABLED(FT_MAG) || FT_ENABLED(FT_BMP)
_imuService.begin(); _imuService.begin();
#endif #endif
#if FT_ENABLED(FT_SERVO)
_servoController.begin();
_servoController.configure();
#endif
} }
void IRAM_ATTR ESP32SvelteKit::_loop() { void IRAM_ATTR ESP32SvelteKit::_loop() {
@@ -227,7 +238,9 @@ void IRAM_ATTR ESP32SvelteKit::_loop() {
#if FT_ENABLED(FT_IMU) || FT_ENABLED(FT_MAG) || FT_ENABLED(FT_BMP) #if FT_ENABLED(FT_IMU) || FT_ENABLED(FT_MAG) || FT_ENABLED(FT_BMP)
_imuService.loop(); _imuService.loop();
#endif #endif
#if FT_ENABLED(FT_MOTION)
_motionService.loop(); _motionService.loop();
#endif
vTaskDelay(20 / portTICK_PERIOD_MS); vTaskDelay(20 / portTICK_PERIOD_MS);
} }
} }
+16 -7
View File
@@ -26,6 +26,7 @@
#include <FileExplorerService.h> #include <FileExplorerService.h>
#include <DownloadFirmwareService.h> #include <DownloadFirmwareService.h>
#include <DeviceConfigurationService.h> #include <DeviceConfigurationService.h>
#include <ServoController.h>
#include <ESPFS.h> #include <ESPFS.h>
#include <ESPmDNS.h> #include <ESPmDNS.h>
#include <EventSocket.h> #include <EventSocket.h>
@@ -99,13 +100,6 @@ public:
return &_socket; return &_socket;
} }
#if FT_ENABLED(FT_SECURITY)
StatefulService<SecuritySettings> *getSecuritySettingsService()
{
return &_securitySettingsService;
}
#endif
StatefulService<WiFiSettings> *getWiFiSettingsService() StatefulService<WiFiSettings> *getWiFiSettingsService()
{ {
return &_wifiSettingsService; return &_wifiSettingsService;
@@ -164,10 +158,12 @@ public:
return &_fileExplorer; return &_fileExplorer;
} }
#if FT_ENABLED(FT_MOTION)
MotionService *getMotionService() MotionService *getMotionService()
{ {
return &_motionService; return &_motionService;
} }
#endif
#if FT_ENABLED(FT_CAMERA) #if FT_ENABLED(FT_CAMERA)
CameraService *getCameraService() CameraService *getCameraService()
@@ -192,6 +188,14 @@ public:
return &_imuService; return &_imuService;
} }
#endif #endif
#if FT_ENABLED(FT_SERVO)
ServoController *getServoController()
{
return &_servoController;
}
#endif
void factoryReset() void factoryReset()
{ {
_factoryResetService.factoryReset(); _factoryResetService.factoryReset();
@@ -249,7 +253,9 @@ private:
SystemStatus _systemStatus; SystemStatus _systemStatus;
TaskManager _taskManager; TaskManager _taskManager;
FileExplorer _fileExplorer; FileExplorer _fileExplorer;
#if FT_ENABLED(FT_MOTION)
MotionService _motionService; MotionService _motionService;
#endif
#if FT_ENABLED(FT_CAMERA) #if FT_ENABLED(FT_CAMERA)
CameraService _cameraService; CameraService _cameraService;
CameraSettingsService _cameraSettingsService; CameraSettingsService _cameraSettingsService;
@@ -258,6 +264,9 @@ private:
#if FT_ENABLED(FT_IMU) || FT_ENABLED(FT_MAG) || FT_ENABLED(FT_BMP) #if FT_ENABLED(FT_IMU) || FT_ENABLED(FT_MAG) || FT_ENABLED(FT_BMP)
IMUService _imuService; IMUService _imuService;
#endif #endif
#if FT_ENABLED(FT_SERVO)
ServoController _servoController;
#endif
String _appName = APP_NAME; String _appName = APP_NAME;
+6
View File
@@ -76,4 +76,10 @@
#ifndef FT_BMP #ifndef FT_BMP
#define FT_BMP 0 #define FT_BMP 0
#endif #endif
// ESP32 GPS off by default
#ifndef FT_GPS
#define FT_GPS 0
#endif
#endif #endif
File diff suppressed because it is too large Load Diff