This commit is contained in:
parent
6c00f2c959
commit
0039e4fab5
|
@ -36,7 +36,8 @@ void Storage::setTrackingParams(uint8_t baseSpeed, uint8_t turnSpeed, uint8_t ro
|
||||||
currentRotateSensitive = rotateSensitive;
|
currentRotateSensitive = rotateSensitive;
|
||||||
|
|
||||||
#if STORAGE_ENABLE
|
#if STORAGE_ENABLE
|
||||||
if (!isMounted) return;
|
if (!isMounted)
|
||||||
|
return;
|
||||||
|
|
||||||
File file = SPIFFS.open("/tracking.txt", "w");
|
File file = SPIFFS.open("/tracking.txt", "w");
|
||||||
file.println(baseSpeed);
|
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)
|
void Storage::getTrackingParams(uint8_t &baseSpeed, uint8_t &turnSpeed, uint8_t &rotateSensitive)
|
||||||
{
|
{
|
||||||
#if STORAGE_ENABLE
|
#if STORAGE_ENABLE
|
||||||
if (!isMounted || !SPIFFS.exists("/tracking.txt")) {
|
if (!isMounted || !SPIFFS.exists("/tracking.txt"))
|
||||||
|
{
|
||||||
baseSpeed = currentBaseSpeed;
|
baseSpeed = currentBaseSpeed;
|
||||||
turnSpeed = currentTurnSpeed;
|
turnSpeed = currentTurnSpeed;
|
||||||
rotateSensitive = currentRotateSensitive;
|
rotateSensitive = currentRotateSensitive;
|
||||||
|
@ -80,7 +82,8 @@ void Storage::setPID(float kp, float ki, float kd)
|
||||||
currentKd = kd;
|
currentKd = kd;
|
||||||
|
|
||||||
#if STORAGE_ENABLE
|
#if STORAGE_ENABLE
|
||||||
if (!isMounted) return;
|
if (!isMounted)
|
||||||
|
return;
|
||||||
|
|
||||||
File file = SPIFFS.open("/pid.txt", "w");
|
File file = SPIFFS.open("/pid.txt", "w");
|
||||||
file.println(kp);
|
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)
|
void Storage::getPID(float &kp, float &ki, float &kd)
|
||||||
{
|
{
|
||||||
#if STORAGE_ENABLE
|
#if STORAGE_ENABLE
|
||||||
if (!isMounted || !SPIFFS.exists("/pid.txt")) {
|
if (!isMounted || !SPIFFS.exists("/pid.txt"))
|
||||||
|
{
|
||||||
kp = currentKp;
|
kp = currentKp;
|
||||||
ki = currentKi;
|
ki = currentKi;
|
||||||
kd = currentKd;
|
kd = currentKd;
|
||||||
|
@ -118,6 +122,7 @@ void Storage::getPID(float &kp, float &ki, float &kd)
|
||||||
|
|
||||||
unsigned int Storage::getSensitivity()
|
unsigned int Storage::getSensitivity()
|
||||||
{
|
{
|
||||||
|
#if STORAGE_ENABLE
|
||||||
if (!isMounted)
|
if (!isMounted)
|
||||||
return 0xFF;
|
return 0xFF;
|
||||||
|
|
||||||
|
@ -129,30 +134,38 @@ unsigned int Storage::getSensitivity()
|
||||||
file.close();
|
file.close();
|
||||||
|
|
||||||
return sensitivity.toInt();
|
return sensitivity.toInt();
|
||||||
|
#else
|
||||||
|
return 0xFF;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Storage::setSensitivity(unsigned int sensitivity)
|
void Storage::setSensitivity(unsigned int sensitivity)
|
||||||
{
|
{
|
||||||
|
#if STORAGE_ENABLE
|
||||||
if (!isMounted)
|
if (!isMounted)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
File file = SPIFFS.open("/sensitivity.txt", "w");
|
File file = SPIFFS.open("/sensitivity.txt", "w");
|
||||||
file.println(sensitivity);
|
file.println(sensitivity);
|
||||||
file.close();
|
file.close();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Storage::setName(String name)
|
void Storage::setName(String name)
|
||||||
{
|
{
|
||||||
|
#if STORAGE_ENABLE
|
||||||
if (!isMounted)
|
if (!isMounted)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
File file = SPIFFS.open("/name.txt", "w");
|
File file = SPIFFS.open("/name.txt", "w");
|
||||||
file.println(name);
|
file.println(name);
|
||||||
file.close();
|
file.close();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
String Storage::getName()
|
String Storage::getName()
|
||||||
{
|
{
|
||||||
|
#if STORAGE_ENABLE
|
||||||
if (!isMounted)
|
if (!isMounted)
|
||||||
return DEVICE_NAME;
|
return DEVICE_NAME;
|
||||||
|
|
||||||
|
@ -161,4 +174,7 @@ String Storage::getName()
|
||||||
file.close();
|
file.close();
|
||||||
|
|
||||||
return name;
|
return name;
|
||||||
|
#else
|
||||||
|
return DEVICE_NAME;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue