개별 온도 커맨드 mst? 응답 시 TMP235 온도 센서를 IMU register direct read로 대체

- IMU 온도 read 실패 시 rso:ffff 응답
This commit is contained in:
2026-06-15 11:55:03 +09:00
parent 83c0050bf4
commit 29989054c0
@@ -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;
}