fixed to fast switching between autopilot mode
This commit is contained in:
@@ -57,16 +57,18 @@ void Autopilot::runAutopilot() {
|
||||
if (this->routeInfo.currentPoint >= 2 && this->state == State::GetToStartPoint)
|
||||
this->state = State::SelfDrivingAvailable;
|
||||
|
||||
if (this->state == State::SelfDrivingAvailable
|
||||
&& ControlPadButton::isControlPadButtonPressed(this->input, ControlPadButton::PadButton::Action)) {
|
||||
this->state = State::SelfDriving;
|
||||
this->updateDisplay = true;
|
||||
}
|
||||
|
||||
if (this->state == State::SelfDriving
|
||||
&& ControlPadButton::isControlPadButtonPressed(this->input, ControlPadButton::PadButton::Action)) {
|
||||
if (ControlPadButton::isControlPadButtonPressed(this->input, ControlPadButton::PadButton::Action)
|
||||
&& millis() - this->lastAutopilotChangeMillis > this->autopilotChangeDelayMillis) {
|
||||
|
||||
if (this->state == State::SelfDrivingAvailable) {
|
||||
this->state = State::SelfDriving;
|
||||
this->updateDisplay = true;
|
||||
this->lastAutopilotChangeMillis = millis();
|
||||
} else if (this->state == State::SelfDriving) {
|
||||
this->state = State::SelfDrivingAvailable;
|
||||
this->updateDisplay = true;
|
||||
this->lastAutopilotChangeMillis = millis();
|
||||
}
|
||||
}
|
||||
|
||||
if (this->state == State::SelfDriving) {
|
||||
|
||||
Reference in New Issue
Block a user