mirror of https://github.com/rusefi/wideband.git
blink fault codes
This commit is contained in:
parent
47050e8c5a
commit
5c2dd19c3f
|
@ -2,8 +2,10 @@
|
|||
|
||||
enum class Fault
|
||||
{
|
||||
None,
|
||||
SensorDidntHeat,
|
||||
None = 0,
|
||||
|
||||
// First fault code at 3 so it's easier to see
|
||||
SensorDidntHeat = 3,
|
||||
};
|
||||
|
||||
void setFault(Fault fault);
|
||||
|
|
|
@ -25,8 +25,6 @@ static const UARTConfig uartCfg =
|
|||
.cr3 = 0,
|
||||
};
|
||||
|
||||
char strBuffer[200];
|
||||
|
||||
/*
|
||||
* Application entry point.
|
||||
*/
|
||||
|
@ -46,30 +44,43 @@ int main() {
|
|||
|
||||
while(true)
|
||||
{
|
||||
if (!hasFault())
|
||||
{
|
||||
// blue is off
|
||||
palClearPad(GPIOB, 5);
|
||||
|
||||
// Green is blinking
|
||||
palTogglePad(GPIOB, 6);
|
||||
|
||||
// Fast blink if closed loop, slow if not
|
||||
chThdSleepMilliseconds(IsRunningClosedLoop() ? 50 : 400);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
auto fault = getCurrentFault();
|
||||
|
||||
switch (fault)
|
||||
{
|
||||
case Fault::None:
|
||||
// blue is off
|
||||
palClearPad(GPIOB, 5);
|
||||
|
||||
// Green is blinking
|
||||
palTogglePad(GPIOB, 6);
|
||||
|
||||
// Fast blink if closed loop, slow if not
|
||||
chThdSleepMilliseconds(IsRunningClosedLoop() ? 50 : 400);
|
||||
break;
|
||||
case Fault::SensorDidntHeat:
|
||||
// Blue is blinking
|
||||
palTogglePad(GPIOB, 5);
|
||||
|
||||
// green is off
|
||||
palClearPad(GPIOB, 6);
|
||||
|
||||
// fast blink
|
||||
chThdSleepMilliseconds(50);
|
||||
// Blink out the error code
|
||||
for (int i = 0; i < 2 * static_cast<int>(fault); i++)
|
||||
{
|
||||
// Blue is blinking
|
||||
palTogglePad(GPIOB, 5);
|
||||
|
||||
// fast blink
|
||||
chThdSleepMilliseconds(300);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
chThdSleepMilliseconds(2000);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue