From 009d42f947ae587439b1c36bc92b3d5841f9b445 Mon Sep 17 00:00:00 2001 From: Alexander Klein Date: Tue, 27 Dec 2022 13:55:36 +0100 Subject: [PATCH] fix gamepad read and access --- src/driveModi/Modi/Autopilot/autopilot.cpp | 2 +- src/driveModi/Modi/ManualControl/manualControl.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/driveModi/Modi/Autopilot/autopilot.cpp b/src/driveModi/Modi/Autopilot/autopilot.cpp index 9b5ebd1..86ba8ad 100644 --- a/src/driveModi/Modi/Autopilot/autopilot.cpp +++ b/src/driveModi/Modi/Autopilot/autopilot.cpp @@ -45,7 +45,7 @@ void Autopilot::runAutopilot() { this->selfDrivingAvailable = true; if (!this->selfDriving && this->selfDrivingAvailable) - this->setSelfDriving(Ps3.data.button.triangle); + this->setSelfDriving(this->gamepad->data.button.triangle); if (this->routeInfo.currentPoint == this->routeInfo.totalPoints) { this->navigationEnded = true; diff --git a/src/driveModi/Modi/ManualControl/manualControl.cpp b/src/driveModi/Modi/ManualControl/manualControl.cpp index 5afc56a..877cf02 100644 --- a/src/driveModi/Modi/ManualControl/manualControl.cpp +++ b/src/driveModi/Modi/ManualControl/manualControl.cpp @@ -31,8 +31,8 @@ void ManualControl::loop() { } void ManualControl::runManualControl() { - int8_t x = Ps3.data.analog.stick.lx; - int8_t y = Ps3.data.analog.stick.ly; + int8_t x = this->gamepad->data.analog.stick.lx; + int8_t y = this->gamepad->data.analog.stick.ly; double value_per_step = this->max_speed * 2 / 256; this->moveControl->setSpeed((y * -1) * value_per_step);