@@ -248,6 +248,22 @@ void onControl(AsyncWebServerRequest *request) {
248
248
AppHttpd.serialSendCommand (value.c_str ());
249
249
request->send (200 , " " , " OK" );
250
250
return ;
251
+ }
252
+ else if (variable == " save_prefs" ) {
253
+ CLAppComponent * component = (value == " conn" ?(CLAppComponent*)&AppConn:(CLAppComponent*)&AppCam);
254
+ if (component->removePrefs () == OS_SUCCESS)
255
+ request->send (200 , " " , " OK" );
256
+ else
257
+ request->send (500 , " " , " Failed to save preferences" );
258
+ return ;
259
+ }
260
+ else if (variable == " remove_prefs" ) {
261
+ CLAppComponent * component = (value == " conn" ?(CLAppComponent*)&AppConn:(CLAppComponent*)&AppCam);
262
+ if (component->removePrefs () == OS_SUCCESS)
263
+ request->send (200 , " " , " OK" );
264
+ else
265
+ request->send (500 , " " , " Failed to reset preferences" );
266
+ return ;
251
267
}
252
268
253
269
int val = value.toInt ();
@@ -291,12 +307,6 @@ void onControl(AsyncWebServerRequest *request) {
291
307
else if (variable == " lamp" && AppCam.getLamp () != -1 ) {
292
308
AppCam.setLamp (constrain (val,0 ,100 ));
293
309
}
294
- else if (variable == " save_prefs" ) {
295
- AppCam.savePrefs ();
296
- }
297
- else if (variable == " clear_prefs" ) {
298
- AppCam.removePrefs ();
299
- }
300
310
else if (variable == " reboot" ) {
301
311
if (AppCam.getLamp () != -1 ) AppCam.setLamp (0 ); // kill the lamp; otherwise it can remain on during the soft-reboot
302
312
esp_task_wdt_init (3 ,true ); // schedule a a watchdog panic event for 3 seconds in the future
0 commit comments