Fix intialization issues

This commit is contained in:
Pascal Serrarens 2025-06-18 15:27:08 +02:00
parent e0b8f3eac3
commit 6eafbe538f
2 changed files with 9 additions and 4 deletions

View File

@ -8,6 +8,7 @@ namespace Arduino {
#pragma region DRV8833 #pragma region DRV8833
DRV8833::DRV8833(Configuration config, Thing* parent) : Thing(parent) { DRV8833::DRV8833(Configuration config, Thing* parent) : Thing(parent) {
std::cout << "DRV8833\n";
this->type = Type::Undetermined; this->type = Type::Undetermined;
this->name = "DRV8833"; this->name = "DRV8833";
this->pinStandby = config.standby; this->pinStandby = config.standby;
@ -26,10 +27,12 @@ DRV8833::DRV8833(Configuration config, Thing* parent) : Thing(parent) {
DRV8833::DifferentialDrive::DifferentialDrive(DRV8833::Configuration config, DRV8833::DifferentialDrive::DifferentialDrive(DRV8833::Configuration config,
Thing* parent) Thing* parent)
: RoboidControl::DifferentialDrive(this->drv8833.motorA, : drv8833(config, this),
this->drv8833.motorB, RoboidControl::DifferentialDrive(nullptr, nullptr, parent) {
parent), this->drv8833 = DRV8833(config, this);
drv8833(config, this) {} this->leftWheel = this->drv8833.motorA;
this->rightWheel = this->drv8833.motorB;
}
void DRV8833::DifferentialDrive::Update(bool recurse) { void DRV8833::DifferentialDrive::Update(bool recurse) {
RoboidControl::DifferentialDrive::Update(recurse); RoboidControl::DifferentialDrive::Update(recurse);

View File

@ -19,6 +19,8 @@ class DRV8833 : public Thing {
int BIn1; int BIn1;
int BIn2; int BIn2;
int standby = 255; 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 /// @brief Setup a DRV8833 motor controller