added possibility to change max speeds in
manualControl
This commit is contained in:
@@ -14,16 +14,33 @@ void MenuManualControl::printPage() const {
|
|||||||
String lineOne = "";
|
String lineOne = "";
|
||||||
String lineTwo = "";
|
String lineTwo = "";
|
||||||
|
|
||||||
uint8_t currentPage = this->getCurrentPage();
|
switch (this->getCurrentPage()) {
|
||||||
|
|
||||||
switch (currentPage) {
|
|
||||||
case 0:
|
case 0:
|
||||||
lineOne = "-Ready to drive-";
|
lineOne = "-Ready to drive-";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
lineOne = "Speed: ";
|
lineOne = "Speed: ";
|
||||||
lineTwo = "Warp 3";
|
lineOne.concat(this->manualControl->getMaxSpeed());
|
||||||
|
lineTwo = "Increase by 0.1";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
lineOne = "Speed: ";
|
||||||
|
lineOne.concat(this->manualControl->getMaxSpeed());
|
||||||
|
lineTwo = "Decrease by 0.1";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
lineOne = "RotSpeed: ";
|
||||||
|
lineOne.concat(this->manualControl->getMaxRotation());
|
||||||
|
lineTwo = "Increase by 0.1";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 4:
|
||||||
|
lineOne = "RotSpeed: ";
|
||||||
|
lineOne.concat(this->manualControl->getMaxRotation());
|
||||||
|
lineTwo = "Decrease by 0.1";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -37,5 +54,30 @@ void MenuManualControl::printPage() const {
|
|||||||
void MenuManualControl::init() {
|
void MenuManualControl::init() {
|
||||||
this->firstPrint = false;
|
this->firstPrint = false;
|
||||||
this->driveManager->changeModus(Modi::ManualControl);
|
this->driveManager->changeModus(Modi::ManualControl);
|
||||||
this->setCountPages(4);
|
this->manualControl = (ManualControl*) this->driveManager->getDriveModiPtr();
|
||||||
|
this->setCountPages(5);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MenuManualControl::runCommand() const {
|
||||||
|
switch (this->getCurrentPage()) {
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
this->manualControl->increaseMaxSpeed();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
this->manualControl->decreaseMaxSpeed();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
this->manualControl->increaseMaxRotation();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 4:
|
||||||
|
this->manualControl->increaseMaxRotation();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,6 +39,10 @@ class MenuManualControl : public MenuDriveMode {
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
void init() override;
|
void init() override;
|
||||||
|
void runCommand() const override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
ManualControl* manualControl;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MENU_MANUAL_DRIVE_H
|
#endif // MENU_MANUAL_DRIVE_H
|
||||||
|
|||||||
@@ -62,6 +62,9 @@ class ManualControl : public DriveModi {
|
|||||||
* @param maxSpeed in m/s
|
* @param maxSpeed in m/s
|
||||||
*/
|
*/
|
||||||
void setMaxSpeed(double maxSpeed) { max_speed = maxSpeed; }
|
void setMaxSpeed(double maxSpeed) { max_speed = maxSpeed; }
|
||||||
|
void increaseMaxSpeed(double increase = 0.1) { max_speed += increase; }
|
||||||
|
void decreaseMaxSpeed(double increase = 0.1) { max_speed -= increase; }
|
||||||
|
double getMaxSpeed() { return this->max_speed; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the max rotation
|
* @brief Set the max rotation
|
||||||
@@ -69,6 +72,9 @@ class ManualControl : public DriveModi {
|
|||||||
* @param maxRotation in rad/s (maybe)
|
* @param maxRotation in rad/s (maybe)
|
||||||
*/
|
*/
|
||||||
void setMaxRotation(double maxRotation) { max_rotation = maxRotation; }
|
void setMaxRotation(double maxRotation) { max_rotation = maxRotation; }
|
||||||
|
void increaseMaxRotation(double increase = 0.1) { max_rotation += increase; }
|
||||||
|
void decreaseMaxRotation(double increase = 0.1) { max_rotation -= increase; }
|
||||||
|
double getMaxRotation() { return this->max_rotation; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
MoveControl *moveControl;
|
MoveControl *moveControl;
|
||||||
|
|||||||
Reference in New Issue
Block a user