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