File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -109,7 +109,12 @@ void ETCController::updateState() {
109
109
static_cast <int16_t >(pedalTravel * ETCController::MAX_TORQUE) :
110
110
0 ;
111
111
112
- this ->brakeLightOutput .write (this ->state .brakes_read >= ETCController::BRAKE_TOLERANCE);
112
+
113
+ if (this ->state .brakes_read >= ETCController::BRAKE_TOLERANCE_HIGH) {
114
+ this ->brakeLightOutput .write (1 );
115
+ } else if (this ->state .brakes_read <= ETCController::BRAKE_TOLERANCE_LOW) {
116
+ this ->brakeLightOutput .write (0 );
117
+ }
113
118
}
114
119
115
120
@@ -128,7 +133,7 @@ void ETCController::checkStartConditions() {
128
133
// If the brake is pressed past the tolerance threshold and the tractive system is ready
129
134
// then the motor can be enabled. The last condition for motor start is the cockpit switch
130
135
// being set to the ON position, which is what calls this method.
131
- if (this ->state .ts_ready && this ->state .brakes_read >= ETCController::BRAKE_TOLERANCE && this ->state .pedal_travel < 0.05 ) {
136
+ if (this ->state .ts_ready && this ->state .brakes_read >= ETCController::BRAKE_TOLERANCE_HIGH && this ->state .pedal_travel < 0.05 ) {
132
137
this ->state .motor_enabled = true ;
133
138
this ->runRTDS ();
134
139
}
@@ -171,7 +176,7 @@ void ETCController::set_brake_implausibility() {
171
176
this ->state .brakes_implausibility = false ;
172
177
}
173
178
} else {
174
- if (this ->state .brakes_read >= BRAKE_TOLERANCE && this ->state .pedal_travel > 0 .25f ) {
179
+ if (this ->state .brakes_read >= BRAKE_TOLERANCE_HIGH && this ->state .pedal_travel > 0 .25f ) {
175
180
this ->state .brakes_implausibility = true ;
176
181
}
177
182
}
Original file line number Diff line number Diff line change @@ -92,7 +92,8 @@ class ETCController {
92
92
static constexpr float MAX_VOLTAGE = 3 .3f ;
93
93
94
94
/* * The percentage tolerance for the brake pedal to be considered pressed. */
95
- static constexpr float BRAKE_TOLERANCE = 0 .50f ;
95
+ static constexpr float BRAKE_TOLERANCE_HIGH = 0 .38f ;
96
+ static constexpr float BRAKE_TOLERANCE_LOW = 0 .25f ;
96
97
97
98
/* * The voltage divider slope for the hall-effect 1 sensor. */
98
99
static constexpr float HE1_SCALE = (330 .0f / 480 .0f );
You can’t perform that action at this time.
0 commit comments