diff --git a/esp32/features.ini b/esp32/features.ini index 27828db..269bd22 100644 --- a/esp32/features.ini +++ b/esp32/features.ini @@ -1,20 +1,20 @@ [features] build_flags = - -D FT_BATTERY=1 - -D FT_NTP=1 - -D FT_SECURITY=0 - -D FT_SLEEP=0 - -D FT_UPLOAD_FIRMWARE=0 - -D FT_DOWNLOAD_FIRMWARE=0 - -D FT_ANALYTICS=1 - -D FT_MOTION=1 + -D USE_BATTERY=1 + -D USE_NTP=1 + -D USE_SECURITY=0 + -D USE_SLEEP=0 + -D USE_UPLOAD_FIRMWARE=0 + -D USE_DOWNLOAD_FIRMWARE=0 + -D USE_ANALYTICS=1 + -D USE_MOTION=1 ; Hardware specific - -D FT_IMU=1 - -D FT_MAG=1 - -D FT_BMP=1 - -D FT_GPS=0 - -D FT_WS2812=1 - -D FT_USS=0 - -D FT_SERVO=1 - -D FT_ADS1115=1 + -D USE_IMU=1 + -D USE_MAG=1 + -D USE_BMP=1 + -D USE_GPS=0 + -D USE_WS2812=1 + -D USE_USS=0 + -D USE_SERVO=1 + -D USE_ADS1115=1 diff --git a/esp32/lib/ESP32-sveltekit/AuthenticationService.cpp b/esp32/lib/ESP32-sveltekit/AuthenticationService.cpp index c7c654d..1de9c54 100644 --- a/esp32/lib/ESP32-sveltekit/AuthenticationService.cpp +++ b/esp32/lib/ESP32-sveltekit/AuthenticationService.cpp @@ -14,7 +14,7 @@ #include -#if FT_ENABLED(FT_SECURITY) +#if FT_ENABLED(USE_SECURITY) AuthenticationService::AuthenticationService(PsychicHttpServer *server, SecurityManager *securityManager) : _server(server), _securityManager(securityManager) {} @@ -48,4 +48,4 @@ void AuthenticationService::begin() { ESP_LOGV("AuthenticationService", "Registered GET endpoint: %s", VERIFY_AUTHORIZATION_PATH); } -#endif // end FT_ENABLED(FT_SECURITY) +#endif // end FT_ENABLED(USE_SECURITY) diff --git a/esp32/lib/ESP32-sveltekit/AuthenticationService.h b/esp32/lib/ESP32-sveltekit/AuthenticationService.h index 2f932fc..5aecd21 100644 --- a/esp32/lib/ESP32-sveltekit/AuthenticationService.h +++ b/esp32/lib/ESP32-sveltekit/AuthenticationService.h @@ -22,7 +22,7 @@ #define VERIFY_AUTHORIZATION_PATH "/api/verifyAuthorization" #define SIGN_IN_PATH "/api/signIn" -#if FT_ENABLED(FT_SECURITY) +#if FT_ENABLED(USE_SECURITY) class AuthenticationService { public: @@ -35,5 +35,5 @@ class AuthenticationService { PsychicHttpServer *_server; }; -#endif // end FT_ENABLED(FT_SECURITY) +#endif // end FT_ENABLED(USE_SECURITY) #endif // end SecurityManager_h diff --git a/esp32/lib/ESP32-sveltekit/CameraService.cpp b/esp32/lib/ESP32-sveltekit/CameraService.cpp index 5861a55..3344fb7 100644 --- a/esp32/lib/ESP32-sveltekit/CameraService.cpp +++ b/esp32/lib/ESP32-sveltekit/CameraService.cpp @@ -44,7 +44,7 @@ esp_err_t CameraService::InitializeCamera() { camera_config_t camera_config; camera_config.ledc_channel = LEDC_CHANNEL_0; camera_config.ledc_timer = LEDC_TIMER_0; -#if FT_ENABLED(FT_CAMERA) +#if FT_ENABLED(USE_CAMERA) camera_config.pin_d0 = Y2_GPIO_NUM; camera_config.pin_d1 = Y3_GPIO_NUM; camera_config.pin_d2 = Y4_GPIO_NUM; diff --git a/esp32/lib/ESP32-sveltekit/CameraService.h b/esp32/lib/ESP32-sveltekit/CameraService.h index 9360ddd..220fded 100644 --- a/esp32/lib/ESP32-sveltekit/CameraService.h +++ b/esp32/lib/ESP32-sveltekit/CameraService.h @@ -10,7 +10,7 @@ #include #include -#if FT_ENABLED(FT_CAMERA) +#if USE_CAMERA #include #endif diff --git a/esp32/lib/ESP32-sveltekit/ESP32SvelteKit.cpp b/esp32/lib/ESP32-sveltekit/ESP32SvelteKit.cpp index bb6bcf0..b845475 100644 --- a/esp32/lib/ESP32-sveltekit/ESP32SvelteKit.cpp +++ b/esp32/lib/ESP32-sveltekit/ESP32SvelteKit.cpp @@ -27,29 +27,29 @@ ESP32SvelteKit::ESP32SvelteKit(PsychicHttpServer *server, unsigned int numberEnd _apSettingsService(server, &ESPFS, &_securitySettingsService), _apStatus(server, &_securitySettingsService, &_apSettingsService), _socket(server, &_securitySettingsService, AuthenticationPredicates::IS_AUTHENTICATED), -#if FT_ENABLED(FT_NTP) +#if FT_ENABLED(USE_NTP) _ntpSettingsService(server, &ESPFS, &_securitySettingsService), _ntpStatus(server, &_securitySettingsService), #endif -#if FT_ENABLED(FT_UPLOAD_FIRMWARE) +#if FT_ENABLED(USE_UPLOAD_FIRMWARE) _uploadFirmwareService(server, &_securitySettingsService), #endif -#if FT_ENABLED(FT_DOWNLOAD_FIRMWARE) +#if FT_ENABLED(USE_DOWNLOAD_FIRMWARE) _downloadFirmwareService(server, &_securitySettingsService, &_socket, &_taskManager), #endif -#if FT_ENABLED(FT_SECURITY) +#if FT_ENABLED(USE_SECURITY) _authenticationService(server, &_securitySettingsService), #endif -#if FT_ENABLED(FT_SLEEP) +#if FT_ENABLED(USE_SLEEP) _sleepService(server, &_securitySettingsService), #endif -#if FT_ENABLED(FT_BATTERY) +#if FT_ENABLED(USE_BATTERY) _batteryService(&_peripherals, &_socket), #endif -#if FT_ENABLED(FT_ANALYTICS) +#if FT_ENABLED(USE_ANALYTICS) _analyticsService(&_socket, &_taskManager), #endif -#if FT_ENABLED(FT_CAMERA) +#if FT_ENABLED(USE_CAMERA) _cameraService(server, &_taskManager, &_securitySettingsService), _cameraSettingsService(server, &ESPFS, &_securitySettingsService, &_socket), #endif @@ -58,10 +58,10 @@ ESP32SvelteKit::ESP32SvelteKit(PsychicHttpServer *server, unsigned int numberEnd _systemStatus(server, &_securitySettingsService), _fileExplorer(server, &_securitySettingsService), _servoController(server, &ESPFS, &_securitySettingsService, &_peripherals, &_socket), -#if FT_ENABLED(FT_MOTION) +#if FT_ENABLED(USE_MOTION) _motionService(_server, &_socket, &_securitySettingsService, &_servoController, &_taskManager), #endif -#if FT_ENABLED(FT_WS2812) +#if FT_ENABLED(USE_WS2812) _ledService(&_taskManager), #endif _peripherals(server, &ESPFS, &_securitySettingsService, &_socket) { @@ -159,56 +159,56 @@ void ESP32SvelteKit::startServices() { _wifiScanner.begin(); _wifiStatus.begin(); -#if FT_ENABLED(FT_UPLOAD_FIRMWARE) +#if FT_ENABLED(USE_UPLOAD_FIRMWARE) _uploadFirmwareService.begin(); #endif -#if FT_ENABLED(FT_DOWNLOAD_FIRMWARE) +#if FT_ENABLED(USE_DOWNLOAD_FIRMWARE) _downloadFirmwareService.begin(); #endif -#if FT_ENABLED(FT_NTP) +#if FT_ENABLED(USE_NTP) _ntpSettingsService.begin(); _ntpStatus.begin(); #endif -#if FT_ENABLED(FT_SECURITY) +#if FT_ENABLED(USE_SECURITY) _authenticationService.begin(); _securitySettingsService.begin(); #endif -#if FT_ENABLED(FT_ANALYTICS) +#if FT_ENABLED(USE_ANALYTICS) _analyticsService.begin(); #endif -#if FT_ENABLED(FT_SLEEP) +#if FT_ENABLED(USE_SLEEP) _sleepService.begin(); #endif -#if FT_ENABLED(FT_BATTERY) +#if FT_ENABLED(USE_BATTERY) _batteryService.begin(); #endif _taskManager.begin(); _fileExplorer.begin(); _peripherals.begin(); _servoController.begin(); -#if FT_ENABLED(FT_MOTION) +#if FT_ENABLED(USE_MOTION) _motionService.begin(); #endif -#if FT_ENABLED(FT_CAMERA) +#if FT_ENABLED(USE_CAMERA) _cameraService.begin(); _cameraSettingsService.begin(); #endif -#if FT_ENABLED(FT_WS2812) +#if FT_ENABLED(USE_WS2812) _ledService.begin(); #endif } void IRAM_ATTR ESP32SvelteKit::loop() { while (1) { -#if FT_ENABLED(FT_WS2812) +#if FT_ENABLED(USE_WS2812) _ledService.loop(); #endif _wifiSettingsService.loop(); _apSettingsService.loop(); -#if FT_ENABLED(FT_ANALYTICS) +#if FT_ENABLED(USE_ANALYTICS) _analyticsService.loop(); #endif -#if FT_ENABLED(FT_BATTERY) +#if FT_ENABLED(USE_BATTERY) _batteryService.loop(); #endif _peripherals.loop(); diff --git a/esp32/lib/ESP32-sveltekit/ESP32SvelteKit.h b/esp32/lib/ESP32-sveltekit/ESP32SvelteKit.h index 97eac37..12547bd 100644 --- a/esp32/lib/ESP32-sveltekit/ESP32SvelteKit.h +++ b/esp32/lib/ESP32-sveltekit/ESP32SvelteKit.h @@ -89,15 +89,15 @@ class ESP32SvelteKit { StatefulService *getAPSettingsService() { return &_apSettingsService; } -#if FT_ENABLED(FT_NTP) +#if FT_ENABLED(USE_NTP) StatefulService *getNTPSettingsService() { return &_ntpSettingsService; } #endif -#if FT_ENABLED(FT_SLEEP) +#if FT_ENABLED(USE_SLEEP) SleepService *getSleepService() { return &_sleepService; } #endif -#if FT_ENABLED(FT_BATTERY) +#if FT_ENABLED(USE_BATTERY) BatteryService *getBatteryService() { return &_batteryService; } #endif @@ -107,18 +107,18 @@ class ESP32SvelteKit { FileExplorer *getFileExplorer() { return &_fileExplorer; } -#if FT_ENABLED(FT_MOTION) +#if FT_ENABLED(USE_MOTION) MotionService *getMotionService() { return &_motionService; } #endif -#if FT_ENABLED(FT_CAMERA) CameraService *getCameraService() { return &_cameraService; } CameraSettingsService *getCameraSettingsService() { return &_cameraSettingsService; } +#if FT_ENABLED(USE_CAMERA) #endif Peripherals *getPeripherals() { return &_peripherals; } -#if FT_ENABLED(FT_SERVO) +#if FT_ENABLED(USE_SERVO) ServoController *getServoController() { return &_servoController; } #endif @@ -141,26 +141,26 @@ class ESP32SvelteKit { APSettingsService _apSettingsService; APStatus _apStatus; EventSocket _socket; -#if FT_ENABLED(FT_NTP) +#if FT_ENABLED(USE_NTP) NTPSettingsService _ntpSettingsService; NTPStatus _ntpStatus; #endif -#if FT_ENABLED(FT_UPLOAD_FIRMWARE) +#if FT_ENABLED(USE_UPLOAD_FIRMWARE) UploadFirmwareService _uploadFirmwareService; #endif -#if FT_ENABLED(FT_DOWNLOAD_FIRMWARE) +#if FT_ENABLED(USE_DOWNLOAD_FIRMWARE) DownloadFirmwareService _downloadFirmwareService; #endif -#if FT_ENABLED(FT_SECURITY) +#if FT_ENABLED(USE_SECURITY) AuthenticationService _authenticationService; #endif -#if FT_ENABLED(FT_SLEEP) +#if FT_ENABLED(USE_SLEEP) SleepService _sleepService; #endif -#if FT_ENABLED(FT_BATTERY) +#if FT_ENABLED(USE_BATTERY) BatteryService _batteryService; #endif -#if FT_ENABLED(FT_ANALYTICS) +#if FT_ENABLED(USE_ANALYTICS) AnalyticsService _analyticsService; #endif RestartService _restartService; @@ -168,16 +168,16 @@ class ESP32SvelteKit { SystemStatus _systemStatus; TaskManager _taskManager; FileExplorer _fileExplorer; -#if FT_ENABLED(FT_MOTION) +#if FT_ENABLED(USE_MOTION) MotionService _motionService; #endif -#if FT_ENABLED(FT_CAMERA) CameraService _cameraService; CameraSettingsService _cameraSettingsService; +#if FT_ENABLED(USE_CAMERA) #endif Peripherals _peripherals; ServoController _servoController; -#if FT_ENABLED(FT_WS2812) +#if FT_ENABLED(USE_WS2812) LEDService _ledService; #endif diff --git a/esp32/lib/ESP32-sveltekit/Features.h b/esp32/lib/ESP32-sveltekit/Features.h index 6af1550..179ec38 100644 --- a/esp32/lib/ESP32-sveltekit/Features.h +++ b/esp32/lib/ESP32-sveltekit/Features.h @@ -18,68 +18,68 @@ #define FT_ENABLED(feature) feature // security feature on by default -#ifndef FT_SECURITY -#define FT_SECURITY 1 +#ifndef USE_SECURITY +#define USE_SECURITY 1 #endif // ntp feature on by default -#ifndef FT_NTP -#define FT_NTP 1 +#ifndef USE_NTP +#define USE_NTP 1 #endif // upload firmware feature off by default -#ifndef FT_UPLOAD_FIRMWARE -#define FT_UPLOAD_FIRMWARE 0 +#ifndef USE_UPLOAD_FIRMWARE +#define USE_UPLOAD_FIRMWARE 0 #endif // download firmware feature off by default -#ifndef FT_DOWNLOAD_FIRMWARE -#define FT_DOWNLOAD_FIRMWARE 0 +#ifndef USE_DOWNLOAD_FIRMWARE +#define USE_DOWNLOAD_FIRMWARE 0 #endif // ESP32 sleep states off by default -#ifndef FT_SLEEP -#define FT_SLEEP 0 +#ifndef USE_SLEEP +#define USE_SLEEP 0 #endif // ESP32 battery state off by default -#ifndef FT_BATTERY -#define FT_BATTERY 0 +#ifndef USE_BATTERY +#define USE_BATTERY 0 #endif // ESP32 analytics on by default -#ifndef FT_ANALYTICS -#define FT_ANALYTICS 1 +#ifndef USE_ANALYTICS +#define USE_ANALYTICS 1 #endif // ESP32 camera off by default -#ifndef FT_CAMERA -#define FT_CAMERA 0 +#ifndef USE_CAMERA +#define USE_CAMERA 0 #endif // ESP32 IMU on by default -#ifndef FT_IMU -#define FT_IMU 1 +#ifndef USE_IMU +#define USE_IMU 1 #endif // ESP32 magnetometer on by default -#ifndef FT_MAG -#define FT_MAG 0 +#ifndef USE_MAG +#define USE_MAG 0 #endif // ESP32 barometer off by default -#ifndef FT_BMP -#define FT_BMP 0 +#ifndef USE_BMP +#define USE_BMP 0 #endif // ESP32 SONAR off by default -#ifndef FT_USS -#define FT_USS 0 +#ifndef USE_USS +#define USE_USS 0 #endif // ESP32 GPS off by default -#ifndef FT_GPS -#define FT_GPS 0 +#ifndef USE_GPS +#define USE_GPS 0 #endif #endif diff --git a/esp32/lib/ESP32-sveltekit/FeaturesService.cpp b/esp32/lib/ESP32-sveltekit/FeaturesService.cpp index 5956139..6a256e0 100644 --- a/esp32/lib/ESP32-sveltekit/FeaturesService.cpp +++ b/esp32/lib/ESP32-sveltekit/FeaturesService.cpp @@ -22,18 +22,18 @@ void FeaturesService::begin() { PsychicJsonResponse response = PsychicJsonResponse(request, false); JsonObject root = response.getRoot(); - root["security"] = FT_SECURITY; - root["ntp"] = FT_NTP; - root["upload_firmware"] = FT_UPLOAD_FIRMWARE; - root["download_firmware"] = FT_DOWNLOAD_FIRMWARE; - root["sleep"] = FT_SLEEP; - root["battery"] = FT_BATTERY; - root["analytics"] = FT_ANALYTICS; - root["camera"] = FT_CAMERA; - root["imu"] = FT_IMU; - root["mag"] = FT_MAG; - root["bmp"] = FT_BMP; - root["sonar"] = FT_USS; + root["security"] = USE_SECURITY; + root["ntp"] = USE_NTP; + root["upload_firmware"] = USE_UPLOAD_FIRMWARE; + root["download_firmware"] = USE_DOWNLOAD_FIRMWARE; + root["sleep"] = USE_SLEEP; + root["battery"] = USE_BATTERY; + root["analytics"] = USE_ANALYTICS; + root["camera"] = USE_CAMERA; + root["imu"] = USE_IMU; + root["mag"] = USE_MAG; + root["bmp"] = USE_BMP; + root["sonar"] = USE_USS; root["firmware_version"] = APP_VERSION; root["firmware_name"] = APP_NAME; root["firmware_built_target"] = BUILD_TARGET; diff --git a/esp32/lib/ESP32-sveltekit/Peripherals.h b/esp32/lib/ESP32-sveltekit/Peripherals.h index 0e49106..5da1af2 100644 --- a/esp32/lib/ESP32-sveltekit/Peripherals.h +++ b/esp32/lib/ESP32-sveltekit/Peripherals.h @@ -109,10 +109,10 @@ class Peripherals : public StatefulService { CONFIGURATION_SETTINGS_PATH, securityManager, AuthenticationPredicates::IS_ADMIN), _eventEndpoint(PeripheralsConfiguration::read, PeripheralsConfiguration::update, this, socket, EVENT_CONFIGURATION_SETTINGS), -#if FT_ENABLED(FT_MAG) +#if FT_ENABLED(USE_MAG) _mag(12345), #endif -#if FT_ENABLED(FT_BMP) +#if FT_ENABLED(USE_BMP) _bmp(10085), #endif _fsPersistence(PeripheralsConfiguration::read, PeripheralsConfiguration::update, this, fs, @@ -138,7 +138,7 @@ class Peripherals : public StatefulService { updatePins(); -#if FT_ENABLED(FT_SERVO) +#if FT_ENABLED(USE_SERVO) _pca.begin(); _pca.setPWMFreq(FACTORY_SERVO_PWM_FREQUENCY); _pca.setOscillatorFrequency(FACTORY_SERVO_OSCILLATOR_FREQUENCY); @@ -149,7 +149,7 @@ class Peripherals : public StatefulService { }); #endif -#if FT_ENABLED(FT_IMU) +#if FT_ENABLED(USE_IMU) _imu.initialize(); imu_success = _imu.testConnection(); devStatus = _imu.dmpInitialize(); @@ -161,27 +161,27 @@ class Peripherals : public StatefulService { _imu.setI2CBypassEnabled(true); _imu.setSleepEnabled(false); #endif -#if FT_ENABLED(FT_MAG) +#if FT_ENABLED(USE_MAG) mag_success = _mag.begin(); if (!mag_success) { ESP_LOGE("IMUService", "MAG initialize failed"); } #endif -#if FT_ENABLED(FT_BMP) +#if FT_ENABLED(USE_BMP) bmp_success = _bmp.begin(); if (!bmp_success) { ESP_LOGE("IMUService", "BMP initialize failed"); } #endif -#if FT_ENABLED(FT_ADS1015) || FT_ENABLED(FT_ADS1115) +#if FT_ENABLED(FT_ADS1015) || FT_ENABLED(USE_ADS1115) if (!_ads.begin()) { ESP_LOGE("Peripherals", "ADS1015/ADS1115 not found"); } _ads.startADCReading(ADS1X15_REG_CONFIG_MUX_DIFF_0_1, /*continuous=*/false); #endif -#if FT_ENABLED(FT_USS) +#if FT_ENABLED(USE_USS) _left_sonar = new NewPing(USS_LEFT_PIN, USS_LEFT_PIN, MAX_DISTANCE); _right_sonar = new NewPing(USS_RIGHT_PIN, USS_RIGHT_PIN, MAX_DISTANCE); #endif @@ -241,13 +241,13 @@ class Peripherals : public StatefulService { /* SERVO FUNCTIONS*/ void pcaLerpTo(int index, int value, float t) { -#if FT_ENABLED(FT_SERVO) +#if FT_ENABLED(USE_SERVO) target_pwm[index] = lerp(pwm[index], value, t); #endif } void pcaWrite(int index, int value) { -#if FT_ENABLED(FT_SERVO) +#if FT_ENABLED(USE_SERVO) if (value < 0 || value > 4096) { ESP_LOGE("Peripherals", "Invalid PWM value %d for %d :: Valid range 0-4096", value, index); return; @@ -261,13 +261,13 @@ class Peripherals : public StatefulService { } void pcaWriteAngle(int index, int angle) { -#if FT_ENABLED(FT_SERVO) +#if FT_ENABLED(USE_SERVO) _pca.setPWM(index, 0, 125 + angle * 2); #endif } void pcaWriteAngles(float *angles, int numServos, int offset = 0) { -#if FT_ENABLED(FT_SERVO) +#if FT_ENABLED(USE_SERVO) for (int i = 0; i < numServos; i++) { pcaWriteAngle(i + offset, angles[i]); } @@ -275,7 +275,7 @@ class Peripherals : public StatefulService { } void pcaActivate() { -#if FT_ENABLED(FT_SERVO) +#if FT_ENABLED(USE_SERVO) if (_pca_active) return; _pca_active = true; _pca.wakeup(); @@ -283,7 +283,7 @@ class Peripherals : public StatefulService { } void pcaDeactivate() { -#if FT_ENABLED(FT_SERVO) +#if FT_ENABLED(USE_SERVO) if (!_pca_active) return; _pca_active = false; _pca.sleep(); @@ -293,7 +293,7 @@ class Peripherals : public StatefulService { /* ADC FUNCTIONS*/ int16_t readADCVoltage(uint8_t channel) { int16_t voltage = -1; -#if FT_ENABLED(FT_ADS1015) || FT_ENABLED(FT_ADS1115) +#if FT_ENABLED(FT_ADS1015) || FT_ENABLED(USE_ADS1115) float adc0 = _ads.readADC_SingleEnded(channel); voltage = _ads.computeVolts(adc0); #endif @@ -303,7 +303,7 @@ class Peripherals : public StatefulService { /* IMU FUNCTIONS */ bool readIMU() { bool updated = false; -#if FT_ENABLED(FT_IMU) +#if FT_ENABLED(USE_IMU) updated = imu_success && _imu.dmpGetCurrentFIFOPacket(fifoBuffer); _imu.dmpGetQuaternion(&q, fifoBuffer); _imu.dmpGetGravity(&gravity, &q); @@ -314,7 +314,7 @@ class Peripherals : public StatefulService { float getTemp() { float temp = -1; -#if FT_ENABLED(FT_IMU) +#if FT_ENABLED(USE_IMU) temp = imu_success ? imu_temperature : -1; #endif return temp; @@ -322,7 +322,7 @@ class Peripherals : public StatefulService { float getAngleX() { float angle = 0; -#if FT_ENABLED(FT_IMU) +#if FT_ENABLED(USE_IMU) angle = imu_success ? ypr[0] * 180 / M_PI : 0; #endif return angle; @@ -330,7 +330,7 @@ class Peripherals : public StatefulService { float getAngleY() { float angle = 0; -#if FT_ENABLED(FT_IMU) +#if FT_ENABLED(USE_IMU) angle = imu_success ? ypr[1] * 180 / M_PI : 0; #endif return angle; @@ -338,7 +338,7 @@ class Peripherals : public StatefulService { float getAngleZ() { float angle = 0; -#if FT_ENABLED(FT_IMU) +#if FT_ENABLED(USE_IMU) angle = imu_success ? ypr[2] * 180 / M_PI : 0; #endif return angle; @@ -347,7 +347,7 @@ class Peripherals : public StatefulService { /* MAG FUNCTIONS */ float getHeading() { float heading = 0; -#if FT_ENABLED(FT_MAG) +#if FT_ENABLED(USE_MAG) sensors_event_t event; _mag.getEvent(&event); heading = atan2(event.magnetic.y, event.magnetic.x); @@ -363,7 +363,7 @@ class Peripherals : public StatefulService { /* BMP FUNCTIONS */ float getAltitude() { float altitude = -1; -#if FT_ENABLED(FT_MAG) +#if FT_ENABLED(USE_MAG) sensors_event_t event; _bmp.getEvent(&event); float seaLevelPressure = SENSORS_PRESSURE_SEALEVELHPA; @@ -374,7 +374,7 @@ class Peripherals : public StatefulService { float getPressure() { float pressure = -1; -#if FT_ENABLED(FT_BMP) +#if FT_ENABLED(USE_BMP) sensors_event_t event; _bmp.getEvent(&event); pressure = bmp_success && event.pressure ? event.pressure : -1; @@ -384,7 +384,7 @@ class Peripherals : public StatefulService { float getTemperature() { float temperature = 0; -#if FT_ENABLED(FT_BMP) +#if FT_ENABLED(USE_BMP) _bmp.getTemperature(&temperature); temperature = bmp_success ? temperature : -1; #endif @@ -395,7 +395,7 @@ class Peripherals : public StatefulService { void updateImu() { doc.clear(); bool newData = false; -#if FT_ENABLED(FT_IMU) +#if FT_ENABLED(USE_IMU) newData = imu_success && readIMU(); if (imu_success) { doc["x"] = round2(getAngleX()); @@ -403,13 +403,13 @@ class Peripherals : public StatefulService { doc["z"] = round2(getAngleZ()); } #endif -#if FT_ENABLED(FT_MAG) +#if FT_ENABLED(USE_MAG) newData = newData || mag_success; if (mag_success) { doc["heading"] = round2(getHeading()); } #endif -#if FT_ENABLED(FT_BMP) +#if FT_ENABLED(USE_BMP) newData = newData || bmp_success; if (bmp_success) { doc["pressure"] = round2(getPressure()); @@ -424,7 +424,7 @@ class Peripherals : public StatefulService { } void readSonar() { -#if FT_ENABLED(FT_USS) +#if FT_ENABLED(USE_USS) _left_distance = _left_sonar->ping_cm(); delay(50); _right_distance = _right_sonar->ping_cm(); @@ -432,7 +432,7 @@ class Peripherals : public StatefulService { } void emitSonar() { -#if FT_ENABLED(FT_USS) +#if FT_ENABLED(USE_USS) char output[16]; snprintf(output, sizeof(output), "[%.1f,%.1f]", _left_distance, _right_distance); @@ -459,13 +459,13 @@ class Peripherals : public StatefulService { JsonDocument doc; char message[MAX_ESP_IMU_SIZE]; -#if FT_ENABLED(FT_SERVO) +#if FT_ENABLED(USE_SERVO) Adafruit_PWMServoDriver _pca; bool _pca_active {false}; uint16_t pwm[16] = {0}; uint16_t target_pwm[16] = {0}; #endif -#if FT_ENABLED(FT_IMU) +#if FT_ENABLED(USE_IMU) MPU6050 _imu; bool imu_success {false}; uint8_t devStatus {false}; @@ -475,21 +475,21 @@ class Peripherals : public StatefulService { float ypr[3]; float imu_temperature {-1}; #endif -#if FT_ENABLED(FT_MAG) +#if FT_ENABLED(USE_MAG) Adafruit_HMC5883_Unified _mag; bool mag_success {false}; #endif -#if FT_ENABLED(FT_BMP) +#if FT_ENABLED(USE_BMP) Adafruit_BMP085_Unified _bmp; bool bmp_success {false}; #endif #if FT_ENABLED(FT_ADS1015) Adafruit_ADS1015 _ads; #endif -#if FT_ENABLED(FT_ADS1115) +#if FT_ENABLED(USE_ADS1115) Adafruit_ADS1115 _ads; #endif -#if FT_ENABLED(FT_USS) +#if FT_ENABLED(USE_USS) NewPing *_left_sonar; NewPing *_right_sonar; #endif diff --git a/esp32/lib/ESP32-sveltekit/SecurityManager.h b/esp32/lib/ESP32-sveltekit/SecurityManager.h index 274a0ce..913fe39 100644 --- a/esp32/lib/ESP32-sveltekit/SecurityManager.h +++ b/esp32/lib/ESP32-sveltekit/SecurityManager.h @@ -62,7 +62,7 @@ class AuthenticationPredicates { class SecurityManager { public: -#if FT_ENABLED(FT_SECURITY) +#if FT_ENABLED(USE_SECURITY) /* * Authenticate, returning the user if found */ diff --git a/esp32/lib/ESP32-sveltekit/SecuritySettingsService.cpp b/esp32/lib/ESP32-sveltekit/SecuritySettingsService.cpp index 1f18296..6ee4c6d 100644 --- a/esp32/lib/ESP32-sveltekit/SecuritySettingsService.cpp +++ b/esp32/lib/ESP32-sveltekit/SecuritySettingsService.cpp @@ -14,7 +14,7 @@ #include -#if FT_ENABLED(FT_SECURITY) +#if FT_ENABLED(USE_SECURITY) SecuritySettingsService::SecuritySettingsService(PsychicHttpServer *server, FS *fs) : _server(server), diff --git a/esp32/lib/ESP32-sveltekit/SecuritySettingsService.h b/esp32/lib/ESP32-sveltekit/SecuritySettingsService.h index 36571e9..3b29f9c 100644 --- a/esp32/lib/ESP32-sveltekit/SecuritySettingsService.h +++ b/esp32/lib/ESP32-sveltekit/SecuritySettingsService.h @@ -46,7 +46,7 @@ #define GENERATE_TOKEN_PATH "/api/generateToken" -#if FT_ENABLED(FT_SECURITY) +#if FT_ENABLED(USE_SECURITY) class SecuritySettings { public: @@ -136,5 +136,5 @@ class SecuritySettingsService : public SecurityManager { PsychicJsonRequestCallback wrapCallback(PsychicJsonRequestCallback onRequest, AuthenticationPredicate predicate); }; -#endif // end FT_ENABLED(FT_SECURITY) +#endif // end FT_ENABLED(USE_SECURITY) #endif // end SecuritySettingsService_h diff --git a/esp32/platformio.ini b/esp32/platformio.ini index 4d00291..2a7eee6 100644 --- a/esp32/platformio.ini +++ b/esp32/platformio.ini @@ -28,7 +28,7 @@ monitor_rts = 0 monitor_dtr = 0 build_flags= ${env.build_flags} - -D FT_CAMERA=1 + -D USE_CAMERA=1 -D CAMERA_MODEL_AI_THINKER=1 -D SDA_PIN=14 -D SCL_PIN=15 @@ -43,7 +43,7 @@ build_flags = ${env.build_flags} -DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue - -D FT_CAMERA=1 + -D USE_CAMERA=1 -D CAMERA_MODEL_ESP32S3_EYE=1 -D WS2812_PIN=48 -D USS_LEFT_PIN=1