From 6eafbe538f168a75c7994e142e00233b1f530a0a Mon Sep 17 00:00:00 2001 From: Pascal Serrarens Date: Wed, 18 Jun 2025 15:27:08 +0200 Subject: [PATCH] Fix intialization issues --- Arduino/Things/DRV8833.cpp | 11 +++++++---- Arduino/Things/DRV8833.h | 2 ++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Arduino/Things/DRV8833.cpp b/Arduino/Things/DRV8833.cpp index ed04d79..77dbbbc 100644 --- a/Arduino/Things/DRV8833.cpp +++ b/Arduino/Things/DRV8833.cpp @@ -8,6 +8,7 @@ namespace Arduino { #pragma region DRV8833 DRV8833::DRV8833(Configuration config, Thing* parent) : Thing(parent) { + std::cout << "DRV8833\n"; this->type = Type::Undetermined; this->name = "DRV8833"; this->pinStandby = config.standby; @@ -26,10 +27,12 @@ DRV8833::DRV8833(Configuration config, Thing* parent) : Thing(parent) { DRV8833::DifferentialDrive::DifferentialDrive(DRV8833::Configuration config, Thing* parent) - : RoboidControl::DifferentialDrive(this->drv8833.motorA, - this->drv8833.motorB, - parent), - drv8833(config, this) {} + : drv8833(config, this), + RoboidControl::DifferentialDrive(nullptr, nullptr, parent) { + this->drv8833 = DRV8833(config, this); + this->leftWheel = this->drv8833.motorA; + this->rightWheel = this->drv8833.motorB; +} void DRV8833::DifferentialDrive::Update(bool recurse) { RoboidControl::DifferentialDrive::Update(recurse); diff --git a/Arduino/Things/DRV8833.h b/Arduino/Things/DRV8833.h index 9762980..a4cbd9f 100644 --- a/Arduino/Things/DRV8833.h +++ b/Arduino/Things/DRV8833.h @@ -19,6 +19,8 @@ class DRV8833 : public Thing { int BIn1; int BIn2; int standby = 255; + + constexpr Configuration(int a1, int a2, int b1, int b2, int standby = 255) : AIn1(a1), AIn2(a2), BIn1(b1), BIn2(b2), standby(standby) {} }; /// @brief Setup a DRV8833 motor controller