Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions libraries/AP_ExternalAHRS/AP_ExternalAHRS.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,13 @@ class AP_ExternalAHRS {
// get serial port number, -1 for not enabled
int8_t get_port(AvailableSensor sensor) const;

enum class TempCal {
DoesntProvideTemp,
IsNotTempCalibrated,
IsTempCalibrated
};


struct state_t {
HAL_Semaphore sem;

Expand Down Expand Up @@ -163,6 +170,7 @@ class AP_ExternalAHRS {
Vector3f accel;
Vector3f gyro;
float temperature;
TempCal TempCalibration = TempCal::IsNotTempCalibrated;
} ins_data_message_t;

typedef struct {
Expand Down
9 changes: 4 additions & 5 deletions libraries/AP_ExternalAHRS/AP_ExternalAHRS_MicroStrain5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,10 @@ void AP_ExternalAHRS_MicroStrain5::post_imu() const
}

{
AP_ExternalAHRS::ins_data_message_t ins {
accel: imu_data.accel,
gyro: imu_data.gyro,
temperature: -300
};
AP_ExternalAHRS::ins_data_message_t ins;
ins.accel = imu_data.accel;
ins.gyro = imu_data.gyro;
ins.temperature= -300;
AP::ins().handle_external(ins);
}

Expand Down
12 changes: 5 additions & 7 deletions libraries/AP_ExternalAHRS/AP_ExternalAHRS_MicroStrain7.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,11 @@ void AP_ExternalAHRS_MicroStrain7::post_imu() const
}

{
// *INDENT-OFF*
AP_ExternalAHRS::ins_data_message_t ins {
accel: imu_data.accel,
gyro: imu_data.gyro,
temperature: -300
};
// *INDENT-ON*
AP_ExternalAHRS::ins_data_message_t ins;
ins.accel = imu_data.accel;
ins.gyro = imu_data.gyro;
ins.temperature= -300;
ins.TempCalibration = AP_ExternalAHRS::TempCal::IsTempCalibrated;
AP::ins().handle_external(ins);
}

Expand Down
1 change: 1 addition & 0 deletions libraries/AP_ExternalAHRS/AP_ExternalAHRS_SBG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,7 @@ void AP_ExternalAHRS_SBG::handle_msg(const sbgMessage &msg)
if (updated_ins) {
cached.sensors.ins_data.accel = state.accel;
cached.sensors.ins_data.gyro = state.gyro;
cached.sensors.ins_data.TempCalibration = AP_ExternalAHRS::TempCal::IsTempCalibrated;
cached.sensors.ins_ms = now_ms;
AP::ins().handle_external(cached.sensors.ins_data);
}
Expand Down
3 changes: 3 additions & 0 deletions libraries/AP_InertialSensor/AP_InertialSensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2795,6 +2795,9 @@ void AP_InertialSensor::send_uart_data(void)
void AP_InertialSensor::handle_external(const AP_ExternalAHRS::ins_data_message_t &pkt)
{
for (uint8_t i = 0; i < _backend_count; i++) {
if(pkt.TempCalibration == AP_ExternalAHRS::TempCal::IsTempCalibrated){
tcal(i).enable.set_and_save_ifchanged(int8_t(AP_InertialSensor_TCal::Enable::Disabled));
}
_backends[i]->handle_external(pkt);
}
}
Expand Down
Loading