extract fault

This commit is contained in:
Matthew Kennedy 2022-01-01 21:10:55 -08:00
parent 79821c3d3f
commit 2bda28226a
5 changed files with 20 additions and 11 deletions

View File

@ -1,5 +1,7 @@
#include "fault.h" #include "fault.h"
using namespace wbo;
static Fault currentFault = Fault::None; static Fault currentFault = Fault::None;
void SetFault(Fault fault) void SetFault(Fault fault)

View File

@ -2,16 +2,8 @@
#include <cstdint> #include <cstdint>
enum class Fault : uint8_t #include "../for_rusefi/wideband_can.h"
{
None = 0,
// First fault code at 3 so it's easier to see void SetFault(wbo::Fault fault);
SensorDidntHeat = 3,
SensorOverheat = 4,
SensorUnderheat = 5,
};
void SetFault(Fault fault);
bool HasFault(); bool HasFault();
Fault GetCurrentFault(); wbo::Fault GetCurrentFault();

View File

@ -9,6 +9,8 @@
#include "sampling.h" #include "sampling.h"
#include "pid.h" #include "pid.h"
using namespace wbo;
// 400khz / 1024 = 390hz PWM // 400khz / 1024 = 390hz PWM
Pwm heaterPwm(HEATER_PWM_DEVICE, HEATER_PWM_CHANNEL, 400'000, 1024); Pwm heaterPwm(HEATER_PWM_DEVICE, HEATER_PWM_CHANNEL, 400'000, 1024);

View File

@ -10,6 +10,7 @@
#include "uart.h" #include "uart.h"
#include "io_pins.h" #include "io_pins.h"
using namespace wbo;
/* /*
* Application entry point. * Application entry point.

View File

@ -10,6 +10,16 @@
namespace wbo namespace wbo
{ {
enum class Fault : uint8_t
{
None = 0,
// First fault code at 3 so it's easier to see
SensorDidntHeat = 3,
SensorOverheat = 4,
SensorUnderheat = 5,
};
struct StandardData struct StandardData
{ {
uint8_t Version; uint8_t Version;
@ -30,4 +40,6 @@ struct DiagData
uint16_t pad; uint16_t pad;
}; };
} // namespace wbo } // namespace wbo