Merge pull request #32 from doegox/phil_fix_sleepble

fix sleep timer when BLE gets disconnected
This commit is contained in:
DXL
2023-07-22 13:59:49 +08:00
committed by GitHub
3 changed files with 4 additions and 2 deletions
+2 -2
View File
@@ -411,12 +411,12 @@ static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
break;
case BLE_GAP_EVT_DISCONNECTED:
sleep_timer_start(SLEEP_DELAY_MS_BLE_DISCONNECTED);
NRF_LOG_INFO("Disconnected");
// LED indication will be changed when advertising starts.
m_conn_handle = BLE_CONN_HANDLE_INVALID;
g_is_ble_connected = false;
// call sleep_timer_start *after* unsetting g_is_ble_connected
sleep_timer_start(SLEEP_DELAY_MS_BLE_DISCONNECTED);
break;
case BLE_GAP_EVT_PHY_UPDATE_REQUEST:
@@ -614,6 +614,7 @@ void nfc_tag_14a_event_callback(nrfx_nfct_evt_t const *p_event) {
}
case NRFX_NFCT_EVT_FIELD_LOST: {
g_is_tag_emulating = false;
// call sleep_timer_start *after* unsetting g_is_tag_emulating
sleep_timer_start(SLEEP_DELAY_MS_FIELD_NFC_LOST);
TAG_FIELD_LED_OFF()
@@ -170,6 +170,7 @@ void timer_ce_handler(nrf_timer_event_t event_type, void* p_context) {
m_is_lf_emulating = false;
TAG_FIELD_LED_OFF() // 确保关闭LF的场状态的指示灯
NRF_LPCOMP->INTENSET = LPCOMP_INTENCLR_CROSS_Msk | LPCOMP_INTENCLR_UP_Msk | LPCOMP_INTENCLR_DOWN_Msk | LPCOMP_INTENCLR_READY_Msk;
// call sleep_timer_start *after* unsetting g_is_tag_emulating
sleep_timer_start(SLEEP_DELAY_MS_FIELD_125KHZ_LOST); // 启动进入休眠的定时器
NRF_LOG_INFO("LF FIELD LOST");
}