You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/05/22 14:00:16 UTC

[incubator-nuttx-apps] branch master updated: pmconfig: add last state and modify current state to next state

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new 23584669c pmconfig: add last state and modify current state to next state
23584669c is described below

commit 23584669c5e25cdea01c342fdedc3cd7cb3e0c17
Author: zhuyanlin <zh...@xiaomi.com>
AuthorDate: Fri May 6 19:31:12 2022 +0800

    pmconfig: add last state and modify current state to next state
    
    Signed-off-by: zhuyanlin <zh...@xiaomi.com>
---
 nshlib/nsh_syscmds.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/nshlib/nsh_syscmds.c b/nshlib/nsh_syscmds.c
index 40a449113..620a246ce 100644
--- a/nshlib/nsh_syscmds.c
+++ b/nshlib/nsh_syscmds.c
@@ -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)
     {