fix: BLE TX 먹통 해결 및 메모리 안전성 개선

- binary_tx_handler를 dr_binary_tx_safe로 전체 교체 (APP_ERROR_CHECK 제거)
- data_tx_handler APP_ERROR_CHECK → DBG_PRINTF 교체
- memset/memcpy 하드코딩 크기를 define 상수로 교체 (버퍼 오버런 수정)
- SERIAL_NO_LENGTH, HW_NO_LENGTH, PASSKEY_LENGTH를 main.h로 통합
- 미사용 HW 드라이버/EEPROM 코드 삭제, TWI를 i2c_manager.c로 통합
- EEPROM → FDS 전환, 코드 리뷰 현황 문서 추가

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-16 16:39:26 +09:00
parent 836ebe5878
commit a1ad2a4b5b
76 changed files with 43253 additions and 16370 deletions

View File

@@ -28,14 +28,8 @@
#include "main_timer.h"
#include "tmp235_q1.h"
//#include "fstorage.h"
//#include "meas_pd_voltage_custom.h"
#include "meas_pd_imm.h"
#include "meas_pd_voltage_full.h"
#include "mcp4725_i2c.h"
#include "ad5272_i2c.h"
#include "power_control.h"
#include <cmd_parse.h>
#include "meas_pd_48.h"
#include "debug_print.h"
#include "i2c_manager.h" //add cj
APP_TIMER_DEF(m_main_loop_timer_id);
@@ -55,15 +49,12 @@ extern which_cmd_t cmd_type_t;
#endif
bool go_batt= false;
bool go_temp= false;
bool go_pdread= false;
bool go_device_power_off = false;
bool go_sleep_mode_enter = false;
bool go_NVIC_SystemReset = false;
bool motion_raw_data_enabled = false;
bool ble_got_new_data = false;
bool motion_data_once = false;
bool adc_enabled = false;
static uint16_t cnt_adc = 0;
void main_loop(void * p_context) /* For x ms */
{
UNUSED_PARAMETER(p_context);
@@ -148,30 +139,6 @@ void main_loop(void * p_context) /* For x ms */
// main_timer_start();
}
if(go_pdread == true) {
//DBG_PRINTF("PD48 ADC=%d\r\n",cnt_adc);
main_timer_stop();
go_pdread = false;
m48_adc_start_init();
}
if(adc_enabled == true) {
main_timer_stop();
DBG_PRINTF("PD48 ADC=%d\r\n",cnt_adc);
if(ble_got_new_data==false){
if (cnt_adc<500){
cnt_adc++;
}
else if (cnt_adc == 500){
cnt_adc = 0;
}
main_timer_start();
}
}