From a00e8d6d03bde25db11293999fa4203214ee6c6e Mon Sep 17 00:00:00 2001 From: Alexander Klein Date: Wed, 11 Oct 2023 11:38:17 +0200 Subject: [PATCH] fix pwm channel --- doc/TODO allgemein.txt | 18 ++---------------- include/config.h | 2 +- include/networkConfig.h | 14 +++++++++++++- platformio.ini | 5 ++--- src/driveModi/Modi/TestMode/testMode.cpp | 3 ++- src/moveControl.cpp | 10 +++++++--- 6 files changed, 27 insertions(+), 25 deletions(-) diff --git a/doc/TODO allgemein.txt b/doc/TODO allgemein.txt index 6a0ff6a..d89abe9 100644 --- a/doc/TODO allgemein.txt +++ b/doc/TODO allgemein.txt @@ -6,7 +6,6 @@ Do later: -> Program underfloorLighting -> Add an beeper -> Program the beeper - -> Update GNSS Lib to v3 -> Engine slow down without curve in motorControl -> Network clean up (Mqtt remove?) -> Extra class for maneuver, autopilot should inherit from int16_t @@ -19,16 +18,7 @@ Do later: -> Menu Display from parent as run() to make Menu as Component -> Racing Mode -> ConsolControl - -> Menü für Sensordaten (kann in jedem Betriebsmodus aufgerufen werden) - - GNSS - - Ntrip - - CalcCompass - - RealCompass - - Gyroskop - - Geschwindigkeiten (vielleicht) -> Menü für Einstellungen - - PID - - Geschwindigkeiten - WiFi (save in Flash) -> Battery - tabelle mit eigenen Werten übergeben und nicht in header (wiederverwendbarkeit) @@ -44,8 +34,6 @@ Do now: Code: Doxygen Kommentare aktualisieren magic numbers etc - Menu in Lib Folder packen - testMode einzelner Motor testen klappt nicht Fernbedienung! Latex: @@ -53,8 +41,6 @@ Latex: Unterschied funktionale und nicht funktionale Anforderungen Overfull H-Boxen Test Motor, Zeiten kontrolieren. Wenn einfach so dann bezug auf fehler bei Timing und freeRtos - Bild mit RPY einbinden + Was mit den nicht erfüllten Anforderungen machen? + Hardware doppelt erklärt -3D: - -Rover: diff --git a/include/config.h b/include/config.h index cf8e055..5b86d4a 100644 --- a/include/config.h +++ b/include/config.h @@ -30,7 +30,7 @@ namespace PinNumbers { constexpr uint8_t dir2 = 23; constexpr uint8_t pwm = 22; constexpr uint8_t encoder = 33; - constexpr uint8_t pmwChannel = 0; + constexpr uint8_t pmwChannel = 1; } } diff --git a/include/networkConfig.h b/include/networkConfig.h index e5b0bc3..8e28c90 100644 --- a/include/networkConfig.h +++ b/include/networkConfig.h @@ -14,7 +14,7 @@ #include -#define HOTSPOT +#define HW1 #ifdef HOTSPOT namespace NetworkConfig { @@ -28,6 +28,18 @@ namespace NetworkConfig { } #endif //HOTSPOT +#ifdef HW1 +namespace NetworkConfig { + const char ssid[] = "hw1_gast"; + const char password[] = "KeineAhnung"; + const char ip[] = "192.168.0.4"; + const char subnet[] = "255.255.255.0"; + const char gateway[] = "192.168.0.1"; + const char dns[] = "8.8.8.8"; + const bool mqtt = false; +} +#endif //HW1 + //Network config Rhede #ifdef RHEDE namespace NetworkConfig { diff --git a/platformio.ini b/platformio.ini index 36de8e2..df2e73e 100644 --- a/platformio.ini +++ b/platformio.ini @@ -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 @@ -23,9 +23,8 @@ lib_deps = marcoschwartz/LiquidCrystal_I2C@^1.1.4 bblanchon/ArduinoJson@^6.20.0 mprograms/QMC5883LCompass@^1.2.0 - https://git.kleiax.de/PlatformIO-Libs/Menu.git jrowberg/I2Cdevlib-MPU6050@^1.0.0 -upload_port = COM3 +upload_port = COM6 test_ignore = test_desktop build_type = debug monitor_filters = esp32_exception_decoder diff --git a/src/driveModi/Modi/TestMode/testMode.cpp b/src/driveModi/Modi/TestMode/testMode.cpp index b937a34..2c03b0a 100644 --- a/src/driveModi/Modi/TestMode/testMode.cpp +++ b/src/driveModi/Modi/TestMode/testMode.cpp @@ -17,7 +17,7 @@ void TestMode::run() { this->abort = true; } - if (millis() - this->actionStart > this->maneuverTime || this->abort) { + if (this->busy && millis() - this->actionStart > this->maneuverTime || this->abort) { this->busy = false; this->abort = false; this->moveControl->setDrivingStatus(MoveControl::Status::Stop); @@ -83,6 +83,7 @@ bool TestMode::leftEngine(int16_t powerPercentage, int16_t seconds) { if (this->engineInit(powerPercentage, seconds)) { this->moveControl->setRawPowerLeft(powerPercentage); this->maneuver = Maneuver::LeftEngine; + std::cout << "TestMode::leftEngine" << std::endl; return true; } return false; diff --git a/src/moveControl.cpp b/src/moveControl.cpp index 0f741c5..aee387e 100644 --- a/src/moveControl.cpp +++ b/src/moveControl.cpp @@ -44,7 +44,7 @@ MoveControl::MoveControl() { this->right_motor->init(PinNumbers::RightMotor::pwm, PinNumbers::RightMotor::pmwChannel, PinNumbers::RightMotor::dir1, PinNumbers::RightMotor::dir2); this->addChildComponent(this->left_motor); - this->addChildComponent(this->right_motor); + this->addChildComponent(this->right_motor); this->addChildComponent(this->left_speedometer); this->addChildComponent(this->right_speedometer); } @@ -80,11 +80,15 @@ void MoveControl::setDrivingStatus(Status status) { this->driving_status = status; // switch (this->driving_status) { // case Status::Stop : - // Serial.println("New drivingState = Stop in MoveControl::setDrivingStatus"); + // std::cout << "New drivingState = Stop in MoveControl::setDrivingStatus" << std::endl; // break; // case Status::Drive : - // Serial.println("New drivingState = Drive in MoveControl::setDrivingStatus"); + // std::cout << "New drivingState = Drive in MoveControl::setDrivingStatus" << std::endl; + // break; + + // case Status::Raw : + // std::cout << "New drivingState = Raw in MoveControl::setDrivingStatus" << std::endl; // break; // default: