Compare commits
No commits in common. "634d560ee1b7a596c9e41aa0dd48b03ee594bb3a" and "e5916466a6c353309c27873b9e35600bc6178508" have entirely different histories.
634d560ee1
...
e5916466a6
@ -26,15 +26,14 @@ DRV8833::DRV8833(Configuration config, Thing* parent) : Thing(parent) {
|
||||
|
||||
DRV8833::DifferentialDrive::DifferentialDrive(DRV8833::Configuration config,
|
||||
Thing* parent)
|
||||
: RoboidControl::DifferentialDrive(nullptr, nullptr, parent) {
|
||||
this->drv8833 = new DRV8833(config, this);
|
||||
this->leftWheel = this->drv8833->motorA;
|
||||
this->rightWheel = this->drv8833->motorB;
|
||||
}
|
||||
: RoboidControl::DifferentialDrive(this->drv8833.motorA,
|
||||
this->drv8833.motorB,
|
||||
parent),
|
||||
drv8833(config, this) {}
|
||||
|
||||
void DRV8833::DifferentialDrive::Update(bool recurse) {
|
||||
RoboidControl::DifferentialDrive::Update(recurse);
|
||||
this->drv8833->Update(false);
|
||||
this->drv8833.Update(false);
|
||||
}
|
||||
|
||||
#pragma endregion Differential drive
|
||||
|
@ -19,8 +19,6 @@ 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
|
||||
@ -45,7 +43,7 @@ class DRV8833::DifferentialDrive : public RoboidControl::DifferentialDrive {
|
||||
virtual void Update(bool recurse = false) override;
|
||||
|
||||
protected:
|
||||
DRV8833* drv8833 = nullptr;
|
||||
DRV8833 drv8833;
|
||||
};
|
||||
|
||||
#pragma endregion Differential drive
|
||||
|
@ -65,7 +65,7 @@ UltrasonicSensor::TouchSensor::TouchSensor(Configuration config, Thing* parent)
|
||||
void UltrasonicSensor::TouchSensor::Update(bool recursive) {
|
||||
RoboidControl::TouchSensor::Update(recursive);
|
||||
this->ultrasonic.Update(false);
|
||||
this->internalTouch = (this->ultrasonic.distance > 0 &&
|
||||
this->internalTouch |= (this->ultrasonic.distance > 0 &&
|
||||
this->ultrasonic.distance <= this->touchDistance);
|
||||
}
|
||||
|
||||
|
@ -40,9 +40,9 @@ int main() {
|
||||
|
||||
// and sleep for 100ms
|
||||
#if defined(ARDUINO)
|
||||
delay(10);
|
||||
delay(100);
|
||||
#else
|
||||
sleep_for(milliseconds(10));
|
||||
sleep_for(milliseconds(100));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user