From e925a9bd99d4a2d833d61e080035a27f6217de77 Mon Sep 17 00:00:00 2001 From: zhaohe Date: Sun, 4 Feb 2024 21:52:39 +0800 Subject: [PATCH] update --- app/app.uvoptx | 2 +- app/src/device_ctrl_service.c | 21 +++++++++++++-------- app/src/heart_wave_sample_service.c | 3 ++- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/app/app.uvoptx b/app/app.uvoptx index 427b1cc..cdafab2 100644 --- a/app/app.uvoptx +++ b/app/app.uvoptx @@ -73,7 +73,7 @@ 0 - 1 + 0 0 1 diff --git a/app/src/device_ctrl_service.c b/app/src/device_ctrl_service.c index 9b092a7..884a975 100644 --- a/app/src/device_ctrl_service.c +++ b/app/src/device_ctrl_service.c @@ -56,8 +56,8 @@ static void zble_event_listener(zble_event_t* ble_event) { // /******************************************************************************* * 事件处理 * *******************************************************************************/ -static bool m_ispoweron = false; -//static bool m_drop_state_triggered = false; +static bool m_ispoweron = false; +// static bool m_drop_state_triggered = false; static void poweroff() { if (!m_ispoweron) return; BoardBeepCtrl_unload(); @@ -139,12 +139,12 @@ static void prvf_change_to_sample_state() { // static void app_event_listener(void* p_event_data, uint16_t event_size) { // app_event_t* event = (app_event_t*)p_event_data; - //static bool inited; - // if (!inited) { - // nrf_gpio_cfg_input(BUTTON_PIN, NRF_GPIO_PIN_NOPULL); - // inited = true; - // } - // ZLOGI("button %d", nrf_gpio_pin_read(BUTTON_PIN)); + // static bool inited; + // if (!inited) { + // nrf_gpio_cfg_input(BUTTON_PIN, NRF_GPIO_PIN_NOPULL); + // inited = true; + // } + // ZLOGI("button %d", nrf_gpio_pin_read(BUTTON_PIN)); /******************************************************************************* * 状态无关事件处理 * @@ -167,10 +167,15 @@ static void app_event_listener(void* p_event_data, uint16_t event_size) { // // else if (m_device_state == kdevice_state_ready) { + /******************************************************************************* + * 永不休眠 * + *******************************************************************************/ +#if 0 if (!zble_module_is_connected() && DeviceCtrl_cur_state_haspassed_ms() > APP_AUTO_SLEEP_TIMEOUT_MS) { ZLOGI("auto sleep"); prvf_change_to_standby_state(); } +#endif if (event->eventType == kevent_start_sample_cmd_event) { ZLOGI("start sample"); diff --git a/app/src/heart_wave_sample_service.c b/app/src/heart_wave_sample_service.c index a3784d8..e0a5d6c 100644 --- a/app/src/heart_wave_sample_service.c +++ b/app/src/heart_wave_sample_service.c @@ -403,7 +403,7 @@ void hwss_init(void) { */ nrfx_err_t err; nrfx_timer_config_t timer_cfg = { - .frequency = NRF_TIMER_FREQ_125kHz, + .frequency = NRF_TIMER_FREQ_250kHz, .mode = NRF_TIMER_MODE_TIMER, .bit_width = NRF_TIMER_BIT_WIDTH_24, .p_context = NULL, @@ -417,6 +417,7 @@ void hwss_init(void) { ZASSERT(SAMPLE_RATE == 400); uint32_t timer_ticks = nrfx_timer_ms_to_ticks(&m_timer, 5); // 200HZ + ZLOGI("timer_ticks:%d\n", timer_ticks); ZASSERT(timer_ticks % 2 == 0); // timer_ticks = timer_ticks / 2; // 400HZ nrfx_timer_extended_compare(&m_timer, NRF_TIMER_CC_CHANNEL0, timer_ticks, NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK, true);