Arduino_ICM20948_DMP_Full-Function icon indicating copy to clipboard operation
Arduino_ICM20948_DMP_Full-Function copied to clipboard

Getting temeprature from ICM20948

Open x9prototype opened this issue 6 months ago • 0 comments

Hi,

I was attempting to modify this library to also pull the temperature, but I seem to have hit a roadblock. In build_sensor_event_data I was adding

case INV_SENSOR_TYPE_TEMPERATURE:
  memcpy(&(event.data.temperature.tmp), data, sizeof(event.data.temperature.tmp));
  temperature = event.data.temperature.tmp;
  temp_data_ready = true;
  break;

where temperature is a float and temp_data_ready is a bool to match the other variables.

in init I added the appropriate lines for the temperature sensor

rc = inv_icm20948_set_sensor_period(&icm_device, idd_sensortype_conversion(INV_SENSOR_TYPE_TEMPERATURE), 1000 / settings.temp_frequency);
rc = inv_icm20948_enable_sensor(&icm_device, idd_sensortype_conversion(INV_SENSOR_TYPE_TEMPERATURE), settings.enable_temp);

But it seems that only 0 is returned for the data, is there a different sensor that I should be using?

x9prototype avatar Aug 10 '24 09:08 x9prototype