Skip to content

Commit

Permalink
Squash 1
Browse files Browse the repository at this point in the history
  • Loading branch information
lthall committed Feb 7, 2024
1 parent 3efdb00 commit 2ee0e5d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
31 changes: 20 additions & 11 deletions Tools/AP_Periph/FSOPowerStack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,15 +190,9 @@ void FSOPowerStack::update_fans(void)
if (fans[3].freq_hz < fan_4_min_Hz){
GCS_SEND_TEXT(MAV_SEVERITY_CRITICAL, "Fan 4 failure");
}

if (now_ms - last_fan_report_ms > 5000) {
last_fan_report_ms = now_ms;
GCS_SEND_TEXT(MAV_SEVERITY_INFO, "Fans: %.1f %.1f %.1f %.1f",
fans[0].freq_hz, fans[1].freq_hz, fans[2].freq_hz, fans[3].freq_hz);
}
}

void FSOPowerStack::report_voltages(void)
void FSOPowerStack::report(void)
{
uint32_t now_ms = AP_HAL::millis();
if (now_ms - last_report_ms < 5000) {
Expand All @@ -207,14 +201,29 @@ void FSOPowerStack::report_voltages(void)
last_report_ms = now_ms;

auto &batt = AP::battery();
GCS_SEND_TEXT(MAV_SEVERITY_INFO, "Voltages: 1: %.2f, 2: %.2f, 3: %.2f, 4: %.2f, 5: %.2f, 6: %.2f, 7: %.2f, 8:%.2f, 9: %.2f",
GCS_SEND_TEXT(MAV_SEVERITY_INFO, "Volt - B1:%.1f, B2:%.1f, PHV:%.1f, P1:%.2f, P2:%.2f, IHC:%.2f, I1:%.2f, I2:%.2f, O:%.2f",
batt.voltage(0), batt.voltage(1), batt.voltage(2), batt.voltage(3),
batt.voltage(4), batt.voltage(5), batt.voltage(6), batt.voltage(7), batt.voltage(8));
GCS_SEND_TEXT(MAV_SEVERITY_INFO, "Current Limits: PHV: %.2f, P1: %.2f, P2: %.2f, IHC: %.2f, I1: %.2f, I2: %.2f",

float B1_C;
float B2_C;
float PHV_C;
float P1_C;
float P2_C;
float IHC_C;
float I1_C;
float I2_C;
if (batt.current_amps(B1_C, 0) || batt.current_amps(B2_C, 1) || batt.current_amps(PHV_C, 2) || batt.current_amps(P1_C, 3) || batt.current_amps(P2_C, 4) || batt.current_amps(IHC_C, 5) || batt.current_amps(I1_C, 6) || batt.current_amps(I2_C, 7)) {
GCS_SEND_TEXT(MAV_SEVERITY_INFO, "Current - B1:%.4f, B2:%.4f, PHV:%.2f, P1:%.2f, P2:%.2f, IHC:%.2f, I1:%.2f, I2:%.2f",
B1_C, B2_C, PHV_C, P1_C, P2_C, IHC_C, I1_C, I2_C);
}
GCS_SEND_TEXT(MAV_SEVERITY_INFO, "Current Limit - PHV:%.2f, P1:%.2f, P2:%.2f, IHC:%.2f, I1:%.2f, I2:%.2f",
payload_HV_current_filter.get(), payload_1_current_filter.get(), payload_2_current_filter.get(),
internal_HC_current_filter.get(), internal_1_current_filter.get(), internal_2_current_filter.get());
GCS_SEND_TEXT(MAV_SEVERITY_INFO, "Temperature Limits: P1: %.2f, P2: %.2f, IHC: %.2f, I1: %.2f, I2: %.2f",
GCS_SEND_TEXT(MAV_SEVERITY_INFO, "Temp Limit - P1:%.1f, P2:%.1f, IHC:%.1f, I1:%.1f, I2:%.1f",
payload_1_temp, payload_2_temp, internal_HC_temp, internal_1_temp, internal_2_temp);
GCS_SEND_TEXT(MAV_SEVERITY_INFO, "Fans - F1: %.0f, F2: %.0f, F3: %.0f, F4: %.0f",
fans[0].freq_hz, fans[1].freq_hz, fans[2].freq_hz, fans[3].freq_hz);
}


Expand Down Expand Up @@ -508,7 +517,7 @@ void FSOPowerStack::update()

update_fans();

report_voltages();
report();

update_main_power();

Expand Down
3 changes: 1 addition & 2 deletions Tools/AP_Periph/FSOPowerStack.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ class FSOPowerStack {
};

uint32_t last_fan_ms;
uint32_t last_fan_report_ms;
FAN fans[4];

void fan_handler(uint8_t pin,
Expand All @@ -60,7 +59,7 @@ class FSOPowerStack {
void update_internal_BEC();

uint32_t last_report_ms;
void report_voltages();
void report();


bool switch_1_on;
Expand Down

0 comments on commit 2ee0e5d

Please sign in to comment.