diff --git a/bk_aidk/projects/beken_wss_paopao/main/app_main.c b/bk_aidk/projects/beken_wss_paopao/main/app_main.c index 05a31f28..eb5ed45e 100755 --- a/bk_aidk/projects/beken_wss_paopao/main/app_main.c +++ b/bk_aidk/projects/beken_wss_paopao/main/app_main.c @@ -48,6 +48,7 @@ extern void user_app_main(void); extern void rtos_set_user_app_entry(beken_thread_function_t entry); extern int bk_cli_init(void); extern void bk_set_jtag_mode(uint32_t cpu_id, uint32_t group_id); +void bk_enter_deepsleep(); #define TAG "APP_MAIN" @@ -103,6 +104,7 @@ const struct factory_config_t s_user_config[] = { #if (CONFIG_SYS_CPU0) #include "iot/thing.h" #endif + void power_on(); void power_off(); @@ -254,16 +256,25 @@ static void handle_system_event(key_event_t event) rtos_delay_milliseconds(1000); bk_gpio_enable_output(51); bk_gpio_set_output_low(51); + bk_enter_deepsleep(); + while (1) + { + rtos_delay_milliseconds(1); + bk_printf("wait for power off\n"); + } + } else if (ispoweron == 0) { bk_printf("POWER ON \r\n"); + + bk_gpio_enable_output(51); + bk_gpio_set_output_high(51); power_on(); #if (CONFIG_SYS_CPU0) //打开电源供电 - bk_gpio_enable_output(51); - bk_gpio_set_output_high(51); + ispoweron = 1; ws2812_led_wifi_disconnect();