17 TeensyTimerTool::PeriodicTimer watchdog_timer_;
27 bool failed_to_build_hydraulic_pressure_in_time()
const;
32 bool failed_to_reduce_hydraulic_pressure_in_time()
const;
37 void handle_ebs_check();
200 DEBUG_PRINT(
"ASMS activated, starting watchdog check");
206 _watchdog_toggle_timer_.
reset();
207 DEBUG_PRINT(
"Watchdog ready, starting toggle sequence");
216 DEBUG_PRINT(
"Watchdog error: WD_READY went low during toggling phase");
225 _watchdog_test_timer_.
reset();
226 DEBUG_PRINT(
"Watchdog toggle complete, stopping watchdog");
231 _watchdog_test_timer_.
reset();
233 DEBUG_PRINT(
"Stopping watchdog toggle, beginning verification");
241 DEBUG_PRINT(
"Watchdog no longer ready - verification successful");
245 DEBUG_PRINT(
"Watchdog test failed - WD_READY did not go low during verification time");
266 HYDRAULIC_BRAKE_THRESHOLD
309 DEBUG_PRINT(
"Checkup complete, transitioning to ready state");
318inline void CheckupManager::handle_ebs_check() {
332 HYDRAULIC_BRAKE_THRESHOLD) {
333 DEBUG_PRINT(
"Pressure high confirmed with only actuator 2");
340 DEBUG_PRINT(
"Re-enabling EBS actuator 1 and disabling actuator 2");
350 HYDRAULIC_BRAKE_THRESHOLD &&
352 DEBUG_PRINT(
"Pressure high confirmed with only actuator 1");
369 HYDRAULIC_BRAKE_THRESHOLD &&
371 DEBUG_PRINT(
"Both actuators confirmed working correctly");
378 DEBUG_PRINT(
"EBS check complete, transitioning to next state");
407 bool failed_to_build_pressure = failed_to_build_hydraulic_pressure_in_time();
419 failed_to_build_pressure ||
425 bool failed_to_reduce_pressure = failed_to_reduce_hydraulic_pressure_in_time();
436 failed_to_reduce_pressure ||
440bool CheckupManager::failed_to_build_hydraulic_pressure_in_time()
const {
448bool CheckupManager::failed_to_reduce_hydraulic_pressure_in_time()
const {
The CheckupManager class handles various checkup operations.
bool should_stay_manual_driving() const
Performs a manual driving checkup.
bool should_enter_emergency_in_ready_state() const
EbsPressureTestPhase pressure_test_phase_
bool should_enter_emergency(State current_state) const
Performs an emergency checkup.
Metro _ebs_sound_timestamp_
Timer for the EBS buzzer sound check.
void reset_mission_finished()
Resets the mission finished state.
CheckupState checkup_state_
Current state of the checkup process.
bool should_enter_emergency_in_driving_state() const
@ ERROR_TIMESTAMPS_EMERGENCY
bool emergency_sequence_complete() const
Checks if the emergency sequence is complete and the vehicle can transition to AS_OFF.
bool should_stay_ready() const
Performs a ready to drive checkup.
CheckupState
The CheckupState enum represents the different states of the initial checkup process....
@ START_TOGGLING_WATCHDOG
@ START_TOGGLING_WATCHDOG_AGAIN
bool should_go_ready_from_off() const
Performs a last re-check for off to ready transition.
void reset_checkup_state()
Resets the checkup state to the initial state.
bool should_stay_off()
Performs an off checkup.
bool should_stay_mission_finished() const
Performs a mission finished checkup.
bool res_triggered() const
Checks if the RES has been triggered.
bool should_stay_driving() const
CheckupManager(SystemData *system_data)
Constructor for the CheckupManager class.
CheckupError initial_checkup_sequence()
Performs an initial checkup.
static void close_watchdog_sdc()
Closes the watchdog signal for SDC.
static void enable_ebs_actuator_FRONT()
Enables EBS actuator 2.
static void enable_ebs_actuator_REAR()
Enables EBS actuator 1.
static void disable_ebs_actuator_FRONT()
Disables EBS actuator 2.
static void disable_ebs_actuator_REAR()
Disables EBS actuator 1.
static void toggle_watchdog()
Toggles the watchdog signal.
static void close_sdc()
Closes the SDC in Master and SDC Logic.
Our own implementation of Metro class.
void reset()
Resets the timer to the current time.
bool checkWithoutReset() const
Checks if the interval has passed without resetting the timer.
#define DEBUG_PRINT_VAR(var)
constexpr int WATCHDOG_TEST_DURATION
constexpr int BRAKE_PRESSURE_UPPER_THRESHOLD
constexpr int WATCHDOG_TOGGLE_DURATION
constexpr int EBS_BUZZER_TIMEOUT
bool has_any_component_timed_out()
volatile bool emergency_signal_
int hydraulic_line_front_pressure
int _hydraulic_line_pressure
bool pneumatic_line_pressure_
void reset_ebs_timestamp()
resets timestamps for driving
Metro releaseEbsTimestamp
void refresh_r2d_vars()
resets timestamps for ready
The whole model of the system: holds all the data necessary.
FailureDetection failure_detection_
HardwareData hardware_data_