This commit is contained in:
Matthew Kennedy 2023-11-01 18:16:27 -04:00 committed by rusefillc
parent 114e656627
commit 02621224a7
3 changed files with 12 additions and 5 deletions

View File

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

View File

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

View File

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