Răsfoiți Sursa

fix: https://gitee.com/openLuat/LuatOS/issues/I1TD90

Wendal Chen 5 ani în urmă
părinte
comite
7b88663981
2 a modificat fișierele cu 7 adăugiri și 2 ștergeri
  1. 1 1
      luat/include/luat_pm.h
  2. 6 1
      luat/modules/luat_lib_pm.c

+ 1 - 1
luat/include/luat_pm.h

@@ -18,7 +18,7 @@ int luat_pm_dtimer_stop(int id);
 
 void luat_pm_cb(int event, int arg, void* args);
 
-int luat_pm_last_state(void);
+int luat_pm_last_state(int *lastState, int *rtcOrPad);
 
 int luat_pm_force(int mode);
 

+ 6 - 1
luat/modules/luat_lib_pm.c

@@ -93,12 +93,17 @@ static int l_pm_on(lua_State *L) {
 开机原因,用于判断是从休眠模块开机,还是电源/复位开机
 @api pm.lastReson()
 @return int 0-普通开机(上电/复位),3-深睡眠开机,4-休眠开机
+@return int 0-上电开机, RTC开机, WakeupIn/Pad开机
 @usage
 -- 是哪种方式开机呢
 log.info("pm", "last power reson", pm.lastReson)
  */
 static int l_pm_last_reson(lua_State *L) {
-    lua_pushinteger(L, luat_pm_last_state());
+    int lastState = 0;
+    int rtcOrPad = 0;
+    luat_pm_last_state(&lastState, &rtcOrPad);
+    lua_pushinteger(L, lastState);
+    lua_pushinteger(L, rtcOrPad);
     return 1;
 }