Compare commits
3 Commits
b81ae1a868
...
1ea0c74eb7
| Author | SHA1 | Date | |
|---|---|---|---|
| 1ea0c74eb7 | |||
| 1a887a2002 | |||
| 8f269776ed |
@@ -1069,7 +1069,7 @@ static void peer_manager_init(void)
|
|||||||
* Key events handled:
|
* Key events handled:
|
||||||
* - DISCONNECTED: connection lost -> device sleep, state reset
|
* - DISCONNECTED: connection lost -> device sleep, state reset
|
||||||
* - CONNECTED: connection established -> assign QWR handle, set TX power +8dBm
|
* - CONNECTED: connection established -> assign QWR handle, set TX power +8dBm
|
||||||
* - PHY_UPDATE_REQUEST: auto-accept PHY update
|
* - PHY_UPDATE_REQUEST: keep link on 1M PHY
|
||||||
* - TIMEOUT: connection/GATT timeout -> force disconnect
|
* - TIMEOUT: connection/GATT timeout -> force disconnect
|
||||||
* - SEC_PARAMS_REQUEST: security parameter request (reject if security unused)
|
* - SEC_PARAMS_REQUEST: security parameter request (reject if security unused)
|
||||||
* - PASSKEY_DISPLAY: display passkey (debug log)
|
* - PASSKEY_DISPLAY: display passkey (debug log)
|
||||||
@@ -1155,40 +1155,22 @@ static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
|
|||||||
|
|
||||||
sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_CONN, m_conn_handle, 4);
|
sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_CONN, m_conn_handle, 4);
|
||||||
|
|
||||||
// Request 2M PHY (falls back to 1M automatically if unsupported)
|
|
||||||
{
|
|
||||||
ble_gap_phys_t const phys = {
|
|
||||||
.rx_phys = BLE_GAP_PHY_2MBPS,
|
|
||||||
.tx_phys = BLE_GAP_PHY_2MBPS,
|
|
||||||
};
|
|
||||||
err_code = sd_ble_gap_phy_update(m_conn_handle, &phys);
|
|
||||||
APP_ERROR_CHECK(err_code);
|
|
||||||
}
|
|
||||||
|
|
||||||
led_set_state(LED_STATE_OFF); /* Connection complete -> LED OFF */
|
led_set_state(LED_STATE_OFF); /* Connection complete -> LED OFF */
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLE_GAP_EVT_PHY_UPDATE_REQUEST:
|
case BLE_GAP_EVT_PHY_UPDATE_REQUEST:
|
||||||
{
|
{
|
||||||
|
/* Product is certified/tested as fixed 1M PHY. */
|
||||||
ble_gap_phys_t const phys = {
|
ble_gap_phys_t const phys = {
|
||||||
.rx_phys = BLE_GAP_PHY_AUTO,
|
.rx_phys = BLE_GAP_PHY_1MBPS,
|
||||||
.tx_phys = BLE_GAP_PHY_AUTO,
|
.tx_phys = BLE_GAP_PHY_1MBPS,
|
||||||
};
|
};
|
||||||
err_code = sd_ble_gap_phy_update(p_ble_evt->evt.gap_evt.conn_handle, &phys);
|
err_code = sd_ble_gap_phy_update(p_ble_evt->evt.gap_evt.conn_handle, &phys);
|
||||||
APP_ERROR_CHECK(err_code);
|
APP_ERROR_CHECK(err_code);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLE_GAP_EVT_PHY_UPDATE:
|
|
||||||
{
|
|
||||||
ble_gap_evt_phy_update_t const * p_phy = &p_ble_evt->evt.gap_evt.params.phy_update;
|
|
||||||
DBG_PRINTF("[BLE] PHY updated: TX=%s, RX=%s\r\n",
|
|
||||||
p_phy->tx_phy == BLE_GAP_PHY_2MBPS ? "2M" : "1M",
|
|
||||||
p_phy->rx_phy == BLE_GAP_PHY_2MBPS ? "2M" : "1M");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case BLE_GATTC_EVT_TIMEOUT:
|
case BLE_GATTC_EVT_TIMEOUT:
|
||||||
case BLE_GATTS_EVT_TIMEOUT:
|
case BLE_GATTS_EVT_TIMEOUT:
|
||||||
DBG_PRINTF("[BLE] GATT Timeout -> disconnect\r\n");
|
DBG_PRINTF("[BLE] GATT Timeout -> disconnect\r\n");
|
||||||
|
|||||||
@@ -44,8 +44,9 @@
|
|||||||
* : Added mtb? command (reb:+raa:+rim:, 6ch piezo + ICM42670 FIFO at 25 Hz).
|
* : Added mtb? command (reb:+raa:+rim:, 6ch piezo + ICM42670 FIFO at 25 Hz).
|
||||||
* : rim: packet format and FIFO sample cap/filter options (app_raw).
|
* : rim: packet format and FIFO sample cap/filter options (app_raw).
|
||||||
* - VBTFW0116 260522 jhChun : Expanded BLE TX pending slots from 1 → 8 to reduce ADC data packet loss when the TX queue is full
|
* - VBTFW0116 260522 jhChun : Expanded BLE TX pending slots from 1 → 8 to reduce ADC data packet loss when the TX queue is full
|
||||||
|
* - VBTFW0117 260527 jhChun : Prevent battery/temperature safety checks from powering off piezo during MAA capture, and lock BLE PHY to 1M.
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
#define FIRMWARE_VERSION "VBTFW0116"
|
#define FIRMWARE_VERSION "VBTFW0117"
|
||||||
|
|
||||||
/*==============================================================================
|
/*==============================================================================
|
||||||
* Data Length Constants
|
* Data Length Constants
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ extern bool go_batt;
|
|||||||
extern bool motion_raw_data_enabled;
|
extern bool motion_raw_data_enabled;
|
||||||
extern bool ble_got_new_data;
|
extern bool ble_got_new_data;
|
||||||
extern bool motion_data_once;
|
extern bool motion_data_once;
|
||||||
|
extern bool maa_async_is_busy(void);
|
||||||
|
|
||||||
/*==============================================================================
|
/*==============================================================================
|
||||||
* safety_check_complete - Called by tmp235 handler after temperature measurement
|
* safety_check_complete - Called by tmp235 handler after temperature measurement
|
||||||
@@ -102,6 +103,11 @@ void safety_check_complete(float temp_c)
|
|||||||
//DBG_PRINTF("[SAFETY] Batt=%d mV, Temp=%d.%d C\r\n",
|
//DBG_PRINTF("[SAFETY] Batt=%d mV, Temp=%d.%d C\r\n",
|
||||||
// (int)safety_batt_mv, (int)temp_c, ((int)(temp_c * 10)) % 10);
|
// (int)safety_batt_mv, (int)temp_c, ((int)(temp_c * 10)) % 10);
|
||||||
|
|
||||||
|
if (maa_async_is_busy())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Battery check */
|
/* Battery check */
|
||||||
if (safety_batt_mv <= LOW_BATTERY_VOLTAGE)
|
if (safety_batt_mv <= LOW_BATTERY_VOLTAGE)
|
||||||
{
|
{
|
||||||
@@ -268,6 +274,10 @@ void battery_loop(void * p_context)
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (maa_async_is_busy())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
low_battery_check = true;
|
low_battery_check = true;
|
||||||
battery_level_meas();
|
battery_level_meas();
|
||||||
|
|||||||
Reference in New Issue
Block a user