[Task Settings Cache] Fix save taskValueNames on ESP32

In some situations, the newly set task value names were not saved due to a cache race condition.
This commit is contained in:
TD-er
2022-08-08 12:41:57 +02:00
parent 093dcd093a
commit e258474604
3 changed files with 3 additions and 1 deletions
-1
View File
@@ -1997,5 +1997,4 @@ void setBasicTaskValues(taskIndex_t taskIndex, unsigned long taskdevicetimer,
Settings.TaskDevicePin1[taskIndex] = pin1;
Settings.TaskDevicePin2[taskIndex] = pin2;
Settings.TaskDevicePin3[taskIndex] = pin3;
SaveTaskSettings(taskIndex);
}
+1
View File
@@ -128,6 +128,7 @@ void taskClear(taskIndex_t taskIndex, bool save)
checkRAM(F("taskClear"));
#endif // ifndef BUILD_NO_RAM_TRACKER
Settings.clearTask(taskIndex);
Cache.clearTaskCaches();
ExtraTaskSettings.clear(); // Invalidate any cached values.
ExtraTaskSettings.TaskIndex = taskIndex;
+2
View File
@@ -282,6 +282,7 @@ void handle_devices_CopySubmittedSettings(taskIndex_t taskIndex, pluginID_t task
struct EventStruct TempEvent(taskIndex);
ExtraTaskSettings.clear();
Cache.clearTaskCaches();
ExtraTaskSettings.TaskIndex = taskIndex;
// Save selected output type.
@@ -379,6 +380,7 @@ void handle_devices_CopySubmittedSettings(taskIndex_t taskIndex, pluginID_t task
String dummy;
if (Device[DeviceIndex].ExitTaskBeforeSave) {
SaveTaskSettings(taskIndex);
PluginCall(PLUGIN_EXIT, &TempEvent, dummy);
}