simplify menus
This commit is contained in:
@@ -8,7 +8,6 @@ Do later:
|
|||||||
-> Program the beeper
|
-> Program the beeper
|
||||||
-> Update GNSS Lib to v3
|
-> Update GNSS Lib to v3
|
||||||
-> Engine slow down without curve
|
-> Engine slow down without curve
|
||||||
-> SiteMenus action yes and no for increment and decrement on one site
|
|
||||||
-> Network clean up (Mqtt remove?)
|
-> Network clean up (Mqtt remove?)
|
||||||
-> Extra class for maneuver, autopilot should inherit from int16_t
|
-> Extra class for maneuver, autopilot should inherit from int16_t
|
||||||
-> Better remote Control with Leds for gnss rtk etc
|
-> Better remote Control with Leds for gnss rtk etc
|
||||||
|
|||||||
+5
-5
@@ -15,7 +15,7 @@ board_build.partitions = no_ota.csv
|
|||||||
framework = arduino
|
framework = arduino
|
||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
upload_speed = 921600
|
upload_speed = 921600
|
||||||
monitor_port = COM3
|
monitor_port = COM6
|
||||||
lib_deps =
|
lib_deps =
|
||||||
https://git.kleiax.de/PlatformIO-Libs/SparkFunGNSS.git
|
https://git.kleiax.de/PlatformIO-Libs/SparkFunGNSS.git
|
||||||
knolleary/PubSubClient@^2.8
|
knolleary/PubSubClient@^2.8
|
||||||
@@ -25,10 +25,10 @@ lib_deps =
|
|||||||
mprograms/QMC5883LCompass@^1.2.0
|
mprograms/QMC5883LCompass@^1.2.0
|
||||||
https://git.kleiax.de/PlatformIO-Libs/Menu.git
|
https://git.kleiax.de/PlatformIO-Libs/Menu.git
|
||||||
nrf24/RF24@^1.4.5
|
nrf24/RF24@^1.4.5
|
||||||
upload_port = COM3
|
upload_port = COM6
|
||||||
extra_scripts =
|
; extra_scripts =
|
||||||
pre:autoVersionIncrement/version_increment_pre.py
|
; pre:autoVersionIncrement/version_increment_pre.py
|
||||||
post:autoVersionIncrement/version_increment_post.py
|
; post:autoVersionIncrement/version_increment_post.py
|
||||||
test_ignore = test_desktop
|
test_ignore = test_desktop
|
||||||
build_type = debug
|
build_type = debug
|
||||||
monitor_filters = esp32_exception_decoder
|
monitor_filters = esp32_exception_decoder
|
||||||
|
|||||||
@@ -178,11 +178,6 @@ void MenuAutopilot::printPage() const {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 6:
|
case 6:
|
||||||
lineOne = "Restart the";
|
|
||||||
lineTwo = "Autopilot";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 7:
|
|
||||||
lineOne = "Freeze target is";
|
lineOne = "Freeze target is";
|
||||||
if (this->targetFreezed)
|
if (this->targetFreezed)
|
||||||
lineTwo = "activated";
|
lineTwo = "activated";
|
||||||
@@ -190,46 +185,11 @@ void MenuAutopilot::printPage() const {
|
|||||||
lineTwo = "deactivated";
|
lineTwo = "deactivated";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 8:
|
case 7:
|
||||||
lineOne = "MinDisToPoint:";
|
lineOne = "MinDisToPoint:";
|
||||||
lineTwo = "";
|
lineTwo = "<- ";
|
||||||
lineTwo.concat(this->minDistance);
|
lineTwo.concat(this->minDistance);
|
||||||
lineTwo.concat(" - Increase");
|
lineTwo.concat(" ->");
|
||||||
break;
|
|
||||||
|
|
||||||
case 9:
|
|
||||||
lineOne = "MinDisToPoint:";
|
|
||||||
lineTwo = "";
|
|
||||||
lineTwo.concat(this->minDistance);
|
|
||||||
lineTwo.concat(" - Decrease");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 10:
|
|
||||||
lineOne = "Current minimal";
|
|
||||||
if (this->driveManager->getNavigation()->getMinAccuracy() >= Point::Accuracy::twoDigOfCM)
|
|
||||||
lineTwo = "accuracy is high";
|
|
||||||
else
|
|
||||||
lineTwo = "accuracy is low";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 12:
|
|
||||||
lineOne = "Test rotate";
|
|
||||||
lineTwo = "180 degree";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 13:
|
|
||||||
lineOne = "Test rotate";
|
|
||||||
lineTwo = "270 degree";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 14:
|
|
||||||
lineOne = "Test rotate";
|
|
||||||
lineTwo = "45 degree";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 15:
|
|
||||||
lineOne = "Test rotate";
|
|
||||||
lineTwo = "20 degree";
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -247,10 +207,6 @@ void MenuAutopilot::runCommand() const {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 6:
|
case 6:
|
||||||
this->autopilot->restart();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 7:
|
|
||||||
if (this->targetFreezed) {
|
if (this->targetFreezed) {
|
||||||
this->targetFreezed = false;
|
this->targetFreezed = false;
|
||||||
this->driveManager->getNavigation()->freezeTargetPoint(false);
|
this->driveManager->getNavigation()->freezeTargetPoint(false);
|
||||||
@@ -260,42 +216,26 @@ void MenuAutopilot::runCommand() const {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 8:
|
case 7:
|
||||||
this->minDistance = this->driveManager->getNavigation()->increaseMinDistanceToReachPoint();
|
this->minDistance = this->driveManager->getNavigation()->increaseMinDistanceToReachPoint();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 9:
|
|
||||||
this->minDistance = this->driveManager->getNavigation()->decreaseMinDistanceToReachPoint();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 10:
|
|
||||||
if (this->driveManager->getNavigation()->getMinAccuracy() >= Point::Accuracy::twoDigOfCM)
|
|
||||||
this->driveManager->getNavigation()->setMinAccuracy(Point::Accuracy::none);
|
|
||||||
else
|
|
||||||
this->driveManager->getNavigation()->setMinAccuracy(Point::Accuracy::twoDigOfCM);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 12:
|
|
||||||
this->autopilot->testRotate(180);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 13:
|
|
||||||
this->autopilot->testRotate(270);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 14:
|
|
||||||
this->autopilot->testRotate(45);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 15:
|
|
||||||
this->autopilot->testRotate(20);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MenuAutopilot::runCommandNo() const {
|
||||||
|
switch (this->getCurrentPage()) {
|
||||||
|
case 7:
|
||||||
|
this->minDistance = this->driveManager->getNavigation()->decreaseMinDistanceToReachPoint();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MenuAutopilot::update() {
|
void MenuAutopilot::update() {
|
||||||
if (!this->autopilot->shouldUpdate())
|
if (!this->autopilot->shouldUpdate())
|
||||||
return;
|
return;
|
||||||
@@ -305,7 +245,7 @@ void MenuAutopilot::update() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MenuAutopilot::init() {
|
void MenuAutopilot::init() {
|
||||||
this->setCountPages(16);
|
this->setCountPages(8);
|
||||||
this->driveManager->changeModus(Modi::Autopilot);
|
this->driveManager->changeModus(Modi::Autopilot);
|
||||||
this->autopilot = (Autopilot*) this->driveManager->getDriveModiPtr();
|
this->autopilot = (Autopilot*) this->driveManager->getDriveModiPtr();
|
||||||
this->routeInfo = this->autopilot->getRouteInfo();
|
this->routeInfo = this->autopilot->getRouteInfo();
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class MenuAutopilot : public MenuDriveMode {
|
|||||||
* and save the Autopilot object.
|
* and save the Autopilot object.
|
||||||
*/
|
*/
|
||||||
void printPage() const override;
|
void printPage() const override;
|
||||||
void runCommand() const override;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief can be called to update shown data
|
* @brief can be called to update shown data
|
||||||
@@ -46,6 +46,8 @@ class MenuAutopilot : public MenuDriveMode {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void init() override;
|
void init() override;
|
||||||
|
void runCommand() const override;
|
||||||
|
void runCommandNo() const override;
|
||||||
|
|
||||||
bool mutable targetFreezed = false;
|
bool mutable targetFreezed = false;
|
||||||
double mutable minDistance;
|
double mutable minDistance;
|
||||||
|
|||||||
@@ -37,25 +37,13 @@ void MenuManualControl::printPage() const {
|
|||||||
case 2:
|
case 2:
|
||||||
lineOne = "Speed: ";
|
lineOne = "Speed: ";
|
||||||
lineOne.concat(this->manualControl->getMaxSpeed());
|
lineOne.concat(this->manualControl->getMaxSpeed());
|
||||||
lineTwo = "Increase by 0.1";
|
lineTwo = "- dec 0.1 inc +";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
lineOne = "Speed: ";
|
|
||||||
lineOne.concat(this->manualControl->getMaxSpeed());
|
|
||||||
lineTwo = "Decrease by 0.1";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 4:
|
|
||||||
lineOne = "RotSpeed: ";
|
lineOne = "RotSpeed: ";
|
||||||
lineOne.concat(this->manualControl->getMaxRotation());
|
lineOne.concat(this->manualControl->getMaxRotation());
|
||||||
lineTwo = "Increase by 0.1";
|
lineTwo = "- dec 0.1 inc +";
|
||||||
break;
|
|
||||||
|
|
||||||
case 5:
|
|
||||||
lineOne = "RotSpeed: ";
|
|
||||||
lineOne.concat(this->manualControl->getMaxRotation());
|
|
||||||
lineTwo = "Decrease by 0.1";
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -70,7 +58,7 @@ void MenuManualControl::init() {
|
|||||||
this->firstPrint = false;
|
this->firstPrint = false;
|
||||||
this->driveManager->changeModus(Modi::ManualControl);
|
this->driveManager->changeModus(Modi::ManualControl);
|
||||||
this->manualControl = (ManualControl*) this->driveManager->getDriveModiPtr();
|
this->manualControl = (ManualControl*) this->driveManager->getDriveModiPtr();
|
||||||
this->setCountPages(6);
|
this->setCountPages(4);
|
||||||
this->updateDelay = 500;
|
this->updateDelay = 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,14 +73,6 @@ void MenuManualControl::runCommand() const {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
this->manualControl->decreaseMaxSpeed();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 4:
|
|
||||||
this->manualControl->increaseMaxRotation();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 5:
|
|
||||||
this->manualControl->increaseMaxRotation();
|
this->manualControl->increaseMaxRotation();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -100,3 +80,19 @@ void MenuManualControl::runCommand() const {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MenuManualControl::runCommandNo() const {
|
||||||
|
switch (this->getCurrentPage())
|
||||||
|
{
|
||||||
|
case 2:
|
||||||
|
this->manualControl->decreaseMaxSpeed();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
this->manualControl->decreaseMaxRotation();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ class MenuManualControl : public MenuDriveMode {
|
|||||||
protected:
|
protected:
|
||||||
void init() override;
|
void init() override;
|
||||||
void runCommand() const override;
|
void runCommand() const override;
|
||||||
|
void runCommandNo() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ManualControl* manualControl;
|
ManualControl* manualControl;
|
||||||
|
|||||||
+1
-14
@@ -206,6 +206,7 @@ void makeMenu() {
|
|||||||
|
|
||||||
// Create Menu
|
// Create Menu
|
||||||
main_m = new Menu();
|
main_m = new Menu();
|
||||||
|
main_m->setLcd(lcdWrapper);
|
||||||
Menu* mode_m = new Menu();
|
Menu* mode_m = new Menu();
|
||||||
Menu* pid_m = new Menu();
|
Menu* pid_m = new Menu();
|
||||||
MenuIntInput* pidl_m = new MenuIntInput(3, new MenuPidSettings(moveController.getPID(0)));
|
MenuIntInput* pidl_m = new MenuIntInput(3, new MenuPidSettings(moveController.getPID(0)));
|
||||||
@@ -219,23 +220,9 @@ void makeMenu() {
|
|||||||
MenuSysteminformation* sys_m = new MenuSysteminformation(mainBattery);
|
MenuSysteminformation* sys_m = new MenuSysteminformation(mainBattery);
|
||||||
MenuRoute* rout_m = new MenuRoute(driveManager->getNavigation()->getRoute());
|
MenuRoute* rout_m = new MenuRoute(driveManager->getNavigation()->getRoute());
|
||||||
|
|
||||||
// Set Menus on LCD and set update time
|
|
||||||
main_m->setLcd(lcdWrapper);
|
|
||||||
mode_m->setLcd(lcdWrapper);
|
|
||||||
pid_m->setLcd(lcdWrapper);
|
|
||||||
pidl_m->setLcd(lcdWrapper);
|
|
||||||
pidr_m->setLcd(lcdWrapper);
|
|
||||||
man_m->setLcd(lcdWrapper);
|
|
||||||
cap_m->setLcd(lcdWrapper);
|
|
||||||
auto_m->setLcd(lcdWrapper);
|
|
||||||
auto_m->setUpdateDelay(1000);
|
auto_m->setUpdateDelay(1000);
|
||||||
testM_m->setLcd(lcdWrapper);
|
|
||||||
comp_m->setLcd(lcdWrapper);
|
|
||||||
gps_m->setLcd(lcdWrapper);
|
|
||||||
gps_m->setUpdateDelay(1000);
|
gps_m->setUpdateDelay(1000);
|
||||||
sys_m->setLcd(lcdWrapper);
|
|
||||||
sys_m->setUpdateDelay(1500);
|
sys_m->setUpdateDelay(1500);
|
||||||
rout_m->setLcd(lcdWrapper);
|
|
||||||
|
|
||||||
// Entry for the main menu
|
// Entry for the main menu
|
||||||
main_m->addEntry(new MenuAction("Mode", mode_m));
|
main_m->addEntry(new MenuAction("Mode", mode_m));
|
||||||
|
|||||||
Reference in New Issue
Block a user