Compare commits

..

No commits in common. "634d560ee1b7a596c9e41aa0dd48b03ee594bb3a" and "e5916466a6c353309c27873b9e35600bc6178508" have entirely different histories.

4 changed files with 9 additions and 12 deletions

View File

@ -26,15 +26,14 @@ 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(nullptr, nullptr, parent) { : RoboidControl::DifferentialDrive(this->drv8833.motorA,
this->drv8833 = new DRV8833(config, this); this->drv8833.motorB,
this->leftWheel = this->drv8833->motorA; parent),
this->rightWheel = this->drv8833->motorB; drv8833(config, this) {}
}
void DRV8833::DifferentialDrive::Update(bool recurse) { void DRV8833::DifferentialDrive::Update(bool recurse) {
RoboidControl::DifferentialDrive::Update(recurse); RoboidControl::DifferentialDrive::Update(recurse);
this->drv8833->Update(false); this->drv8833.Update(false);
} }
#pragma endregion Differential drive #pragma endregion Differential drive

View File

@ -19,8 +19,6 @@ 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
@ -45,7 +43,7 @@ class DRV8833::DifferentialDrive : public RoboidControl::DifferentialDrive {
virtual void Update(bool recurse = false) override; virtual void Update(bool recurse = false) override;
protected: protected:
DRV8833* drv8833 = nullptr; DRV8833 drv8833;
}; };
#pragma endregion Differential drive #pragma endregion Differential drive

View File

@ -65,7 +65,7 @@ UltrasonicSensor::TouchSensor::TouchSensor(Configuration config, Thing* parent)
void UltrasonicSensor::TouchSensor::Update(bool recursive) { void UltrasonicSensor::TouchSensor::Update(bool recursive) {
RoboidControl::TouchSensor::Update(recursive); RoboidControl::TouchSensor::Update(recursive);
this->ultrasonic.Update(false); this->ultrasonic.Update(false);
this->internalTouch = (this->ultrasonic.distance > 0 && this->internalTouch |= (this->ultrasonic.distance > 0 &&
this->ultrasonic.distance <= this->touchDistance); this->ultrasonic.distance <= this->touchDistance);
} }

View File

@ -40,9 +40,9 @@ int main() {
// and sleep for 100ms // and sleep for 100ms
#if defined(ARDUINO) #if defined(ARDUINO)
delay(10); delay(100);
#else #else
sleep_for(milliseconds(10)); sleep_for(milliseconds(100));
#endif #endif
} }