BLE 연결 실패 발생 시 추적을 위한 RTT 로그 추가
- 0: IMU 값 송신(msp)- 1: 배터리 SAADC 시작- 2: 배터리 콜백 완료(battery_event_handler)- 3: 배터리 대기 루프 탈출- 4: IMU 읽기 완료- 5: Piezo RX/TX Active- 6: 온도 SAADC 시작- 7: 온도 콜백 완료(tmp235_voltage_handler)- 8: 온도 대기 루프 탈출- 9: rbb: 패킷 전송- 10: Piezo 캡처 시작(maa_async_start)- 11: 전체 종료(mbb)
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "nrf_gpio.h"
|
||||
#include "debug_print.h"
|
||||
#include "nrf_delay.h"
|
||||
#include "dr_piezo.h"
|
||||
#include "dr_util.h"
|
||||
@@ -1010,30 +1011,36 @@ static void all_sensors(void)
|
||||
info4 = true; /* 센서값을 전역 변수에 저장 (BLE 전송 안 함) */
|
||||
|
||||
/* 1. 배터리 전압 측정 → info_batt에 저장 */
|
||||
DBG_PRINTF("1");
|
||||
battery_saadc_done = false;
|
||||
battery_level_meas();
|
||||
for (timeout_cnt = 0; !battery_saadc_done && timeout_cnt < 100; timeout_cnt++)
|
||||
{
|
||||
dr_sd_delay_ms(1); /* 콜백 오면 즉시 탈출, 최대 100ms */
|
||||
}
|
||||
DBG_PRINTF("3");
|
||||
|
||||
/* 2. IMU 6축 단발 읽기 → info_imu[6]에 저장 */
|
||||
hw_i2c_init_once();
|
||||
imu_read_direct();
|
||||
DBG_PRINTF("4");
|
||||
|
||||
/* 3. 온도 측정 → info_temp에 저장 (TMP235는 Piezo TX/RX 전원 필요) */
|
||||
if (!dr_piezo_is_power_on())
|
||||
{
|
||||
dr_piezo_power_on();
|
||||
}
|
||||
DBG_PRINTF("5");
|
||||
|
||||
DBG_PRINTF("6");
|
||||
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); /* 콜백 오면 즉시 탈출, 최대 100ms, 타임아웃 시 이전 값 또는 쓰레기값.. */
|
||||
}
|
||||
DBG_PRINTF("8");
|
||||
|
||||
info4 = false;
|
||||
|
||||
@@ -1054,6 +1061,7 @@ static void all_sensors(void)
|
||||
buf[19] = (uint8_t)(info_temp >> 8);
|
||||
|
||||
dr_binary_tx_safe(buf, 10); /* 20바이트 = 10워드 */
|
||||
DBG_PRINTF("9");
|
||||
|
||||
/* 배터리, IMU, 온도 확인용 로그 */
|
||||
//if (g_plat.log) g_plat.log("-------------------------------------------------------------------------------------\r\n[Battery] %u\r\n[IMU] %d,%d,%d,%d,%d,%d\r\n[Temperature] %u\r\n\r\n", info_batt, (int16_t)info_imu[0], (int16_t)info_imu[1], (int16_t)info_imu[2],
|
||||
@@ -1077,6 +1085,7 @@ static int Cmd_mbb(const ParsedCmd *cmd)
|
||||
dr_adc_err_t err;
|
||||
|
||||
all_sensors(); /* 배터리, IMU, 온도 센서 먼저 측정 */
|
||||
DBG_PRINTF("10");
|
||||
|
||||
if (maa_async_is_busy())
|
||||
{
|
||||
@@ -1111,6 +1120,7 @@ static int Cmd_mbb(const ParsedCmd *cmd)
|
||||
dr_piezo_power_off();
|
||||
return 1;
|
||||
}
|
||||
DBG_PRINTF("11\n");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user