added possibility to change max speeds in
manualControl
This commit is contained in:
@@ -14,16 +14,33 @@ void MenuManualControl::printPage() const {
|
||||
String lineOne = "";
|
||||
String lineTwo = "";
|
||||
|
||||
uint8_t currentPage = this->getCurrentPage();
|
||||
|
||||
switch (currentPage) {
|
||||
switch (this->getCurrentPage()) {
|
||||
case 0:
|
||||
lineOne = "-Ready to drive-";
|
||||
break;
|
||||
|
||||
case 1:
|
||||
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;
|
||||
|
||||
default:
|
||||
@@ -37,5 +54,30 @@ void MenuManualControl::printPage() const {
|
||||
void MenuManualControl::init() {
|
||||
this->firstPrint = false;
|
||||
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:
|
||||
void init() override;
|
||||
void runCommand() const override;
|
||||
|
||||
private:
|
||||
ManualControl* manualControl;
|
||||
};
|
||||
|
||||
#endif // MENU_MANUAL_DRIVE_H
|
||||
|
||||
@@ -62,6 +62,9 @@ class ManualControl : public DriveModi {
|
||||
* @param maxSpeed in m/s
|
||||
*/
|
||||
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
|
||||
@@ -69,6 +72,9 @@ class ManualControl : public DriveModi {
|
||||
* @param maxRotation in rad/s (maybe)
|
||||
*/
|
||||
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:
|
||||
MoveControl *moveControl;
|
||||
|
||||
Reference in New Issue
Block a user