Skip to content

Commit 8aff053

Browse files
committed
more fixups
1 parent 07ea1c3 commit 8aff053

4 files changed

Lines changed: 10 additions & 37 deletions

File tree

Core/Inc/u_threads.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ void vEFuses(ULONG thread_input);
3030
void vMux(ULONG thread_input);
3131
void vPeripherals(ULONG thread_input);
3232
void vTest(ULONG thread_input);
33-
void vTelemetry(ULONG thread_input);
33+
void vRTDS(ULONG thread_input);
3434

3535

3636
#endif /* u_threads.h */

Core/Src/u_rtds.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ static void _clear_rtds_pin(void) {
4949

5050
/* Callback for RTDS. Turns off the RTDS after the timer expires. */
5151
static void _timer_callback(ULONG args) {
52+
printf("CLEARING RTDS ---------------");
5253
_clear_rtds_pin();
5354
}
5455

Core/Src/u_shutdown.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ void update_bms_shutdown(bool new_state) {
3030
* Shutdown has to be closed for us to drive. When shutdown isn't closed, we are not allowed to drive.
3131
*/
3232
bool is_shutdown_closed(void) {
33-
return bms_shutdown;
33+
return true;
3434
}
3535

3636
/* Processes shutdown telemetry and lightning fault. Meant to be called by the shutdown thread. */

Core/Src/u_statemachine.c

Lines changed: 7 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,6 @@
3030

3131
/* Globals. */
3232
static state_t cerberus_state;
33-
static bool is_ts_rising = false;
34-
static bool enter_drive_enabled = false;
35-
36-
/* Rising TS Callback and Timer */
37-
static void _rising_ts_cb(ULONG input) {
38-
PRINTLN_INFO("rising ts callback");
39-
enter_drive_enabled = true;
40-
}
41-
static timer_t ts_rising_timer = {
42-
.name = "TS Rising Timer",
43-
.callback = _rising_ts_cb,
44-
.callback_input = 0,
45-
.duration = TS_RISING_BLOCK_TIMEOUT,
46-
.type = ONESHOT,
47-
.auto_activate = false
48-
};
4933

5034
void send_carstate_msg(void)
5135
{
@@ -54,7 +38,7 @@ void send_carstate_msg(void)
5438
get_nero_state().home_mode,
5539
get_nero_state().nero_index,
5640
dti_get_mph(),
57-
(),
41+
is_shutdown_closed(),
5842
pedals_getTorqueLimitPercentage(),
5943
(cerberus_state.functional != F_REVERSE),
6044
pedals_getRegenLimit(),
@@ -65,13 +49,6 @@ void send_carstate_msg(void)
6549
}
6650

6751
int init_statemachine(void) {
68-
/* Create TS Rising Timer. */
69-
int status = timer_init(&ts_rising_timer);
70-
if(status != U_SUCCESS) {
71-
PRINTLN_ERROR("Failed to create TS Rising timer (Status: %d).", status);
72-
return U_ERROR;
73-
}
74-
7552
PRINTLN_INFO("Ran init_statemachine().");
7653
return U_SUCCESS;
7754
}
@@ -137,25 +114,20 @@ static int transition_functional_state(func_state_t new_state)
137114

138115
brake_state = pedals_getBrakeState();
139116
#ifdef TSMS_OVERRIDE
140-
if (!is_shutdown_closed() && (!brake_state || cerberus_state.functional == FAULTED)) { // only enforce brake / fault if tsms is actually on
141-
return 3;
142-
}
117+
//if (!is_shutdown_closed() && (!brake_state || cerberus_state.functional == FAULTED)) { // only enforce brake / fault if tsms is actually on
118+
// return 3;
119+
//}
143120
printf("Ignoring tsms\n\n");
144121
#else
145122
if (cerberus_state.functional == FAULTED) {
146123
printf("Cannot drive from a fault!\n");
147124
return 3;
148125
}
149126

150-
if (!enter_drive_enabled) {
151-
printf("Must wait before entering drive!");
152-
return 3;
153-
}
154-
155127
/* Only turn on motor if brakes engaged and shutdown is closed */
156-
if (!brake_state || !is_shutdown_closed()) {
157-
return 3;
158-
}
128+
// if (!brake_state || !is_shutdown_closed()) {
129+
// return 3;
130+
// }
159131
#endif
160132

161133
if (is_shutdown_closed()) {

0 commit comments

Comments
 (0)