diff --git a/src/cmnds/cmd_channels.c b/src/cmnds/cmd_channels.c index a021bd40e..2e220ce03 100644 --- a/src/cmnds/cmd_channels.c +++ b/src/cmnds/cmd_channels.c @@ -370,9 +370,9 @@ static commandResult_t CMD_SetFlag(const void *context, const char *cmd, const c return CMD_RES_OK; } -extern int g_bWantDeepSleep; -static commandResult_t CMD_StartDeepSleep(const void *context, const char *cmd, const char *args, int cmdFlags){ - g_bWantDeepSleep = 1; +extern int g_bWantPinDeepSleep; +static commandResult_t CMD_PinDeepSleep(const void *context, const char *cmd, const char *args, int cmdFlags){ + g_bWantPinDeepSleep = 1; return CMD_RES_OK; } void CMD_InitChannelCommands(){ @@ -426,11 +426,11 @@ void CMD_InitChannelCommands(){ //cmddetail:"fn":"CMD_FriendlyName","file":"cmnds/cmd_channels.c","requires":"", //cmddetail:"examples":""} CMD_RegisterCommand("FriendlyName", "", CMD_FriendlyName, NULL, NULL); - //cmddetail:{"name":"startDeepSleep","args":"", - //cmddetail:"descr":"NULL", - //cmddetail:"fn":"CMD_StartDeepSleep","file":"cmnds/cmd_channels.c","requires":"", + //cmddetail:{"name":"PinDeepSleep","args":"", + //cmddetail:"descr":"Starts a pin deep sleep (deep sleep that can be interrupted by external IO events like a button press)", + //cmddetail:"fn":"CMD_PinDeepSleep","file":"cmnds/cmd_channels.c","requires":"", //cmddetail:"examples":""} - CMD_RegisterCommand("startDeepSleep", "", CMD_StartDeepSleep, NULL, NULL); + CMD_RegisterCommand("PinDeepSleep", "", CMD_PinDeepSleep, NULL, NULL); //cmddetail:{"name":"SetFlag","args":"[FlagIndex][1or0]", //cmddetail:"descr":"Enables/disables given flag.", //cmddetail:"fn":"CMD_SetFlag","file":"cmnds/cmd_channels.c","requires":"", diff --git a/src/cmnds/cmd_main.c b/src/cmnds/cmd_main.c index eb85959db..9dc090e06 100644 --- a/src/cmnds/cmd_main.c +++ b/src/cmnds/cmd_main.c @@ -319,8 +319,8 @@ void CMD_Init_Early() { //cmddetail:"fn":"CMD_ClearAll","file":"cmnds/cmd_main.c","requires":"", //cmddetail:"examples":""} CMD_RegisterCommand("clearAll", "", CMD_ClearAll, NULL, NULL); - //cmddetail:{"name":"DeepSleep","args":"[Miliseconds]", - //cmddetail:"descr":"Enable power save on N & T", + //cmddetail:{"name":"DeepSleep","args":"[Seconds]", + //cmddetail:"descr":"Starts deep sleep for given amount of seconds.", //cmddetail:"fn":"CMD_DeepSleep","file":"cmnds/cmd_main.c","requires":"", //cmddetail:"examples":""} CMD_RegisterCommand("DeepSleep", "", CMD_DeepSleep, NULL, NULL); diff --git a/src/new_pins.c b/src/new_pins.c index b4a94f314..017f6810d 100644 --- a/src/new_pins.c +++ b/src/new_pins.c @@ -92,7 +92,7 @@ uint32_t g_gpio_index_map = 0; uint32_t g_gpio_edge_map = 0; // note: 0->rising, 1->falling -void PINS_BeginDeepSleep() { +void PINS_BeginDeepSleepWithPinWakeUp() { #ifdef PLATFORM_BK7231T bk_enter_deep_sleep(g_gpio_index_map, g_gpio_edge_map); #else diff --git a/src/new_pins.h b/src/new_pins.h index 91e87bb8e..bc237b164 100644 --- a/src/new_pins.h +++ b/src/new_pins.h @@ -335,7 +335,7 @@ void PIN_ticks(void *param); void PIN_set_wifi_led(int value); void PIN_AddCommands(void); -void PINS_BeginDeepSleep(); +void PINS_BeginDeepSleepWithPinWakeUp(); void PIN_SetupPins(); void PIN_OnReboot(); void CFG_ClearPins(); diff --git a/src/user_main.c b/src/user_main.c index 8b3df3aa6..d99c14b20 100644 --- a/src/user_main.c +++ b/src/user_main.c @@ -624,15 +624,15 @@ static int g_wifiLedToggleTime = 0; static int g_wifi_ledState = 0; static uint32_t g_time = 0; static uint32_t g_last_time = 0; -int g_bWantDeepSleep; +int g_bWantPinDeepSleep; ///////////////////////////////////////////////////// // this is what we do in a qucik tick void QuickTick(void *param) { - if (g_bWantDeepSleep) { - PINS_BeginDeepSleep(); - g_bWantDeepSleep = 0; + if (g_bWantPinDeepSleep) { + PINS_BeginDeepSleepWithPinWakeUp(); + g_bWantPinDeepSleep = 0; return; }