启动阈值调整

This commit is contained in:
lmx
2025-11-12 13:57:59 +08:00
parent 58ad14691e
commit c88cb70bb1
32 changed files with 153681 additions and 153490 deletions

View File

@ -263,7 +263,7 @@ static BLE_send_data_t sensor_send_buffer[SENSOR_DATA_BUFFER_SIZE]; // 存放ble
*/
void sensor_read_data(){
// xlog("=======sensor_read_data START\n");
xlog("=======sensor_read_data START\n");
static signed short combined_raw_data[6];
static int initialized = 0;
static int calibration_done = 0;
@ -275,6 +275,7 @@ void sensor_read_data(){
static sensor_data_t tmp;
SL_SC7U22_RawData_Read(tmp.acc_data,tmp.gyr_data);
xlog("=======sensor_read_data middle 1\n");
memcpy(&combined_raw_data[0], tmp.acc_data, 3 * sizeof(signed short));
memcpy(&combined_raw_data[3], tmp.gyr_data, 3 * sizeof(signed short));
@ -291,7 +292,7 @@ void sensor_read_data(){
memcpy(tmp.gyr_data, &combined_raw_data[3], 3 * sizeof(signed short));
circle_buffer_write(&sensor_read, &tmp);
}
// xlog("=======sensor_read_data END\n");
xlog("=======sensor_read_data END\n");
}
@ -391,7 +392,56 @@ void BLE_send_data(){
#endif
}
//iic测试调用的
#if 1
extern char xt_Check_Flag = 10;
static u16 xt_iic_test_id;
char log_buffer_1[100];
extern char sen_log_buffer_1[100];
extern char sen_log_buffer_2[100];
extern char sen_log_buffer_3[100];
extern char sen_log_buffer_4[100];
extern char sen_log_buffer_5[100];
extern char w_log_buffer_1[100];
extern char w_log_buffer_2[100];
extern char w_log_buffer_3[100];
extern char w_log_buffer_4[100];
extern char w_log_buffer_5[100];
void xt_iic_test(){
char log_buffer[100];
send_data_to_ble_client(&log_buffer_1,strlen(log_buffer_1));
extern char iic_read_len;
extern char iic_write_result;
int num_chars_written = snprintf(log_buffer, sizeof(log_buffer),"SL_SC7U22_Check=0x%d,%d,%d\n", xt_Check_Flag, iic_read_len, iic_write_result);
extern void send_data_to_ble_client(const u8* data, u16 length);
send_data_to_ble_client(&log_buffer,strlen(log_buffer));
if(sen_log_buffer_1 != NULL)
send_data_to_ble_client(&sen_log_buffer_1,strlen(sen_log_buffer_1));
if(sen_log_buffer_2 != NULL)
send_data_to_ble_client(&sen_log_buffer_2,strlen(sen_log_buffer_2));
if(sen_log_buffer_3 != NULL)
send_data_to_ble_client(&sen_log_buffer_3,strlen(sen_log_buffer_3));
if(sen_log_buffer_4 != NULL)
send_data_to_ble_client(&sen_log_buffer_4,strlen(sen_log_buffer_4));
if(sen_log_buffer_5 != NULL)
send_data_to_ble_client(&sen_log_buffer_5,strlen(sen_log_buffer_5));
if(w_log_buffer_1 != NULL)
send_data_to_ble_client(&w_log_buffer_1,strlen(w_log_buffer_1));
if(w_log_buffer_2 != NULL)
send_data_to_ble_client(&w_log_buffer_2,strlen(w_log_buffer_2));
if(w_log_buffer_3 != NULL)
send_data_to_ble_client(&w_log_buffer_3,strlen(w_log_buffer_3));
if(w_log_buffer_4 != NULL)
send_data_to_ble_client(&w_log_buffer_4,strlen(w_log_buffer_4));
if(w_log_buffer_5 != NULL)
send_data_to_ble_client(&w_log_buffer_5,strlen(w_log_buffer_5));
// SL_SC7U22_Config();
}
#endif
void xtell_task_create(void){
@ -405,7 +455,9 @@ void xtell_task_create(void){
int ret = hw_iic_init(0);
xlog("init iic result:%d\n", ret); //返回0成功
#else
soft_iic_init(0);
int ret = soft_iic_init(0);
int num_chars_written = snprintf(log_buffer_1, sizeof(log_buffer_1),"init iic: %d\n", ret);
#endif
gpio_set_direction(IO_PORTE_05,0); //设置PE5 输出模式
@ -436,9 +488,11 @@ void xtell_task_create(void){
create_process(&sensor_read_data_id, "read",NULL, sensor_read_data, 10);
create_process(&calculate_data_id, "calculate",NULL, calculate_data, 1);
create_process(&calculate_data_id, "calculate",NULL, calculate_data, 5);
create_process(&ble_send_data_id, "send",NULL, BLE_send_data, 1);
// create_process(&xt_iic_test_id,"iic_test",NULL,xt_iic_test,1000);
}