This commit is contained in:
Matthew Kennedy 2023-11-01 15:16:27 -07:00
parent 21998dae2d
commit fe028f4f06
3 changed files with 12 additions and 4 deletions

View File

@ -67,7 +67,7 @@ public:
} }
const char *msg() { const char *msg() {
return dcMotor.msg; return dcMotor.msg();
} }
void stop() { void stop() {

View File

@ -27,14 +27,17 @@ void TwoPinDcMotor::enable() {
if (m_disable) { if (m_disable) {
m_disable->setValue(false); m_disable->setValue(false);
} }
msg = nullptr;
m_msg = nullptr;
} }
void TwoPinDcMotor::disable(const char *msg) { void TwoPinDcMotor::disable(const char *msg) {
if (m_disable) { if (m_disable) {
m_disable->setValue(true); m_disable->setValue(true);
} }
this->msg = msg;
m_msg = msg;
// Also set the duty to zero // Also set the duty to zero
set(0); set(0);
} }

View File

@ -37,7 +37,12 @@ public:
virtual bool isOpenDirection() const = 0; virtual bool isOpenDirection() const = 0;
const char *msg = nullptr; const char* msg() const {
return m_msg;
}
protected:
const char* m_msg = nullptr;
}; };
struct IPwm; struct IPwm;