Skip to content
Merged
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
4 changes: 2 additions & 2 deletions .github/workflows/test_code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Cache pip
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: ${{ runner.os }}-pip-
- name: Cache PlatformIO
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/.platformio
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
Expand Down
1 change: 1 addition & 0 deletions src/Faults.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ namespace fault_groups {
Fault *gyro_y_average = new Fault(0x6009);
Fault *gyro_z_value = new Fault(0x6010);
Fault *gyro_z_average = new Fault(0x6011);
Fault *imu_disable = new Fault(0x6012);
} // namespace imu_faults
namespace power_faults {
Fault *temp_c_value = new Fault(0x6020);
Expand Down
1 change: 1 addition & 0 deletions src/Faults.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ namespace fault_groups {
extern Fault *gyro_y_average;
extern Fault *gyro_z_value;
extern Fault *gyro_z_average;
extern Fault *imu_disable;
} // namespace imu_faults
namespace power_faults {
extern Fault *temp_c_value;
Expand Down
2 changes: 1 addition & 1 deletion src/Monitors/IMUMonitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void IMUMonitor::execute()
sfr::imu::power_setting = (uint8_t)sensor_power_mode_type::do_nothing;
}

if (sfr::imu::power_setting == (uint8_t)sensor_power_mode_type::on && sfr::imu::powered == false) {
if (sfr::imu::power_setting == (uint8_t)sensor_power_mode_type::on && sfr::imu::powered == false && !fault_groups::imu_faults::imu_disable->get_base()) {
Copy link
Member

@Duncan-McD Duncan-McD Mar 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at its core, this does not need to be a fault because the fault is not being signaled by any conditions inside automation and is only controlled through manual force/suppress (making it functionally equivalent to a boolean SFR field).

However, since the use case for setting this flag to high is when the system is in an off-nominal state, keeping this flag designated as a fault is not causing any harm and in fact my provide some situational awareness to operators. The only clear negative with this approach is that the fault takes up more space in the serialized telemetry packet than the SFR bool would (since bools are packed as much as possible down to 1 bit, while faults are packed down to 4 control bits)

Regardless, since its only a few extra bits in telemetry and since you've verifed this functionality on HITL pretty thoroughly, I feel that going with the fault is okay

Edit: telemetry size is actually irrelevant if we aren't sending it in normal report

#ifdef VERBOSE
Serial.println("Turned on IMU");
#endif
Expand Down