TMP235 온도 측정 경로 정리
- mst? 온도 응답을 IMU register direct read로 대체 - go_temp/TMP235 legacy 경로 및 빌드 대상 제거 - info_temp 전역 정의를 IMU 모듈로 이동 - TMP235 드라이버는 deprecated reference로 표시
This commit is contained in:
@@ -46,7 +46,6 @@ extern uint8_t resetCount;
|
||||
*----------------------------------------------------------------------------*/
|
||||
extern void battery_level_meas(void);
|
||||
extern void pressure_all_level_meas(void);
|
||||
extern void tmp235_voltage_level_meas(void);
|
||||
extern int imu_read_direct(void);
|
||||
extern int imu_read_temperature_x100(uint16_t *temp_x100, float *temp_c);
|
||||
extern int imu_fifo_capture_start(void);
|
||||
@@ -66,7 +65,6 @@ extern bool motion_raw_data_enabled;
|
||||
extern volatile uint16_t info_batt;
|
||||
extern volatile uint16_t info_temp;
|
||||
extern volatile uint16_t info_imu[6];
|
||||
extern volatile bool tmp235_saadc_done;
|
||||
extern volatile bool battery_saadc_done;
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "parser.h"
|
||||
|
||||
int Cmd_msn(const ParsedCmd *cmd); /* msn? -> rsn: battery ADC measurement */
|
||||
int Cmd_mst(const ParsedCmd *cmd); /* mst? -> rso: TMP235 with piezo power cycle */
|
||||
int Cmd_mst(const ParsedCmd *cmd); /* mst? -> rso: IMU die temperature */
|
||||
int Cmd_msp(const ParsedCmd *cmd); /* msp? -> rsp: IMU 6-axis single read */
|
||||
/* Helper for the mbb? handler: sequentially measures battery / IMU / temperature, then emits a single rbb: response.
|
||||
* Called from Cmd_mbb() in cmd_piezo.c. */
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* [Hardware Configuration]
|
||||
* - MCU: nRF52840 (SoftDevice S140 v7.x)
|
||||
* - IMU: ICM42670P 6-axis accel/gyro (I2C, 0x68)
|
||||
* - Temperature: TMP235-Q1 analog sensor (SAADC AIN3)
|
||||
* - Temperature: IMU register direct read
|
||||
* - Battery: voltage divider (SAADC AIN2, 1/3 prescale)
|
||||
* - Power: POWER_HOLD(P0.8) self-latch circuit, POWER_BUTTON(P1.8) input
|
||||
*
|
||||
@@ -94,7 +94,6 @@
|
||||
#include "app_raw_main.h" /* Sensor raw data processing module */
|
||||
#include "main_timer.h" /* Main event loop timer (10ms period) */
|
||||
#include "power_control.h" /* Power sequence control (ON/OFF/sleep) */
|
||||
#include "tmp235_q1.h" /* TMP235-Q1 temperature sensor driver */
|
||||
#include "fds.h" /* Flash Data Storage (non-volatile config) */
|
||||
#include "battery_saadc.h" /* Battery voltage measurement (SAADC) */
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include "app_timer.h"
|
||||
#include "battery_saadc.h"
|
||||
#include "main_timer.h"
|
||||
#include "tmp235_q1.h"
|
||||
#include "app_raw.h"
|
||||
#include "dr_piezo.h"
|
||||
#include "debug_print.h"
|
||||
@@ -60,9 +59,6 @@ APP_TIMER_DEF(m_battery_loop_timer_id);
|
||||
/* Low-battery check flag — set by battery_loop, consumed by handler */
|
||||
bool low_battery_check = false;
|
||||
|
||||
/* Safety check mode flag — legacy TMP235 path */
|
||||
bool safety_check_mode = false;
|
||||
|
||||
/* SAADC callback completion flag — used by all_sensors() to wait */
|
||||
volatile bool battery_saadc_done = false;
|
||||
|
||||
@@ -85,7 +81,6 @@ extern uint8_t ble_bin_buffer[BLE_NUS_MAX_DATA_LEN];
|
||||
volatile uint16_t info_batt;
|
||||
|
||||
/* info4 sequential measurement control flags */
|
||||
extern bool go_temp;
|
||||
extern bool go_batt;
|
||||
|
||||
extern bool motion_raw_data_enabled;
|
||||
@@ -94,7 +89,7 @@ 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 after IMU die temperature measurement
|
||||
*
|
||||
* Checks both battery voltage and temperature against thresholds.
|
||||
* 5 consecutive readings exceeding either threshold triggers power OFF.
|
||||
@@ -168,7 +163,7 @@ void battery_event_handler(nrf_drv_saadc_evt_t const * p_event)
|
||||
|
||||
register_val = p_event->data.done.p_buffer[0];
|
||||
|
||||
/* Release SAADC — shared with temperature / pressure ADC */
|
||||
/* Release SAADC — shared with pressure ADC */
|
||||
nrf_drv_saadc_channel_uninit(0);
|
||||
nrf_drv_saadc_uninit();
|
||||
|
||||
|
||||
@@ -25,9 +25,6 @@
|
||||
/* SAADC callback completion flag (used by all_sensors() to wait) */
|
||||
extern volatile bool battery_saadc_done;
|
||||
|
||||
/* Safety check mode flag — legacy TMP235 path */
|
||||
extern bool safety_check_mode;
|
||||
|
||||
/* Called when safety check temperature measurement completes */
|
||||
void safety_check_complete(float temp_c);
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ extern which_cmd_t cmd_type_t; /* Current command source (
|
||||
uint16_t ssp_data[6]={0,}; /* 6-axis data array for BLE (accel XYZ + gyro XYZ) */
|
||||
extern bool info4; /* info4 mode flag (set by cmd_parse) */
|
||||
volatile uint16_t info_imu[6]; /* Global array storing IMU data in info4 mode */
|
||||
extern volatile uint16_t info_temp; /* Global temperature cache (deg C x 100) */
|
||||
volatile uint16_t info_temp; /* Global temperature cache (deg C x 100) */
|
||||
|
||||
/* --------------------------------------------------------------------------------------
|
||||
* static function declaration
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
/*==============================================================================
|
||||
* tmp235_q1.c - TMP235-Q1 analogue temperature sensor driver
|
||||
*
|
||||
* Deprecated: temperature measurement has been replaced by IMU register direct read paths.
|
||||
* This file is kept only as a legacy reference and is not built.
|
||||
*
|
||||
* Reads the TMP235-Q1 analogue output via SAADC AIN3 and converts to deg C.
|
||||
*
|
||||
* Temperature conversion (piecewise linear, per datasheet):
|
||||
|
||||
+157
-169
File diff suppressed because it is too large
Load Diff
-10
@@ -408,11 +408,6 @@
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\system\power\power_control.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tmp235_q1.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\measurement\temperature\tmp235_q1.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>fstorage.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
@@ -4616,11 +4611,6 @@
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\system\power\power_control.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tmp235_q1.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\measurement\temperature\tmp235_q1.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>fstorage.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
|
||||
@@ -14,15 +14,10 @@
|
||||
* - motion_data_once == true: one-shot read (after HW I2C init)
|
||||
* - motion_data_once == false: continuous read (when not waiting for BLE TX)
|
||||
* go_batt -> Battery voltage measurement (battery_level_meas)
|
||||
* go_temp -> Temperature measurement (tmp235_voltage_level_meas)
|
||||
* go_device_power_off -> Device power OFF (device_power_off)
|
||||
* go_sleep_mode_enter -> Enter sleep mode (sleep_mode_enter)
|
||||
* go_NVIC_SystemReset -> NVIC system reset
|
||||
*
|
||||
* [info4 mode measurement order]
|
||||
* IMU continuous read -> go_batt (battery) -> go_temp (temp) -> motion_data_once (IMU one-shot)
|
||||
* After temperature measurement, motion_data_once=true to return to IMU.
|
||||
*
|
||||
* [Timer settings]
|
||||
* - Normal mode: 10ms interval (MAIN_LOOP_INTERVAL)
|
||||
* - FEATURE_DETAIL_VALUE_FULL mode: 80ms interval (for detail printout)
|
||||
@@ -53,7 +48,6 @@
|
||||
#include "main.h"
|
||||
#include "app_raw_main.h"
|
||||
#include "main_timer.h"
|
||||
#include "tmp235_q1.h"
|
||||
//#include "fstorage.h"
|
||||
#include "power_control.h"
|
||||
#include "main.h" /* 2026-03-17: cmd_parse.h removed, use main.h */
|
||||
@@ -83,7 +77,6 @@ extern which_cmd_t cmd_type_t;
|
||||
/* Event flags (set by external modules, processed in main_loop) */
|
||||
/* ========================================================================== */
|
||||
bool go_batt= false; /* Battery measurement request flag */
|
||||
bool go_temp= false; /* Temperature measurement request flag */
|
||||
bool go_device_power_off = false; /* Device power OFF request flag */
|
||||
bool go_sleep_mode_enter = false; /* Sleep mode entry request flag */
|
||||
bool go_NVIC_SystemReset = false; /* System reset request flag */
|
||||
@@ -101,10 +94,9 @@ bool motion_data_once = false; /* IMU one-shot read mode (true: read on
|
||||
* [Processing priority] (checked in code order)
|
||||
* 1. IMU motion data (motion_raw_data_enabled)
|
||||
* 2. Battery measurement (go_batt)
|
||||
* 3. Temperature measurement (go_temp)
|
||||
* 4. Power OFF (go_device_power_off)
|
||||
* 5. Sleep mode (go_sleep_mode_enter)
|
||||
* 6. System reset (go_NVIC_SystemReset)
|
||||
* 3. Power OFF (go_device_power_off)
|
||||
* 4. Sleep mode (go_sleep_mode_enter)
|
||||
* 5. System reset (go_NVIC_SystemReset)
|
||||
*/
|
||||
void main_loop(void * p_context) /* For x ms */
|
||||
{
|
||||
@@ -192,33 +184,11 @@ void main_loop(void * p_context) /* For x ms */
|
||||
DBG_PRINTF("IMU BATT\r\n");
|
||||
main_timer_stop(); /* Stop timer */
|
||||
go_batt = false; /* Consume flag (one-shot) */
|
||||
// go_temp = true;
|
||||
battery_level_meas(); /* Measure battery voltage via SAADC */
|
||||
// nrf_delay_ms(20);
|
||||
// m48_adc_start_init();
|
||||
// main_timer_start();
|
||||
}
|
||||
|
||||
|
||||
/* ---- Temperature measurement ---- */
|
||||
/*
|
||||
* If go_temp is true, measure temperature via TMP235-Q1 sensor.
|
||||
* Called after battery measurement in info4 mode.
|
||||
* After completion, sets motion_data_once=true so the next IMU read
|
||||
* uses one-shot mode (with HW I2C re-init).
|
||||
*/
|
||||
if (go_temp == true)
|
||||
{
|
||||
DBG_PRINTF("IMU Temp\r\n");
|
||||
main_timer_stop(); /* Stop timer */
|
||||
// go_batt = false;
|
||||
go_temp = false; /* Consume flag (one-shot) */
|
||||
motion_data_once = true; /* Switch next IMU read to one-shot mode */
|
||||
tmp235_voltage_level_meas(); /* Measure TMP235-Q1 temperature sensor voltage */
|
||||
// motion_raw_data_enabled = true;
|
||||
// main_timer_start();
|
||||
|
||||
}
|
||||
|
||||
/* ---- System control event handling ---- */
|
||||
|
||||
@@ -285,4 +255,3 @@ void main_timer_init(void)
|
||||
{
|
||||
APP_ERROR_CHECK(app_timer_create(&m_main_loop_timer_id, APP_TIMER_MODE_SINGLE_SHOT, main_loop));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user