🧼 Removes server dependencies from service
This commit is contained in:
@@ -17,18 +17,12 @@
|
||||
|
||||
ESP32SvelteKit::ESP32SvelteKit(PsychicHttpServer *server)
|
||||
:
|
||||
#if FT_ENABLED(USE_DOWNLOAD_FIRMWARE)
|
||||
_downloadFirmwareService(server),
|
||||
#endif
|
||||
#if FT_ENABLED(USE_SLEEP)
|
||||
_sleepService(server),
|
||||
#endif
|
||||
#if FT_ENABLED(USE_BATTERY)
|
||||
_batteryService(&_peripherals),
|
||||
#endif
|
||||
_servoController(server, &ESPFS, &_peripherals),
|
||||
_servoController(&_peripherals),
|
||||
#if FT_ENABLED(USE_MOTION)
|
||||
_motionService(_server, &_servoController),
|
||||
_motionService(&_servoController),
|
||||
#endif
|
||||
_server(server) {
|
||||
}
|
||||
@@ -209,9 +203,6 @@ void ESP32SvelteKit::startServices() {
|
||||
#if FT_ENABLED(USE_NTP)
|
||||
_ntpService.begin();
|
||||
#endif
|
||||
#if FT_ENABLED(USE_SLEEP)
|
||||
_sleepService.begin();
|
||||
#endif
|
||||
#if FT_ENABLED(USE_BATTERY)
|
||||
_batteryService.begin();
|
||||
#endif
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#include <MathUtils.h>
|
||||
|
||||
#define DEFAULT_STATE false
|
||||
#define LIGHT_SETTINGS_ENDPOINT_PATH "/api/input"
|
||||
#define ANGLES_EVENT "angles"
|
||||
#define INPUT_EVENT "input"
|
||||
#define POSITION_EVENT "position"
|
||||
@@ -20,8 +19,7 @@ enum class MOTION_STATE { DEACTIVATED, IDLE, CALIBRATION, REST, STAND, CRAWL, WA
|
||||
|
||||
class MotionService {
|
||||
public:
|
||||
MotionService(PsychicHttpServer *server, ServoController *servoController)
|
||||
: _server(server), _servoController(servoController) {}
|
||||
MotionService(ServoController *servoController) : _servoController(servoController) {}
|
||||
|
||||
void begin() {
|
||||
socket.onEvent(INPUT_EVENT, [&](JsonObject &root, int originId) { handleInput(root, originId); });
|
||||
@@ -144,7 +142,6 @@ class MotionService {
|
||||
static void _loopImpl(void *_this) { static_cast<MotionService *>(_this)->_loop(); }
|
||||
|
||||
private:
|
||||
PsychicHttpServer *_server;
|
||||
ServoController *_servoController;
|
||||
Kinematics kinematics;
|
||||
ControllerCommand command = {0, 0, 0, 0, 0, 0, 0, 0};
|
||||
|
||||
@@ -17,9 +17,8 @@
|
||||
|
||||
class ServoController : public StatefulService<ServoSettings> {
|
||||
public:
|
||||
ServoController(PsychicHttpServer *server, FS *fs, Peripherals *peripherals)
|
||||
: _server(server),
|
||||
_peripherals(peripherals),
|
||||
ServoController(Peripherals *peripherals)
|
||||
: _peripherals(peripherals),
|
||||
endpoint(ServoSettings::read, ServoSettings::update, this),
|
||||
_persistence(ServoSettings::read, ServoSettings::update, this, &ESPFS, SERVO_SETTINGS_FILE) {}
|
||||
|
||||
@@ -83,7 +82,6 @@ class ServoController : public StatefulService<ServoSettings> {
|
||||
StatefulHttpEndpoint<ServoSettings> endpoint;
|
||||
|
||||
private:
|
||||
PsychicHttpServer *_server;
|
||||
Peripherals *_peripherals;
|
||||
FSPersistence<ServoSettings> _persistence;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user