From d7f0bb5d1c44d3a26d0e0662a62113d220a3f01f Mon Sep 17 00:00:00 2001 From: zhaohe Date: Fri, 9 Feb 2024 03:20:19 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E7=83=A7=E5=BD=95=E5=99=A8=20=E7=83=A7?= =?UTF-8?q?=E5=BD=95=E5=90=8E=E6=97=A0=E6=B3=95=E8=BF=9B=E5=85=A5=E7=9D=A1?= =?UTF-8?q?=E7=9C=A0=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/config/sdk_config.h | 4 ++-- app/src/board/board_button.c | 2 +- app/src/device_ctrl_service.c | 24 +++++++++++++++--------- dynamic_electrocardiograph_ble_server | 2 +- scripter/unlock.bat | 3 ++- sdk | 2 +- 6 files changed, 22 insertions(+), 15 deletions(-) diff --git a/app/config/sdk_config.h b/app/config/sdk_config.h index c380b27..908361c 100644 --- a/app/config/sdk_config.h +++ b/app/config/sdk_config.h @@ -7734,7 +7734,7 @@ // NRF_LOG_BACKEND_RTT_ENABLED - nrf_log_backend_rtt - Log RTT backend //========================================================== #ifndef NRF_LOG_BACKEND_RTT_ENABLED -#define NRF_LOG_BACKEND_RTT_ENABLED 1 +#define NRF_LOG_BACKEND_RTT_ENABLED 0 #endif // NRF_LOG_BACKEND_RTT_TEMP_BUFFER_SIZE - Size of buffer for partially processed strings. // Size of the buffer is a trade-off between RAM usage and processing. @@ -7812,7 +7812,7 @@ // NRF_LOG_ENABLED - nrf_log - Logger //========================================================== #ifndef NRF_LOG_ENABLED -#define NRF_LOG_ENABLED 1 +#define NRF_LOG_ENABLED 0 #endif // Log message pool - Configuration of log message pool diff --git a/app/src/board/board_button.c b/app/src/board/board_button.c index 44601d5..e8bef50 100644 --- a/app/src/board/board_button.c +++ b/app/src/board/board_button.c @@ -29,6 +29,6 @@ void BoardButton_unload() { void BoardButton_enable_sense() { // app_button_disable(); - nrf_gpio_cfg_sense_input(BUTTON_PIN, NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_SENSE_LOW); + nrf_gpio_cfg_sense_input(BUTTON_PIN, NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_LOW); // nrf_gpio_cfg_sense_input(BUTTON_PIN, NRF_GPIO_PIN_PULLDOWN, NRF_GPIO_PIN_SENSE_HIGH); } diff --git a/app/src/device_ctrl_service.c b/app/src/device_ctrl_service.c index 8bdf756..6634b73 100644 --- a/app/src/device_ctrl_service.c +++ b/app/src/device_ctrl_service.c @@ -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(); } // 注册事件监听 diff --git a/dynamic_electrocardiograph_ble_server b/dynamic_electrocardiograph_ble_server index d76e1d1..39b1906 160000 --- a/dynamic_electrocardiograph_ble_server +++ b/dynamic_electrocardiograph_ble_server @@ -1 +1 @@ -Subproject commit d76e1d1de74faaca531d54fb588d229a1090d3eb +Subproject commit 39b1906033f9813f3f909ef0ce1cb7d7d5aa574b diff --git a/scripter/unlock.bat b/scripter/unlock.bat index 2f90789..9b3638e 100644 --- a/scripter/unlock.bat +++ b/scripter/unlock.bat @@ -1,3 +1,4 @@ nrfjprog --recover nrfjprog --eraseall -f NRF52 -nrfjprog -f nrf52 --memwr 0x10001208 --val 0x0000005A \ No newline at end of file +nrfjprog -f nrf52 --memwr 0x10001208 --val 0x0000005A +nrfjprog --eraseall -f NRF52 diff --git a/sdk b/sdk index ae45a16..fe92ba7 160000 --- a/sdk +++ b/sdk @@ -1 +1 @@ -Subproject commit ae45a16c26284c5ac8495ae6838d96cf386deb8e +Subproject commit fe92ba7e68d80cc8a00bb48ae21a5c3573534910