Pass gamepad to all objects

This commit is contained in:
2022-12-27 13:38:23 +01:00
parent a4e0007d64
commit 490473c2ee
10 changed files with 29 additions and 21 deletions
+5 -4
View File
@@ -15,8 +15,9 @@ Modi& operator++(Modi& m, int) {
return m = (m == Modi::TestMode) ? Modi::Off : static_cast<Modi>(static_cast<int>(m)+1);
}
DriveManager::DriveManager(MoveControl *moveControl, bool wifi) {
DriveManager::DriveManager(MoveControl *moveControl, Ps3Controller *gamepad, bool wifi) {
this->moveControl = moveControl;
this->gamepad = gamepad;
this->spiPort = new SPIClass(HSPI);
spiPort->begin(UBLOX_GNSS_SPI_SCK, UBLOX_GNSS_SPI_CIPO, UBLOX_GNSS_SPI_COPI, UBLOX_GNSS_SPI_CS);
@@ -65,17 +66,17 @@ void DriveManager::changeModus(Modi modus) {
break;
case Modi::ManualControl: {
this->currentModusPtr = new ManualControl(this->moveControl);
this->currentModusPtr = new ManualControl(this->moveControl, this->gamepad);
}
break;
case Modi::CaptureRoute: {
this->currentModusPtr = new CaptureRoute(this->moveControl, this->navigation);
this->currentModusPtr = new CaptureRoute(this->moveControl, this->gamepad, this->navigation);
}
break;
case Modi::Autopilot: {
this->currentModusPtr = new Autopilot(this->moveControl, this->navigation);
this->currentModusPtr = new Autopilot(this->moveControl, this->gamepad, this->navigation);
}
break;