Formula Student Electronics & Software
The code for the embedded software
Loading...
Searching...
No Matches
systemDiagnostics.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstdlib>
4
5#include "Arduino.h"
6#include "debugUtils.hpp"
8#include "metro.h"
9
10struct R2DLogics {
12
16
20 bool r2d{false};
21
28 r2d = false;
29 }
30
35
46 // If r2d is not received or received before 5 seconds, return false (?_?)
47 if (readyTimestamp.check()) {
48 r2d = true;
49 return EXIT_SUCCESS;
50 }
51 // If r2d is received after the timeout duration, return true
52 r2d = false;
53 return EXIT_FAILURE;
54 }
55};
56
Our own implementation of Metro class.
Definition metro.h:13
void reset()
Resets the timer to the current time.
Definition metro.h:124
bool checkWithoutReset() const
Checks if the interval has passed without resetting the timer.
Definition metro.h:115
bool check()
Checks if the interval has passed and resets the timer if true.
Definition metro.h:90
constexpr unsigned long READY_TIMEOUT_MS
constexpr unsigned long RELEASE_EBS_TIMEOUT_MS
constexpr int RES_TIMESTAMP_TIMEOUT
constexpr unsigned long ENGAGE_EBS_TIMEOUT_MS
constexpr int COMPONENT_TIMESTAMP_TIMEOUT
constexpr int DC_VOLTAGE_HOLD
constexpr int DC_VOLTAGE_TIMEOUT
void enter_ready_state()
resets timestamps for ready
void enter_driving_state()
resets timestamps for driving
bool process_go_signal()
Processes the go signal.
Metro releaseEbsTimestamp