@@ -49,19 +49,19 @@ void ETCController::updateState() {
49
49
// two sensors differs by too much, or the voltages of either sensor is out of range (less
50
50
// than 0% or more than 100% pedal travel).
51
51
52
- float travelDifference = std::fabs (he1Travel - he2Travel);
52
+ float travelDifference = std::abs (he1Travel - he2Travel);
53
53
if (travelDifference > 0 .1f ) {
54
54
if (!this ->implausTravelTimerRunning ) {
55
55
// we now start our timer, if it's not already running
56
56
this ->implausTravelTimer .start ();
57
57
this ->implausTravelTimerRunning = true ;
58
58
}
59
- else if (this ->implausTravelTimer .elapsed_time () > 100ms) {
60
- this ->implausTravelTimer .stop ();
61
- this ->implausTravelTimer .reset ();
62
- this ->implausTravelTimerRunning = false ;
63
- this ->turnOffMotor ();
64
- }
59
+ // else if (this->implausTravelTimer.elapsed_time() > 100ms) {
60
+ // this->implausTravelTimer.stop();
61
+ // this->implausTravelTimer.reset();
62
+ // this->implausTravelTimerRunning = false;
63
+ // this->turnOffMotor();
64
+ // }
65
65
}
66
66
else {
67
67
// if everything is good and timer is running, we reset
@@ -70,20 +70,20 @@ void ETCController::updateState() {
70
70
this ->implausTravelTimerRunning = false ;
71
71
}
72
72
73
- if (he1Voltage <= 0 .05f || he1Voltage >= ETCController::MAX_VOLTAGE ||
74
- he2Voltage <= 0 .05f || he2Voltage >= ETCController::MAX_VOLTAGE )
73
+ if (he1Voltage <= 0 .2f || he1Voltage >= 3 . 0f ||
74
+ he2Voltage <= 0 .2f || he2Voltage >= 3 . 0f )
75
75
{
76
76
if (!this ->implausBoundsTimerRunning ) {
77
77
// we now start our timer, if it's not already running
78
78
this ->implausBoundsTimer .start ();
79
79
this ->implausBoundsTimerRunning = true ;
80
80
}
81
- else if (this ->implausBoundsTimer .elapsed_time () > 100ms) {
82
- this ->implausBoundsTimer .stop ();
83
- this ->implausBoundsTimer .reset ();
84
- this ->implausBoundsTimerRunning = false ;
85
- this ->turnOffMotor ();
86
- }
81
+ // else if (this->implausBoundsTimer.elapsed_time() > 100ms) {
82
+ // this->implausBoundsTimer.stop();
83
+ // this->implausBoundsTimer.reset();
84
+ // this->implausBoundsTimerRunning = false;
85
+ // this->turnOffMotor();
86
+ // }
87
87
}
88
88
else {
89
89
this ->implausBoundsTimer .stop ();
@@ -105,7 +105,7 @@ void ETCController::updateState() {
105
105
this ->state .he1_travel = he1Travel;
106
106
this ->state .he2_travel = he2Travel;
107
107
this ->state .torque_demand =
108
- (this ->state .motor_enabled && !this ->state .brakes_implausibility ) ?
108
+ (this ->state .motor_enabled && ( !this ->state .brakes_implausibility && ! this -> hasImplausibility ()) ) ?
109
109
static_cast <int16_t >(pedalTravel * ETCController::MAX_TORQUE) :
110
110
0 ;
111
111
@@ -274,5 +274,7 @@ bool ETCController::isBraking() {
274
274
275
275
276
276
bool ETCController::hasImplausibility () {
277
- return this ->implausTravelTimerRunning || this ->implausBoundsTimerRunning ;
277
+ // return this->implausTravelTimerRunning || this->implausBoundsTimerRunning;
278
+ return this ->implausTravelTimer .elapsed_time () >= 100ms
279
+ || this ->implausBoundsTimer .elapsed_time () >= 100ms;
278
280
}
0 commit comments