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:
@@ -205,7 +205,7 @@ bool length_error(const char *cmd , uint8_t target_length, uint8_t length)
|
||||
resp_error[3] = '!';
|
||||
|
||||
single_format_data(ble_bin_buffer, resp_error, err_code1);
|
||||
binary_tx_handler(ble_bin_buffer,3);
|
||||
dr_binary_tx_safe(ble_bin_buffer,3);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -228,7 +228,7 @@ bool activate_error(const char *cmd , bool device_status)
|
||||
resp_error[3] = '!';
|
||||
|
||||
single_format_data(ble_bin_buffer, resp_error, err_code2);
|
||||
binary_tx_handler(ble_bin_buffer,3);
|
||||
dr_binary_tx_safe(ble_bin_buffer,3);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -244,7 +244,7 @@ void param_error(const char *cmd )
|
||||
resp_error[3] = '!';
|
||||
|
||||
single_format_data(ble_bin_buffer, resp_error, err_code3);
|
||||
binary_tx_handler(ble_bin_buffer,3);
|
||||
dr_binary_tx_safe(ble_bin_buffer,3);
|
||||
|
||||
}
|
||||
|
||||
@@ -253,10 +253,8 @@ void quest_error(const char *cmd )
|
||||
char resp_error[4];
|
||||
const char pass_init[6] = "123456";
|
||||
if( (cmd[0] == '*') && (cmd[1] == '*') && (cmd[2] == '*') && (cmd[3] == '*')){
|
||||
if(eeprom_write_encrypted(0x0020, (uint8_t *)pass_init, 6)!= NRF_SUCCESS)
|
||||
{
|
||||
DBG_PRINTF("ERR!!! EEP_passkey 6\r\n\r\n");;
|
||||
}
|
||||
memcpy(m_config.static_passkey, pass_init, 6);
|
||||
config_save();
|
||||
|
||||
|
||||
resp_error[0] = '*';
|
||||
@@ -264,7 +262,7 @@ void quest_error(const char *cmd )
|
||||
resp_error[2] = cmd[2]; // 3rd letter (index 2)
|
||||
resp_error[3] = '*';
|
||||
single_format_data(ble_bin_buffer, resp_error, err_code4);
|
||||
binary_tx_handler(ble_bin_buffer,3);
|
||||
dr_binary_tx_safe(ble_bin_buffer,3);
|
||||
}
|
||||
else{
|
||||
|
||||
@@ -275,7 +273,7 @@ void quest_error(const char *cmd )
|
||||
resp_error[3] = '!';
|
||||
|
||||
single_format_data(ble_bin_buffer, resp_error, err_code4);
|
||||
binary_tx_handler(ble_bin_buffer,3);
|
||||
dr_binary_tx_safe(ble_bin_buffer,3);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -315,83 +313,7 @@ void quest_error(const char *cmd )
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
ret_code_t eeprom_read_bool(uint16_t mem_address, bool *value_out)
|
||||
{
|
||||
uint8_t raw;
|
||||
ret_code_t ret = eeprom_read_byte(mem_address, &raw);
|
||||
if (ret != NRF_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
*value_out = (raw != 0);
|
||||
return NRF_SUCCESS;
|
||||
}
|
||||
ret_code_t eeprom_init_values_read(void)
|
||||
{
|
||||
ret_code_t err_code;
|
||||
//uint8_t *data_bond;
|
||||
// Read 11 bytes from EEPROM
|
||||
err_code = eeprom_read_decrypted(0x0030, (uint8_t *)SERIAL_NO, 12);
|
||||
if (err_code != NRF_SUCCESS)
|
||||
{
|
||||
return err_code;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
DBG_PRINTF("\r\n SN:%s \r\n", SERIAL_NO);
|
||||
|
||||
}
|
||||
err_code = eeprom_read_decrypted(0x0020, (uint8_t *)m_static_passkey, 6);
|
||||
if (err_code != NRF_SUCCESS)
|
||||
{
|
||||
return err_code;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
DBG_PRINTF("\r\n passkey-0 :%s \n", m_static_passkey);
|
||||
|
||||
}
|
||||
//err_code = eeprom_read_bytes(0x0060, data_bond,16);
|
||||
err_code = eeprom_read_bool(0x0060, &bond_data_delete);
|
||||
if (err_code != NRF_SUCCESS)
|
||||
{
|
||||
return err_code;
|
||||
}
|
||||
else
|
||||
{
|
||||
// bond_data_delete = data_bond[0];
|
||||
DBG_PRINTF("\r\n bond_data_delete :%d \n", bond_data_delete);
|
||||
|
||||
}
|
||||
|
||||
err_code = eeprom_read_byte(0x0065, &m_reset_status);
|
||||
if (err_code != NRF_SUCCESS)
|
||||
{
|
||||
return err_code;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(m_reset_status){
|
||||
//DBG_PRINTF("\r\n status :%d \n", m_reset_status);
|
||||
}
|
||||
}
|
||||
DBG_PRINTF("m_life_cycle eprom read\n"); //ad cj
|
||||
err_code = eeprom_read_uint32(0x0090, &m_life_cycle);
|
||||
if (err_code != NRF_SUCCESS)
|
||||
{
|
||||
return err_code;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(m_life_cycle){
|
||||
DBG_PRINTF("\r\n m_life_cycle :%1u \r\n", m_life_cycle);
|
||||
}
|
||||
}
|
||||
|
||||
return NRF_SUCCESS;
|
||||
}
|
||||
/* eeprom_init_values_read() 삭제됨 — FDS config_load()가 동일 역할 수행 - jhChun 26.03.16 */
|
||||
|
||||
|
||||
static void log_printf(const char *fmt, ...)
|
||||
@@ -428,7 +350,7 @@ void received_command_process (uint8_t const *data_array, which_cmd_t cmd_t, uin
|
||||
if (!parser_initialized) {
|
||||
// Setup platform interface
|
||||
g_plat.log = log_printf; // printf
|
||||
g_plat.tx_bin = binary_tx_handler;
|
||||
g_plat.tx_bin = dr_binary_tx_safe;
|
||||
g_plat.crc_check = true; // CRC
|
||||
g_log_enable = true;
|
||||
|
||||
@@ -471,7 +393,7 @@ void received_command_process (uint8_t const *data_array, which_cmd_t cmd_t, uin
|
||||
resp_error[3] = '!';
|
||||
|
||||
single_format_data(ble_bin_buffer, resp_error, err_code6);
|
||||
binary_tx_handler(ble_bin_buffer,3);
|
||||
dr_binary_tx_safe(ble_bin_buffer,3);
|
||||
return ;
|
||||
}
|
||||
else if(processing == true)
|
||||
@@ -588,7 +510,7 @@ if((scmd.tag[0] == 's')&&(scmd.tag[1] == 't')&&(scmd.tag[2] == 'a')&&(scmd.tag[3
|
||||
} else if(cmd_t == CMD_BLE) {
|
||||
|
||||
single_format_data(ble_bin_buffer, "rta:", scmd.value0);
|
||||
binary_tx_handler(ble_bin_buffer,3);
|
||||
dr_binary_tx_safe(ble_bin_buffer,3);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -617,7 +539,7 @@ else if((scmd.tag[0] == 's')&&(scmd.tag[1] == 't')&&(scmd.tag[2] == 'r')&&(scmd.
|
||||
|
||||
|
||||
single_format_data(ble_bin_buffer, "rtr:", (uint8_t)device_status);
|
||||
binary_tx_handler(ble_bin_buffer,3);
|
||||
dr_binary_tx_safe(ble_bin_buffer,3);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -684,7 +606,7 @@ else if((scmd.tag[1] == 's') && (scmd.tag[2] == 'q')){ // Device power off
|
||||
} else if(cmd_t == CMD_BLE) {
|
||||
|
||||
single_format_data(ble_bin_buffer, "rsq:", scmd.value0);
|
||||
binary_tx_handler(ble_bin_buffer,2);
|
||||
dr_binary_tx_safe(ble_bin_buffer,2);
|
||||
// sprintf(ble_tx_buffer, "Tq\r\n");
|
||||
// data_tx_handler(ble_tx_buffer);
|
||||
}
|
||||
@@ -701,16 +623,14 @@ else if((scmd.tag[1] == 's') && (scmd.tag[2] == 'r')){ // Bond Info Delete
|
||||
DBG_PRINTF("Tr\r\n\r\n");
|
||||
} else if(cmd_t == CMD_BLE) {
|
||||
single_format_data(ble_bin_buffer, "rsr:", scmd.value0);
|
||||
binary_tx_handler(ble_bin_buffer,2);
|
||||
dr_binary_tx_safe(ble_bin_buffer,2);
|
||||
}
|
||||
|
||||
bond_data_delete = true;
|
||||
eeprom_write_byte(0x0060, (uint8_t)bond_data_delete);
|
||||
|
||||
//m_config.reset_status = 2;
|
||||
m_config.bond_data_delete = (uint8_t)bond_data_delete;
|
||||
m_reset_status = 2;
|
||||
eeprom_write_byte(0x0065, m_reset_status);
|
||||
//config_save();
|
||||
m_config.reset_status = m_reset_status;
|
||||
config_save();
|
||||
nrf_delay_ms(5);
|
||||
go_NVIC_SystemReset = true;
|
||||
main_timer_start();
|
||||
@@ -726,14 +646,14 @@ else if((scmd.tag[1] == 's') && (scmd.tag[2] == 's')){ //Device reset(Reboot)
|
||||
DBG_PRINTF("Ts\r\n\r\n");
|
||||
} else if(cmd_t == CMD_BLE) {
|
||||
single_format_data(ble_bin_buffer, "rss:", scmd.value0);
|
||||
binary_tx_handler(ble_bin_buffer,2);
|
||||
dr_binary_tx_safe(ble_bin_buffer,2);
|
||||
}
|
||||
go_NVIC_SystemReset = true;
|
||||
//m_config.reset_status = 2;
|
||||
|
||||
m_reset_status = 2;
|
||||
eeprom_write_byte(0x0065, m_reset_status);
|
||||
// config_save();
|
||||
m_config.reset_status = m_reset_status;
|
||||
config_save();
|
||||
nrf_delay_ms(5);
|
||||
go_NVIC_SystemReset = true;
|
||||
main_timer_start();
|
||||
@@ -745,7 +665,7 @@ else if((scmd.tag[1] == 's') && (scmd.tag[2] == 't')){ // Auto Gain Control
|
||||
DBG_PRINTF("Ready\r\n\r\nREADY\r\n");
|
||||
} else if(cmd_t == CMD_BLE) {
|
||||
single_format_data(ble_bin_buffer, "rst:", scmd.value0);
|
||||
binary_tx_handler(ble_bin_buffer,2);
|
||||
dr_binary_tx_safe(ble_bin_buffer,2);
|
||||
|
||||
}
|
||||
|
||||
@@ -759,7 +679,7 @@ else if(0 && (scmd.tag[1] == 's') && (scmd.tag[2] == 'v')){ // Auto Gain Cont
|
||||
DBG_PRINTF("%s\r\n",DEVICE_VERSION);
|
||||
} else if(cmd_t == CMD_BLE) {
|
||||
ascii_format_data(ble_bin_buffer, "rsv:", DEVICE_VERSION,12);
|
||||
binary_tx_handler(ble_bin_buffer,8);
|
||||
dr_binary_tx_safe(ble_bin_buffer,8);
|
||||
//test_eeprom_page_rw();
|
||||
}
|
||||
|
||||
@@ -779,7 +699,7 @@ else if(0 && (scmd.tag[1] == 's') && (scmd.tag[2] == 'z')){
|
||||
config_save();
|
||||
DBG_PRINTF("[ssz] S/N=%s saved to FDS\r\n", m_config.serial_no);
|
||||
ascii_format_data(ble_bin_buffer, "rsz:", scmd.value_ascii,12);
|
||||
binary_tx_handler(ble_bin_buffer,8);
|
||||
dr_binary_tx_safe(ble_bin_buffer,8);
|
||||
}
|
||||
else{
|
||||
DBG_PRINTF("ERR!!! Serial_number 12\r\n\r\n");
|
||||
@@ -796,42 +716,16 @@ else if((scmd.tag[1] == 'p') && (scmd.tag[2] == 'z')){ //Write, passkey
|
||||
{
|
||||
return;
|
||||
}
|
||||
uint8_t tx_data[EEPROM_PAGE_SIZE];
|
||||
uint8_t rx_data[EEPROM_PAGE_SIZE];
|
||||
uint8_t raw_data[EEPROM_PAGE_SIZE];
|
||||
if(cmd_t == CMD_UART) {
|
||||
DBG_PRINTF("Tz0\r\n\r\n");
|
||||
} else if(cmd_t == CMD_BLE) {
|
||||
} else if(cmd_t == CMD_BLE) {
|
||||
memcpy(m_static_passkey, scmd.value_ascii, 6);
|
||||
memcpy(m_config.static_passkey, m_static_passkey, 6);
|
||||
config_save();
|
||||
DBG_PRINTF("Passkey saved: %.6s\n", m_static_passkey);
|
||||
|
||||
|
||||
//memcpy(SERIAL_NO, scmd.value_ascii, 6);
|
||||
//eeprom_write_bytes(uint16_t mem_address, const uint8_t *data, size_t length)
|
||||
for (uint8_t i=0 ; i<6 ;i++)
|
||||
{
|
||||
tx_data[i] = (uint8_t)(scmd.value_ascii[i]);
|
||||
}
|
||||
|
||||
|
||||
if(eeprom_write_encrypted(0x0020, tx_data, 6)!= NRF_SUCCESS)
|
||||
{
|
||||
DBG_PRINTF("ERR!!! EEP_passkey 6\r\n\r\n");;
|
||||
}
|
||||
|
||||
if(eeprom_read_bytes(0x0020, raw_data, 6)!= NRF_SUCCESS)
|
||||
{
|
||||
DBG_PRINTF("ERR!!! EEP_passkey 6\r\n\r\n");;
|
||||
}
|
||||
|
||||
nrf_delay_ms(10);
|
||||
DBG_PRINTF("encrypted: %s\n", raw_data);
|
||||
if(eeprom_read_decrypted(0x0020, rx_data, 6)!= NRF_SUCCESS)
|
||||
{
|
||||
DBG_PRINTF("ERR!!! EEP_passkey 6\r\n\r\n");;
|
||||
}
|
||||
DBG_PRINTF("Decrypted: %s\n", rx_data);
|
||||
|
||||
ascii_format_data(ble_bin_buffer, "rpz:", scmd.value_ascii,6);
|
||||
binary_tx_handler(ble_bin_buffer,5);
|
||||
dr_binary_tx_safe(ble_bin_buffer,5);
|
||||
}
|
||||
|
||||
|
||||
@@ -852,30 +746,12 @@ else if((scmd.tag[1] == 'p') && (scmd.tag[2] == 'z')){ //Write, passkey
|
||||
// sqz
|
||||
else if((scmd.tag[1] == 'q') && (scmd.tag[2] == 'z')){ // Read, Serial Number
|
||||
|
||||
uint8_t rx_data[EEPROM_PAGE_SIZE];
|
||||
|
||||
if(cmd_t == CMD_UART) {
|
||||
DBG_PRINTF("Tz1,%s\r\n\r\n", SERIAL_NO);
|
||||
} else if(cmd_t == CMD_BLE) {
|
||||
|
||||
hw_i2c_init_once();
|
||||
if(eeprom_read_decrypted(0x0020, rx_data, 6)!= NRF_SUCCESS)
|
||||
{
|
||||
DBG_PRINTF("ERR!!! EEP_Serial_number 12\r\n\r\n");;
|
||||
}
|
||||
DBG_PRINTF("Decrypted: %s\n", rx_data);
|
||||
// if (eeprom_read_bytes(0x0030 , rx_data ,12) !=NRF_SUCCESS)
|
||||
// {
|
||||
// DBG_PRINTF("ERR!!! EEP_Serial_number 12\r\n\r\n");
|
||||
// }
|
||||
// sprintf(ble_tx_buffer, "Tz1,%s\r\n", m_config.serial_number);
|
||||
// data_tx_handler(ble_tx_buffer);
|
||||
for (uint8_t i=0 ; i<6 ;i++)
|
||||
{
|
||||
(m_static_passkey[i]) = (char)rx_data[i] ;
|
||||
}
|
||||
} else if(cmd_t == CMD_BLE) {
|
||||
memcpy(m_static_passkey, m_config.static_passkey, 6);
|
||||
ascii_format_data(ble_bin_buffer, "rqz:", m_static_passkey,6);
|
||||
binary_tx_handler(ble_bin_buffer,5);
|
||||
dr_binary_tx_safe(ble_bin_buffer,5);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -886,7 +762,7 @@ else if(0 && (scmd.tag[1] == 'r') && (scmd.tag[2] == 'z')){
|
||||
} else if(cmd_t == CMD_BLE) {
|
||||
memcpy(SERIAL_NO, m_config.serial_no, 12);
|
||||
ascii_format_data(ble_bin_buffer, "rrz:", SERIAL_NO, 12);
|
||||
binary_tx_handler(ble_bin_buffer, 8);
|
||||
dr_binary_tx_safe(ble_bin_buffer, 8);
|
||||
}
|
||||
|
||||
#if 0 // ===== EEPROM start block =====
|
||||
@@ -941,7 +817,7 @@ else if(0 && (scmd.tag[1] == 'r') && (scmd.tag[2] == 'z')){
|
||||
// } else if(cmd_t == CMD_BLE) {
|
||||
//// sprintf(ble_tx_buffer, "Tz3,%s\r\n",read_data
|
||||
// ascii_format_data(ble_bin_buffer, "rcz:", "ok",3);
|
||||
// binary_tx_handler(ble_bin_buffer,5);
|
||||
// dr_binary_tx_safe(ble_bin_buffer,5);
|
||||
//// data_tx_handler(ble_tx_buffer);
|
||||
// }
|
||||
|
||||
@@ -969,7 +845,7 @@ else if(0 && (scmd.tag[1] == 'r') && (scmd.tag[2] == 'z')){
|
||||
//
|
||||
//
|
||||
// format_data_byte(ble_bin_buffer, "rdz:", read_data,64);
|
||||
// binary_tx_handler(ble_bin_buffer,34);
|
||||
// dr_binary_tx_safe(ble_bin_buffer,34);
|
||||
// }
|
||||
|
||||
|
||||
@@ -981,26 +857,11 @@ else if(0 && (scmd.tag[1] == 'r') && (scmd.tag[2] == 'z')){
|
||||
// sez
|
||||
else if((scmd.tag[1] == 'e') && (scmd.tag[2] == 'z')){ // Read, Serial Number
|
||||
|
||||
hw_i2c_init_once();
|
||||
|
||||
uint16_t write_data[64];
|
||||
|
||||
|
||||
for (int i = 0; i < 48; i++) {
|
||||
write_data[i]= (uint16_t)(scmd.values[i*2+7] | (uint16_t)(scmd.values[i*2+6] << 8));
|
||||
}
|
||||
|
||||
eeprom_write_uint16_array(scmd.value0,write_data,48);
|
||||
|
||||
|
||||
/* AGC gain array — AD5272/MCP4725 HW 제거됨, 명령 비활성화 - jhChun 26.03.16 */
|
||||
if(cmd_t == CMD_UART) {
|
||||
DBG_PRINTF("rez,%s\r\n\r\n", scmd.value_ascii);
|
||||
} else if(cmd_t == CMD_BLE) {
|
||||
|
||||
|
||||
|
||||
format_data(ble_bin_buffer, "rez:", write_data,48);
|
||||
binary_tx_handler(ble_bin_buffer,50);
|
||||
DBG_PRINTF("sez: HW not present\r\n");
|
||||
} else if(cmd_t == CMD_BLE) {
|
||||
param_error(scmd.tag);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1016,26 +877,11 @@ else if((scmd.tag[1] == 'f') && (scmd.tag[2] == 'z')){ // Read, Ser
|
||||
// }
|
||||
|
||||
else{
|
||||
|
||||
hw_i2c_init_once();
|
||||
uint16_t read_data[64];
|
||||
//uint8_t EEPread_data[64];
|
||||
|
||||
|
||||
eeprom_read_uint16_array(scmd.value0,read_data,48); //int16(48ea) DP Preset 0~6
|
||||
// for (int i = 0; i < 48; i++) {
|
||||
// EEPread_data[i]= (uint8_t)(read_data[i]);
|
||||
// }
|
||||
|
||||
|
||||
/* AGC gain array — AD5272/MCP4725 HW 제거됨, 명령 비활성화 - jhChun 26.03.16 */
|
||||
if(cmd_t == CMD_UART) {
|
||||
DBG_PRINTF("ref,%s\r\n\r\n", scmd.value_ascii);
|
||||
} else if(cmd_t == CMD_BLE) {
|
||||
|
||||
|
||||
|
||||
format_data(ble_bin_buffer, "rfz:", read_data,48);
|
||||
binary_tx_handler(ble_bin_buffer,50);
|
||||
DBG_PRINTF("sfz: HW not present\r\n");
|
||||
} else if(cmd_t == CMD_BLE) {
|
||||
param_error(scmd.tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1046,7 +892,7 @@ else if(0 && (scmd.tag[1] == 'i') && (scmd.tag[2] == 'z')){
|
||||
} else if(cmd_t == CMD_BLE) {
|
||||
memcpy(HW_NO, m_config.hw_no, 12);
|
||||
ascii_format_data(ble_bin_buffer, "riz:", HW_NO, 12);
|
||||
binary_tx_handler(ble_bin_buffer, 8);
|
||||
dr_binary_tx_safe(ble_bin_buffer, 8);
|
||||
}
|
||||
}
|
||||
// shz - Write HW Number (FDS only) — DISABLED: use mwh? in pc_firm/parser.c
|
||||
@@ -1063,7 +909,7 @@ else if(0 && (scmd.tag[1] == 'h') && (scmd.tag[2] == 'z')){
|
||||
config_save();
|
||||
DBG_PRINTF("[shz] HW=%s saved to FDS\r\n", m_config.hw_no);
|
||||
ascii_format_data(ble_bin_buffer, "rhz:", scmd.value_ascii,12);
|
||||
binary_tx_handler(ble_bin_buffer,8);
|
||||
dr_binary_tx_safe(ble_bin_buffer,8);
|
||||
}
|
||||
else{
|
||||
DBG_PRINTF("ERR!!! HW_NO 12\r\n\r\n");
|
||||
@@ -1091,10 +937,10 @@ else if((scmd.tag[1] == 'x') && (scmd.tag[2] == 'z')){ // Set the delay for
|
||||
if(cmd_t == CMD_UART) {
|
||||
DBG_PRINTF("rxz\r\n\r\n");
|
||||
} else if(cmd_t == CMD_BLE) {
|
||||
hw_i2c_init_once();
|
||||
eeprom_write_uint32(0x0090, m_life_cycle);
|
||||
m_config.life_cycle = m_life_cycle;
|
||||
config_save();
|
||||
format_data(ble_bin_buffer, "rxz:", result_data,2);
|
||||
binary_tx_handler(ble_bin_buffer,4);
|
||||
dr_binary_tx_safe(ble_bin_buffer,4);
|
||||
}
|
||||
}else{
|
||||
if(cmd_t == CMD_UART) {
|
||||
@@ -1121,7 +967,7 @@ else if((scmd.tag[1] == 'y') && (scmd.tag[2] == 'z')){ //
|
||||
|
||||
else {
|
||||
|
||||
eeprom_read_uint32(0x0090, &m_life_cycle); //thnk cj
|
||||
m_life_cycle = m_config.life_cycle;
|
||||
|
||||
result_data[0] = (uint16_t)(m_life_cycle >> 16);
|
||||
result_data[1] = (uint16_t)(m_life_cycle & 0xFFFF);
|
||||
@@ -1132,7 +978,7 @@ else if((scmd.tag[1] == 'y') && (scmd.tag[2] == 'z')){ //
|
||||
} else if(cmd_t == CMD_BLE) {
|
||||
|
||||
format_data(ble_bin_buffer, "ryz:", result_data,4);
|
||||
binary_tx_handler(ble_bin_buffer,4);
|
||||
dr_binary_tx_safe(ble_bin_buffer,4);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1145,7 +991,7 @@ else if((scmd.tag[1] == 'y') && (scmd.tag[2] == 'z')){ //
|
||||
DBG_PRINTF("ERR!!! UART Command Failed, %c%c%c%c\r\n",data_array[0], data_array[1], data_array[2], data_array[3]);
|
||||
} else if(cmd_t == CMD_BLE) {
|
||||
single_format_data(ble_bin_buffer, "err!", err_code5);
|
||||
binary_tx_handler(ble_bin_buffer,3);
|
||||
dr_binary_tx_safe(ble_bin_buffer,3);
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user