修改关机进入休眠并等待关机

This commit is contained in:
dianke3yu 2025-07-25 17:45:05 +08:00
parent dcca71d4d5
commit 6cc55e5964

View File

@ -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();