[cli] allow to run factoryreset under the diag mode (#7566)

Before starting a test case, our test script calls the `factoryreset`
to make the device enters a known state . But the previous test case
may fail to call the `diag stop` before exiting. This case the next
test case failed to call the `factoryreset `.

This commit allows the users to call `factoryreset` under the diag
mode.
This commit is contained in:
Zhanglong Xia
2022-04-07 15:03:16 -07:00
committed by GitHub
parent a9b4e637f9
commit efedbe9784
+1 -1
View File
@@ -262,7 +262,7 @@ void Interpreter::ProcessLine(char *aBuf)
LogInput(args);
#if OPENTHREAD_CONFIG_DIAG_ENABLE
if (otDiagIsEnabled(GetInstancePtr()) && (args[0] != "diag"))
if (otDiagIsEnabled(GetInstancePtr()) && (args[0] != "diag") && (args[0] != "factoryreset"))
{
OutputLine("under diagnostics mode, execute 'diag stop' before running any other commands.");
ExitNow(error = OT_ERROR_INVALID_STATE);