simplify menus

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