Skip to content
Snippets Groups Projects
Commit 9c1d566e authored by Aapo Torkkeli's avatar Aapo Torkkeli
Browse files

Fix sending orientation by timer.

parent d3c0ab20
No related branches found
No related tags found
No related merge requests found
......@@ -125,7 +125,6 @@
APP_TIMER_DEF(send_orientation_timer_id);
extern uint32_t orientation;
uint32_t previous_orientation;
NRF_BLE_GATT_DEF(m_gatt); /**< GATT module instance. */
NRF_BLE_QWR_DEF(m_qwr); /**< Context for the Queued Write module.*/
......@@ -139,6 +138,8 @@ BLE_BAS_DEF(m_bas); // Macro for defining a ble_bas instance
// Flag to keep track of when an indication confirmation is pending
bool m_hts_meas_ind_conf_pending = false;
bool hts_indication_set = false;
// Function declarations
void on_hts_evt(ble_hts_t * p_hts, ble_hts_evt_t * p_evt);
void temperature_measurement_send(void);
......@@ -190,6 +191,7 @@ void on_hts_evt(ble_hts_t * p_hts, ble_hts_evt_t * p_evt) {
case BLE_HTS_EVT_INDICATION_ENABLED:
// Indication has been enabled, send a single temperature measurement
temperature_measurement_send();
hts_indication_set = true;
break;
case BLE_HTS_EVT_INDICATION_CONFIRMED:
m_hts_meas_ind_conf_pending = false;
......@@ -262,8 +264,10 @@ void pm_evt_handler(pm_evt_t const * p_evt) {
* @brief Handler for timer events.
*/
void send_orientation_timer(void* p_context) {
if(hts_indication_set){
temperature_measurement_send();
}
}
/**@brief Function for the Timer initialization.
*
......@@ -663,13 +667,7 @@ void bsp_event_handler(bsp_event_t event) {
APP_ERROR_CHECK(err_code);
}
}
break; // BSP_EVENT_KEY_0
case BSP_EVENT_KEY_0:
if (m_conn_handle != BLE_CONN_HANDLE_INVALID) {
temperature_measurement_send();
}
break;
default:
break;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment