get mostly one directional comms working

This commit is contained in:
2025-04-27 01:45:02 +02:00
commit 0f2850dfca
18 changed files with 2085 additions and 0 deletions

23
main/dataproc.c Normal file
View File

@@ -0,0 +1,23 @@
#define MAG_SCALE (4912.0f / 32760.0f)
#include "dataproc.h"
bme680_cal_factors_t dev_cal_factors;
ambient_temperature = 25;
void mpu9250_convert_data(int16_t *accel, int16_t *gyro, int16_t temp, int16_t *magnet, float *accel_out, float *gyro_out, float *temp_out, float *magnet_out)
{
accel_out[0] = accel[0] / 16384.0; // Accel X in g
accel_out[1] = accel[1] / 16384.0; // Accel Y in g
accel_out[2] = accel[2] / 16384.0; // Accel Z in g
gyro_out[0] = gyro[0] / 131.0; // Gyro X in deg/s
gyro_out[1] = gyro[1] / 131.0; // Gyro Y in deg/s
gyro_out[2] = gyro[2] / 131.0; // Gyro Z in deg/s
magnet_out[0] = magnet[0] * MAG_SCALE; // Gyro X in deg/s
magnet_out[1] = magnet[1] * MAG_SCALE; // Gyro Y in deg/s
magnet_out[2] = magnet[2] * MAG_SCALE; // Gyro Z in deg/s
*temp_out = (temp / 333.87) + 21.0; // Temperature in °C
}