run callback in digatalControl only after rotation

finished
This commit is contained in:
2023-08-09 14:37:22 +02:00
parent a00ee4080c
commit 984c1891e1
2 changed files with 8 additions and 2 deletions
@@ -85,5 +85,10 @@ void ManualControl::digitalControl() {
this->moveControl->setRotationSpeed(0); this->moveControl->setRotationSpeed(0);
if (this->directionChangeWrapper && (x > 120 || x < -120)) if (this->directionChangeWrapper && (x > 120 || x < -120))
this->lastLoopTurned = true;
else if (this->lastLoopTurned) {
if (this->directionChangeWrapper)
this->directionChangeWrapper->action(); this->directionChangeWrapper->action();
this->lastLoopTurned = false;
}
} }
@@ -103,8 +103,9 @@ class ManualControl : public DriveModi {
void analogControl(); void analogControl();
void digitalControl(); void digitalControl();
uint32_t lastMillis = 0; bool lastLoopTurned = false;
uint8_t delay = 10; uint8_t delay = 10;
uint32_t lastMillis = 0;
double max_speed = 1; double max_speed = 1;
double max_rotation = 7; double max_rotation = 7;
CalibrateCompass* caliCompass = nullptr; CalibrateCompass* caliCompass = nullptr;