diff --git a/firmware/fault.cpp b/firmware/fault.cpp index 96eef8c..2a67413 100644 --- a/firmware/fault.cpp +++ b/firmware/fault.cpp @@ -1,20 +1,26 @@ +#include "wideband_config.h" #include "fault.h" using namespace wbo; -static Fault currentFault = Fault::None; +static Fault currentFault[AFR_CHANNELS]; void SetFault(int ch, Fault fault) { - currentFault = fault; -} - -bool HasFault() -{ - return currentFault != Fault::None; + currentFault[ch] = fault; } Fault GetCurrentFault(int ch) { - return currentFault; + return currentFault[ch]; +} + +bool HasFault() +{ + bool fault = false; + + for (int ch = 0; ch < AFR_CHANNELS; ch++) + fault |= (GetCurrentFault(ch) != Fault::None); + + return fault; }