Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output relevant signals during a severe fault scenario #44 #71

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions VCU/Phantom/Drivers/STATE_MACHINE/state_machine.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "task_event_handler.h"
#include "task_throttle.h"
#include "task_logger.h"
#include "board_hardware.h"

static void UpdateStateMachine(void* data);
static State VariousStates(State state, eCarEvents event);
Expand All @@ -25,6 +26,14 @@ static State SevereFault(eCarEvents event);

static SystemTasks_t system_tasks;

void VCU_FLT_Set(int value)
{
//Toggles VCU_FLT pin defined in hardware file.

gioSetBit(SHUTDOWN_CIRCUIT_PORT,BSPD_FAULT_PIN,value);//Check pin since no VCU_FLT pin is defined in the hardware file. We assumed no latch is available thus fault must stay until car reset.

return;
}

/* Public API */

Expand Down Expand Up @@ -138,6 +147,10 @@ static State VariousStates(State state, eCarEvents event)
if (faults && state != SEVERE_FAULT)
{
SuspendThrottle(system_tasks.Throttle);

VCU_FLT_Set(1);//Sets VCU_FLT to 1

LogColor(RED, "Setting VCU_FLT signal.");

LogColor(RED, "Moving to SevereFault state");

Expand Down Expand Up @@ -190,6 +203,11 @@ static State SevereFault(eCarEvents event)
if (event == EVENT_RESET_CAR)
{
LogColor(CYN, "Moving from SevereFault to TractiveOff");

VCU_FLT_Set(0); //Clearing VCU FLT --> Assuming the reset car event triggers.

LogColor(CYN, "Clearing VCU_FLT signal");

return TRACTIVE_OFF;
}

Expand Down
7 changes: 7 additions & 0 deletions VCU/Phantom/Drivers/UART/Phantom_sci.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ enum eCommands{
RESET_CAR='r',
START_ENGINE='s',
TURN_TRACTIVE_ON='o',
SEVERE_FAULT_TEST='f',
};

static volatile uint8_t messageCounter = 0;
Expand Down Expand Up @@ -228,6 +229,12 @@ void sciReceiveCallback(sciBASE_t *sci, uint32 flags, uint8 data)

break;
}
case SEVERE_FAULT_TEST:
{
NotifyStateMachineFromISR(EVENT_UNRESPONSIVE_APPS);

break;
}
default:
{
LogFromISR(UWHT, "Unknown: ");
Expand Down