Skip to content

Commit

Permalink
Merge branch 'master' into feature/unit-testing-framework-394
Browse files Browse the repository at this point in the history
  • Loading branch information
KnockbackNemo authored Mar 10, 2024
2 parents a61bd83 + 1b2611a commit 28cc35d
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
3 changes: 1 addition & 2 deletions Apps/Src/DebugDump.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@ void TaskDebugDump(void *p_arg) {
// Get minion information
for (Pin pin = 0; pin < kNumPins; pin++) {
bool pin_state = MinionsRead(pin);
// Ignition pins are negative logic, special-case them
printf("%s: %s\n\r", minionpin_string[pin],
pin_state ^ (pin == kIgn1 || pin == kIgn2) ? "on" : "off");
pin_state ? "on" : "off");
}

// Get contactor info
Expand Down
4 changes: 2 additions & 2 deletions Apps/Src/ReadCarCan.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,8 @@ void TurnMotorControllerPbcOff(void) {
* @param None
*/
void UpdatePrechargeContactors(void) {
arr_ign_status = (!MinionsRead(kIgn1));
mc_ign_status = (!MinionsRead(kIgn2));
arr_ign_status = MinionsRead(kIgn1);
mc_ign_status = MinionsRead(kIgn2);

// Logic helper in cases both are off or (impossible) on
bool both_status_off = !mc_ign_status && !arr_ign_status;
Expand Down
2 changes: 1 addition & 1 deletion Apps/Src/SendCarCan.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ static void putIOState(void) {
}

// Tell BPS if the array contactor should be on
message.data[3] |= (!MinionsRead(kIgn1) || !MinionsRead(kIgn2)) << 2;
message.data[3] |= (MinionsRead(kIgn1) || MinionsRead(kIgn2)) << 2;

CanBusSend(message, true, CARCAN);
}
Expand Down
2 changes: 2 additions & 0 deletions Apps/Src/Tasks.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ extern const PinInfo
* Error assertion-related functions
*/
void AssertOsError(volatile OS_ERR err) {
OS_ERR err2 = 0;
if (err != OS_ERR_NONE) {
OSSchedLock(&err2);
EmergencyContactorOpen(); // Turn off contactors and turn on the
// brakelight to indicate an emergency
DisplayFault(err); // Display the location and error code
Expand Down
5 changes: 5 additions & 0 deletions Drivers/Src/Minions.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ void MinionsInit(void) {

bool MinionsRead(Pin pin) {
if ((kPininfoLut[pin].direction == kInput)) {
// Ignition pins are negative logic, special-case them
if (pin == kIgn1 || pin == kIgn2) {
return !((bool)BspGpioReadPin(kPininfoLut[pin].port,
kPininfoLut[pin].pin_mask));
}
return (bool)BspGpioReadPin(kPininfoLut[pin].port,
kPininfoLut[pin].pin_mask);
}
Expand Down

0 comments on commit 28cc35d

Please sign in to comment.