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"
using namespace wbo;
static Fault currentFault = Fault::None;
void SetFault(Fault fault)

View File

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

View File

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

View File

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

View File

@ -10,6 +10,16 @@
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
{
uint8_t Version;
@ -30,4 +40,6 @@ struct DiagData
uint16_t pad;
};
} // namespace wbo