Skip to content

Commit b9b1163

Browse files
committed
wired up the reset / reboot ! commands
1 parent 6df92f6 commit b9b1163

File tree

2 files changed

+24
-43
lines changed

2 files changed

+24
-43
lines changed

sfeIoTNodeLoRaWAN/sfeIoTNodeLoRaWAN.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ void sfeIoTNodeLoRaWAN::onSettingsEdit(bool bLoading)
517517
if (inOpMode(kAppOpPendingRestart))
518518
{
519519
flxLog_N("\n\rSome changes required a device restart to take effect...");
520-
// _sysUpdate.restartDevice();
520+
_sysSystem.restartDevice();
521521

522522
// this shouldn't return unless user aborted
523523
clearOpMode(kAppOpPendingRestart);

sfeIoTNodeLoRaWAN/sfeNLCommands.h

Lines changed: 23 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -25,46 +25,28 @@ class sfeNLCommands
2525
//---------------------------------------------------------------------
2626
// Command Callbacks
2727
//---------------------------------------------------------------------
28-
// bool factoryResetDevice(sfeIoTNodeLoRaWAN *theApp)
29-
// {
30-
// if (!theApp)
31-
// return false;
3228

33-
// return theApp->_sysUpdate.factoryResetDevice();
34-
// }
29+
//---------------------------------------------------------------------
30+
bool resetDevice(sfeIoTNodeLoRaWAN *theApp)
31+
{
32+
if (!theApp)
33+
return false;
3534

36-
// //---------------------------------------------------------------------
37-
// bool resetDevice(sfeIoTNodeLoRaWAN *theApp)
38-
// {
39-
// if (!theApp)
40-
// return false;
41-
42-
// // Need to prompt for an a-okay ...
43-
// Serial.printf("\n\rClear and Restart Device? [Y/n]? ");
44-
// uint8_t selected = theApp->_serialSettings.getMenuSelectionYN();
45-
// flxLog_N("");
46-
47-
// if (selected != 'y' || selected == kReadBufferTimeoutExpired || selected == kReadBufferExit)
48-
// {
49-
// flxLog_I(F("Aborting..."));
50-
// return false;
51-
// }
52-
53-
// return resetDeviceForced(theApp);
54-
// }
55-
// //---------------------------------------------------------------------
56-
// bool resetDeviceForced(sfeIoTNodeLoRaWAN *theApp)
57-
// {
58-
// if (!theApp)
59-
// return false;
35+
theApp->_sysSystem.resetDevicePrompt();
6036

61-
// theApp->_sysStorage.resetStorage();
62-
// flxLog_I(F("Settings Cleared"));
37+
// should never get here
38+
return true;
39+
}
40+
//---------------------------------------------------------------------
41+
bool resetDeviceForced(sfeIoTNodeLoRaWAN *theApp)
42+
{
43+
if (!theApp)
44+
return false;
6345

64-
// theApp->_sysUpdate.restartDevice();
46+
theApp->_sysSystem.resetDevice();
6547

66-
// return true;
67-
// }
48+
return true;
49+
}
6850
//---------------------------------------------------------------------
6951
bool clearDeviceSettings(sfeIoTNodeLoRaWAN *theApp)
7052
{
@@ -100,17 +82,17 @@ class sfeNLCommands
10082
// //---------------------------------------------------------------------
10183
bool restartDevice(sfeIoTNodeLoRaWAN *theApp)
10284
{
103-
// if (theApp)
104-
// theApp->_sysUpdate.restartDevicePrompt();
85+
if (theApp)
86+
theApp->_sysSystem.restartDevicePrompt();
10587

10688
return true;
10789
}
10890
//---------------------------------------------------------------------
10991
bool restartDeviceForced(sfeIoTNodeLoRaWAN *theApp)
11092
{
11193

112-
// if (theApp)
113-
// theApp->_sysUpdate.restartDevice();
94+
if (theApp)
95+
theApp->_sysSystem.restartDevice();
11496

11597
return true;
11698
}
@@ -406,9 +388,8 @@ class sfeNLCommands
406388
//---------------------------------------------------------------------
407389
// our command map - command name to callback method
408390
commandMap_t _commandMap = {
409-
// {"factory-reset", &sfeNLCommands::factoryResetDevice},
410-
// {"reset-device", &sfeNLCommands::resetDevice},
411-
// {"reset-device-forced", &sfeNLCommands::resetDeviceForced},
391+
{"reset-device", &sfeNLCommands::resetDevice},
392+
{"reset-device-forced", &sfeNLCommands::resetDeviceForced},
412393
{"clear-settings", &sfeNLCommands::clearDeviceSettings},
413394
{"clear-settings-forced", &sfeNLCommands::clearDeviceSettingsForced},
414395
{"restart", &sfeNLCommands::restartDevice},

0 commit comments

Comments
 (0)