Skip to content

Commit 4caa93c

Browse files
committed
Add temp
1 parent f4c903f commit 4caa93c

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

FprimeZephyrReference/Components/Imu/Imu.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,13 @@ void Imu ::run_handler(FwIndexType portNum, U32 context) {
4040
sensor_sample_fetch_chan(lsm6dso, SENSOR_CHAN_ACCEL_XYZ);
4141
sensor_sample_fetch_chan(lsm6dso, SENSOR_CHAN_GYRO_XYZ);
4242
sensor_sample_fetch_chan(lis2mdl, SENSOR_CHAN_MAGN_XYZ);
43+
sensor_sample_fetch_chan(lsm6dso, SENSOR_CHAN_DIE_TEMP);
4344

4445
// Output the magnetic field values via telemetry
4546
this->tlmWrite_Acceleration(this->get_acceleration());
4647
this->tlmWrite_AngularVelocity(this->get_angular_velocity());
4748
this->tlmWrite_MagneticField(this->get_magnetic_field());
49+
this->tlmWrite_Temperature(this->get_temperature());
4850
}
4951

5052
F64 Imu ::sensor_value_to_f64(const struct sensor_value& val) {
@@ -87,4 +89,9 @@ Components::Imu_MagneticField Imu ::get_magnetic_field() {
8789
this->sensor_value_to_f64(z));
8890
}
8991

92+
F64 Imu ::get_temperature() {
93+
struct sensor_value temp;
94+
sensor_channel_get(lsm6dso, SENSOR_CHAN_DIE_TEMP, &temp);
95+
return this->sensor_value_to_f64(temp);
96+
}
9097
} // namespace Components

FprimeZephyrReference/Components/Imu/Imu.fpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ module Components {
2424
}
2525
telemetry AngularVelocity: AngularVelocity
2626

27+
telemetry Temperature: F64
28+
2729
###############################################################################
2830
# Standard AC Ports: Required for Channels, Events, Commands, and Parameters #
2931
###############################################################################

FprimeZephyrReference/Components/Imu/Imu.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class Imu final : public ImuComponentBase {
4545
Components::Imu_Acceleration get_acceleration();
4646
Components::Imu_AngularVelocity get_angular_velocity();
4747
Components::Imu_MagneticField get_magnetic_field();
48+
F64 get_temperature();
4849

4950
const struct device* lis2mdl;
5051
const struct device* lsm6dso;

FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,6 @@ telemetry packets ReferenceDeploymentPackets {
6363
CdhCore.version.CustomVersion08
6464
CdhCore.version.CustomVersion09
6565
CdhCore.version.CustomVersion10
66+
# Reserving temp telemetry for future use
67+
ReferenceDeployment.imu.Temperature
6668
}

0 commit comments

Comments
 (0)