diff --git a/src/storage.cpp b/src/storage.cpp index 88b40f2..c7d1cbb 100644 --- a/src/storage.cpp +++ b/src/storage.cpp @@ -36,7 +36,8 @@ void Storage::setTrackingParams(uint8_t baseSpeed, uint8_t turnSpeed, uint8_t ro currentRotateSensitive = rotateSensitive; #if STORAGE_ENABLE - if (!isMounted) return; + if (!isMounted) + return; File file = SPIFFS.open("/tracking.txt", "w"); file.println(baseSpeed); @@ -49,7 +50,8 @@ void Storage::setTrackingParams(uint8_t baseSpeed, uint8_t turnSpeed, uint8_t ro void Storage::getTrackingParams(uint8_t &baseSpeed, uint8_t &turnSpeed, uint8_t &rotateSensitive) { #if STORAGE_ENABLE - if (!isMounted || !SPIFFS.exists("/tracking.txt")) { + if (!isMounted || !SPIFFS.exists("/tracking.txt")) + { baseSpeed = currentBaseSpeed; turnSpeed = currentTurnSpeed; rotateSensitive = currentRotateSensitive; @@ -80,7 +82,8 @@ void Storage::setPID(float kp, float ki, float kd) currentKd = kd; #if STORAGE_ENABLE - if (!isMounted) return; + if (!isMounted) + return; File file = SPIFFS.open("/pid.txt", "w"); file.println(kp); @@ -93,7 +96,8 @@ void Storage::setPID(float kp, float ki, float kd) void Storage::getPID(float &kp, float &ki, float &kd) { #if STORAGE_ENABLE - if (!isMounted || !SPIFFS.exists("/pid.txt")) { + if (!isMounted || !SPIFFS.exists("/pid.txt")) + { kp = currentKp; ki = currentKi; kd = currentKd; @@ -118,6 +122,7 @@ void Storage::getPID(float &kp, float &ki, float &kd) unsigned int Storage::getSensitivity() { +#if STORAGE_ENABLE if (!isMounted) return 0xFF; @@ -129,30 +134,38 @@ unsigned int Storage::getSensitivity() file.close(); return sensitivity.toInt(); +#else + return 0xFF; +#endif } void Storage::setSensitivity(unsigned int sensitivity) { +#if STORAGE_ENABLE if (!isMounted) return; File file = SPIFFS.open("/sensitivity.txt", "w"); file.println(sensitivity); file.close(); +#endif } void Storage::setName(String name) { +#if STORAGE_ENABLE if (!isMounted) return; File file = SPIFFS.open("/name.txt", "w"); file.println(name); file.close(); +#endif } String Storage::getName() { +#if STORAGE_ENABLE if (!isMounted) return DEVICE_NAME; @@ -161,4 +174,7 @@ String Storage::getName() file.close(); return name; +#else + return DEVICE_NAME; +#endif }