Adjust temperature values with offset and sensitivity

Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
This commit is contained in:
TheJackiMonster 2023-04-19 00:11:04 +02:00
parent 12819f8d26
commit 43e37b17dd
No known key found for this signature in database
GPG key ID: D850A5F772E880F9
2 changed files with 3 additions and 2 deletions

View file

@ -127,7 +127,7 @@ struct device3_t {
bool claimed; bool claimed;
uint64_t last_timestamp; uint64_t last_timestamp;
float temperature; float temperature; // (in °C)
void* offset; void* offset;
device3_ahrs_type* ahrs; device3_ahrs_type* ahrs;

View file

@ -712,7 +712,8 @@ int device3_read(device3_type* device, int timeout) {
int16_t temperature = pack16bit_signed(packet.temperature); int16_t temperature = pack16bit_signed(packet.temperature);
device->temperature = (float) temperature; // According to the ICM-42688-P datasheet: (offset: 25 °C, sensitivity: 132.48 LSB/°C)
device->temperature = ((float) temperature) / 132.48f + 25.0f;
FusionVector gyroscope; FusionVector gyroscope;
FusionVector accelerometer; FusionVector accelerometer;