온도 센서 콜백 대기 조건 변경
- parser.c: 콜백 완료 플래그 무한대기 -> 최대 100ms 대기, 콜백 오면 즉시 탈출
This commit is contained in:
@@ -92,6 +92,7 @@ extern int imu_read_direct(void); /* IMU 레지스터 직접 읽기 + BLE 전
|
||||
extern volatile uint16_t info_batt; /* 배터리 전압 (mV) */
|
||||
extern volatile uint16_t info_temp; /* 온도 (°C x 100) */
|
||||
extern volatile uint16_t info_imu[6]; /* IMU 6축 (accel XYZ + gyro XYZ) */
|
||||
extern volatile bool tmp235_saadc_done; /* TMP235 SAADC 콜백 완료 플래그 */
|
||||
|
||||
extern void pressure_all_level_meas(void); /* 압력 센서 전체 측정 */
|
||||
extern void battery_timer_stop(void); /* 배터리 타이머 중지 */
|
||||
@@ -1003,6 +1004,9 @@ static int Cmd_maa(const ParsedCmd *cmd)
|
||||
*/
|
||||
static void all_sensors(void)
|
||||
{
|
||||
uint8_t *buf;
|
||||
uint32_t timeout_cnt;
|
||||
|
||||
info4 = true; /* 센서값을 전역 변수에 저장 (BLE 전송 안 함) */
|
||||
|
||||
/* 1. 배터리 전압 측정 → info_batt에 저장 */
|
||||
@@ -1019,15 +1023,18 @@ static void all_sensors(void)
|
||||
dr_piezo_power_on();
|
||||
}
|
||||
|
||||
extern volatile bool tmp235_saadc_done;
|
||||
tmp235_saadc_done = false;
|
||||
tmp235_voltage_level_meas();
|
||||
while (!tmp235_saadc_done) { dr_sd_delay_ms(1); } /* SAADC 콜백 완료 대기 */
|
||||
|
||||
for (timeout_cnt = 0; !tmp235_saadc_done && timeout_cnt < 100; timeout_cnt++)
|
||||
{
|
||||
dr_sd_delay_ms(1); /* 콜백 오면 즉시 탈출, 최대 100ms, 타임아웃 시 이전 값 또는 쓰레기값.. */
|
||||
}
|
||||
|
||||
info4 = false;
|
||||
|
||||
|
||||
/* rbb: 패킷 조립 및 전송 : [TAG 4B] [배터리 2B] [IMU 12B] [온도 2B] = 20바이트 = 10워드 */
|
||||
uint8_t *buf = ble_bin_buffer;
|
||||
buf = ble_bin_buffer;
|
||||
|
||||
buf[0] = 'r'; buf[1] = 'b'; buf[2] = 'b'; buf[3] = ':';
|
||||
buf[4] = (uint8_t)(info_batt & 0xFF);
|
||||
|
||||
Reference in New Issue
Block a user