some menu improvements

This commit is contained in:
2023-04-26 15:56:34 +02:00
parent 00eed74f7d
commit 996390ccca
5 changed files with 9 additions and 10 deletions
+1 -1
View File
@@ -21,7 +21,7 @@
#define PWMRES 8 #define PWMRES 8
#define POWERSTEPS 2 // A total of 20 levels ( 100 / SPEED_STEPS ) * RUN_MOTOR_CONTROL_DELAY = 500ms #define POWERSTEPS 2 // A total of 20 levels ( 100 / SPEED_STEPS ) * RUN_MOTOR_CONTROL_DELAY = 500ms
#define PWMMIN 55 #define PWMMIN 55
#define PWMMAX 95 // Max 98% of 2^PWM_RES #define PWMMAX 80 // Max 98% of 2^PWM_RES
/** /**
* @brief A class which use PWM to control the power of DC Motor * @brief A class which use PWM to control the power of DC Motor
+6
View File
@@ -49,10 +49,16 @@ void MenuGPS::printPage() const {
lineOne = "Time: "; lineOne = "Time: ";
lineTwo = ""; lineTwo = "";
if (fixType) { if (fixType) {
if (gpsData->hour < 10)
lineTwo.concat("0");
lineTwo.concat(gpsData->hour); lineTwo.concat(gpsData->hour);
lineTwo.concat(":"); lineTwo.concat(":");
if (gpsData->min < 10)
lineTwo.concat("0");
lineTwo.concat(gpsData->min); lineTwo.concat(gpsData->min);
lineTwo.concat(":"); lineTwo.concat(":");
if (gpsData->sec < 10)
lineTwo.concat("0");
lineTwo.concat(gpsData->sec); lineTwo.concat(gpsData->sec);
} else } else
lineTwo = "00:00:00"; lineTwo = "00:00:00";
@@ -64,10 +64,6 @@ void MenuAutopilot::printMenu() {
} }
void MenuAutopilot::update() { void MenuAutopilot::update() {
if (millis() - this->lastMillis < this->minDelay)
return;
this->lastMillis = millis();
if (!this->autopilot->shouldUpdate()) if (!this->autopilot->shouldUpdate())
return; return;
@@ -41,16 +41,13 @@ class MenuAutopilot : public MenuDriveMode {
/** /**
* @brief can be called to update shown data * @brief can be called to update shown data
*/ */
void update(); void update() override;
private: private:
void init(); void init();
Autopilot* autopilot; Autopilot* autopilot;
RouteInfo routeInfo; RouteInfo routeInfo;
uint32_t lastMillis = 0;
uint16_t minDelay = 1500;
}; };
#endif // MENU_AUTOPILOT_DRIVE_H #endif // MENU_AUTOPILOT_DRIVE_H
@@ -40,7 +40,7 @@ class MenuCaptureRoute : public MenuDriveMode {
/** /**
* @brief can be called to update shown data * @brief can be called to update shown data
*/ */
void update(); void update() override;
private: private:
void init(); void init();