pmconfig: add last state and modify current state to next state
@@ -180,7 +180,8 @@ int cmd_pmconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
if (argc <= 2)
{
- int current_state;
+ int next_state;
+ int last_state;
int normal_count;
int idle_count;
int standby_count;
@@ -193,7 +194,11 @@ int cmd_pmconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
ctrl.action = BOARDIOC_PM_QUERYSTATE;
boardctl(BOARDIOC_PM_CONTROL, (uintptr_t)&ctrl);
- current_state = ctrl.state;
+ last_state = ctrl.state;
+
+ ctrl.action = BOARDIOC_PM_CHECKSTATE;
+ boardctl(BOARDIOC_PM_CONTROL, (uintptr_t)&ctrl);
+ next_state = ctrl.state;
ctrl.action = BOARDIOC_PM_STAYCOUNT;
ctrl.state = PM_NORMAL;
@@ -212,8 +217,10 @@ int cmd_pmconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
boardctl(BOARDIOC_PM_CONTROL, (uintptr_t)&ctrl);
sleep_count = ctrl.count;
- nsh_output(vtbl, "Current state %d, PM stay [%d, %d, %d, %d]\n",
- current_state, normal_count, idle_count, standby_count, sleep_count);
+ nsh_output(vtbl, "Last state %d, Next state %d",
+ "PM stay [%d, %d, %d, %d]\n",
+ last_state, next_state, normal_count, idle_count,
+ standby_count, sleep_count);
}
else if (argc <= 4)
{
