diff --git a/project/ble_peripheral/ble_app_bladder_patch/command/handlers/cmd_sensor.c b/project/ble_peripheral/ble_app_bladder_patch/command/handlers/cmd_sensor.c index 07e8590..84379ae 100644 --- a/project/ble_peripheral/ble_app_bladder_patch/command/handlers/cmd_sensor.c +++ b/project/ble_peripheral/ble_app_bladder_patch/command/handlers/cmd_sensor.c @@ -2,14 +2,13 @@ * cmd_sensor.c - Sensor measurement handlers * * msn? -> rsn: battery ADC measurement - * mso? -> rso: TMP235 temperature reading + * mst? -> rso: IMU die temperature reading * msp? -> rsp: IMU 6-axis single read * all_sensors() bulk-measurement helper used by the mbb? handler *============================================================================*/ #include "cmd_common.h" #include "cmd_sensor.h" -#include "dr_piezo.h" /*============================================================================== * msn? -> rsn: Battery level ADC measurement @@ -25,34 +24,23 @@ int Cmd_msn(const ParsedCmd *cmd) } /*============================================================================== - * mst? -> rso: Temperature with piezo power cycle + * mst? -> rso: IMU die temperature * * Request: [TAG 4B "mst?"] [CRC 2B] * Response: [TAG 4B "rso:"] [temp_x100 2B BE] [CRC 2B] - * - * TMP235 shares the piezo TX/RX power rail. This command handles the full - * sequence: power ON -> measure -> power OFF, so the caller doesn't need - * to send mpa?/mpb? separately. - * Response is sent from the TMP235 SAADC callback (tmp235_voltage_handler). *============================================================================*/ int Cmd_mst(const ParsedCmd *cmd) { - uint32_t timeout_cnt; + uint16_t imu_temp_x100 = 0xFFFF; (void)cmd; - if (!dr_piezo_is_power_on()) + if (imu_read_temperature_x100(&imu_temp_x100, NULL) != 0) { - dr_piezo_power_on(); + imu_temp_x100 = 0xFFFF; } - tmp235_saadc_done = false; - tmp235_voltage_level_meas(); - for (timeout_cnt = 0; !tmp235_saadc_done && timeout_cnt < 100; timeout_cnt++) - { - dr_sd_delay_ms(1); - } - - dr_piezo_power_off(); + single_format_data(ble_bin_buffer, "rso:", imu_temp_x100); + dr_binary_tx_safe(ble_bin_buffer, 3); return 1; }