|
|
@ -10,6 +10,7 @@ |
|
|
|
#include "sample_data_manager_service.h" |
|
|
|
#include "zble_module.h" |
|
|
|
#include "zdatachannel_service.h" |
|
|
|
#include "znordic.h" |
|
|
|
// |
|
|
|
APP_TIMER_DEF(m_state_machine_driver_tmr); // 状态机驱动定时器 |
|
|
|
static device_state_t m_device_state = kdevice_state_standby; // 设备状态 |
|
|
@ -60,6 +61,17 @@ static void zble_event_listener(zble_event_t* ble_event) { // |
|
|
|
*******************************************************************************/ |
|
|
|
static bool m_ispoweron = false; |
|
|
|
// static bool m_drop_state_triggered = false; |
|
|
|
|
|
|
|
void ENTER_DEEP_SLEEP() { |
|
|
|
// 进入深度睡眠前,使能唤醒引脚 |
|
|
|
BoardButton_enable_sense(); |
|
|
|
// nrf_sdh_disable_request(); |
|
|
|
app_timer_stop_all(); |
|
|
|
nrf_sdh_disable_request(); |
|
|
|
sd_power_system_off(); |
|
|
|
NVIC_SystemReset(); |
|
|
|
} |
|
|
|
|
|
|
|
static void poweroff() { |
|
|
|
if (!m_ispoweron) return; |
|
|
|
BoardBeepCtrl_unload(); |
|
|
@ -75,10 +87,8 @@ static void poweroff() { |
|
|
|
BoardLight_setGreenLightEffect(kLightEffect_close); |
|
|
|
app_timer_stop_all(); |
|
|
|
// 进入深度睡眠前,使能唤醒引脚 |
|
|
|
BoardButton_enable_sense(); |
|
|
|
sd_power_system_off(); |
|
|
|
NVIC_SystemReset(); |
|
|
|
m_ispoweron = false; |
|
|
|
|
|
|
|
ENTER_DEEP_SLEEP(); |
|
|
|
} |
|
|
|
static void poweron() { |
|
|
|
if (m_ispoweron) { |
|
|
@ -302,11 +312,7 @@ void DeviceCtrl_init() { |
|
|
|
BoardLight_blockFlash(3, 100); |
|
|
|
|
|
|
|
// 系统进入深度睡眠,进入深度睡眠前,使能唤醒引脚 |
|
|
|
BoardButton_enable_sense(); |
|
|
|
app_timer_stop_all(); |
|
|
|
sd_power_system_off(); |
|
|
|
NVIC_SystemReset(); |
|
|
|
m_ispoweron = false; |
|
|
|
ENTER_DEEP_SLEEP(); |
|
|
|
} |
|
|
|
|
|
|
|
// 注册事件监听 |
|
|
|