This commit is contained in:
lmx
2025-12-05 19:37:31 +08:00
parent 138275a04b
commit 45158aebcf
6 changed files with 23 additions and 7 deletions

View File

@ -105,7 +105,7 @@ u32 get_ms_timer(void) {
*
*/
void sensor_collect_task(void){
ble_send_data_t send_data;
static ble_send_data_t send_data;
mmc5603nj_mag_data_t mmc5603nj_buffer;
float temperature = 0;
float pressure = 0;
@ -117,6 +117,7 @@ void sensor_collect_task(void){
signed short gyry_buf[100];
signed short gyrz_buf[100];
int fifo_num = 0;
static int data_index = 0;
u8 index = 1;
while(1){//4组地磁数据、16组六轴数据、1组气压计数据
@ -128,6 +129,12 @@ void sensor_collect_task(void){
send_data.sensor_package[i].mmc5603nj_buffer[2] = (int32_t)(mmc5603nj_buffer.z * 1000.0f);
}
// xlog("MAG x: %.2f,y: %.2f,z: %.2f\n",mmc5603nj_buffer.x,mmc5603nj_buffer.y,mmc5603nj_buffer.z);
fifo_num = SL_SC7U22_FIFO_Read(accx_buf,accy_buf,accz_buf,gyrx_buf,gyry_buf,gyrz_buf); //40ms一次性读取内置fifo的数据
for(int i = 0; i < fifo_num; i++){
}
if(interval >= 4){
interval = 0;
memset(&accx_buf, 0, sizeof(accx_buf));