included calibrateCompass to the manualDrive menu
This commit is contained in:
@@ -10,6 +10,15 @@
|
||||
*/
|
||||
#include "menuManualDrive.h"
|
||||
|
||||
MenuManualControl::MenuManualControl(DriveManager* driveManager) : MenuDriveMode(driveManager) {
|
||||
this->caliCompass = new CalibrateCompass(this->driveManager->getNavigation()->getCompass());
|
||||
}
|
||||
|
||||
MenuManualControl::~MenuManualControl() {
|
||||
delete this->caliCompass;
|
||||
this->manualControl->setCalibrateCompass();
|
||||
}
|
||||
|
||||
void MenuManualControl::printPage() const {
|
||||
String lineOne = "";
|
||||
String lineTwo = "";
|
||||
@@ -53,6 +62,28 @@ void MenuManualControl::printPage() const {
|
||||
lineTwo.concat(this->manualControl->getDutycycleRight());
|
||||
break;
|
||||
|
||||
case 7:
|
||||
switch (this->caliCompass->getState()) {
|
||||
case CalibrateCompass::State::Ready :
|
||||
lineOne = "Start compass";
|
||||
lineTwo = "calibration";
|
||||
break;
|
||||
|
||||
case CalibrateCompass::State::Calibrating :
|
||||
lineOne = "Calibrating...";
|
||||
lineTwo = "Move around";
|
||||
break;
|
||||
|
||||
case CalibrateCompass::State::Finished:
|
||||
lineOne = "Calibration";
|
||||
lineTwo = "finished";
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
this->printDefault();
|
||||
return;
|
||||
@@ -87,6 +118,24 @@ void MenuManualControl::runCommand() const {
|
||||
case 4:
|
||||
this->manualControl->increaseMaxRotation();
|
||||
break;
|
||||
|
||||
case 7:
|
||||
switch (this->caliCompass->getState()) {
|
||||
case CalibrateCompass::State::Ready :
|
||||
this->manualControl->setCalibrateCompass(this->caliCompass);
|
||||
this->caliCompass->start();
|
||||
break;
|
||||
|
||||
case CalibrateCompass::State::Finished:
|
||||
this->manualControl->setCalibrateCompass();
|
||||
this->caliCompass->useData();
|
||||
this->caliCompass->reset();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#define MENU_MANUAL_DRIVE_H
|
||||
|
||||
#include "SpecialMenus/driveModi/menuDriveMode.h"
|
||||
#include "calibrateCompass.h"
|
||||
|
||||
/**
|
||||
* @brief A class to print informations about the class ManualControl
|
||||
@@ -25,7 +26,8 @@ class MenuManualControl : public MenuDriveMode {
|
||||
*
|
||||
* @param driveManager
|
||||
*/
|
||||
MenuManualControl(DriveManager* driveManager) : MenuDriveMode(driveManager) {}
|
||||
MenuManualControl(DriveManager* driveManager);
|
||||
~MenuManualControl();
|
||||
|
||||
/**
|
||||
* @brief Prints the Information to display and console
|
||||
@@ -43,6 +45,7 @@ class MenuManualControl : public MenuDriveMode {
|
||||
|
||||
private:
|
||||
ManualControl* manualControl;
|
||||
CalibrateCompass* caliCompass;
|
||||
};
|
||||
|
||||
#endif // MENU_MANUAL_DRIVE_H
|
||||
|
||||
Reference in New Issue
Block a user