parent
4926f646b7
commit
d3739f80d4
|
@ -150,8 +150,10 @@ PUBLIC_API_WEAK bool isBoardAllowingLackOfPps() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EtbController::init(dc_function_e function, DcMotor *motor, pid_s *pidParameters, const ValueProvider3D* pedalProvider, bool hasPedal) {
|
bool EtbController::init(dc_function_e function, DcMotor *motor, pid_s *pidParameters, const ValueProvider3D* pedalProvider, bool hasPedal) {
|
||||||
|
state = (uint8_t)EtbState::InInit;
|
||||||
if (function == DC_None) {
|
if (function == DC_None) {
|
||||||
// if not configured, don't init.
|
// if not configured, don't init.
|
||||||
|
state = (uint8_t)EtbState::NotEbt;
|
||||||
etbErrorCode = (int8_t)TpsState::None;
|
etbErrorCode = (int8_t)TpsState::None;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -163,7 +165,7 @@ bool EtbController::init(dc_function_e function, DcMotor *motor, pid_s *pidParam
|
||||||
if (isEtbMode()) {
|
if (isEtbMode()) {
|
||||||
// We don't need to init throttles, so nothing to do here.
|
// We don't need to init throttles, so nothing to do here.
|
||||||
if (!hasPedal) {
|
if (!hasPedal) {
|
||||||
etbErrorCode = (int8_t)TpsState::None;
|
etbErrorCode = (int8_t)TpsState::PpsError;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,6 +202,7 @@ bool EtbController::init(dc_function_e function, DcMotor *motor, pid_s *pidParam
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
|
|
||||||
|
state = (uint8_t)EtbState::SuccessfulInit;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,8 +48,10 @@ enum class EtbState : uint8_t {
|
||||||
NoOutput, // 6
|
NoOutput, // 6
|
||||||
Active, // 7
|
Active, // 7
|
||||||
NoPedal, // 8
|
NoPedal, // 8
|
||||||
FailFast,
|
FailFast, // 9
|
||||||
NotOk
|
NotOk, // 10
|
||||||
|
SuccessfulInit, // 11
|
||||||
|
InInit, // 12
|
||||||
};
|
};
|
||||||
|
|
||||||
class DcMotor;
|
class DcMotor;
|
||||||
|
|
Loading…
Reference in New Issue