From dd890e65bfe2b307ff19c501ac3b87c69f0b8256 Mon Sep 17 00:00:00 2001 From: peteGSX <97784652+peteGSX@users.noreply.github.com> Date: Mon, 4 Sep 2023 07:38:26 +1000 Subject: [PATCH] Add move check --- IO_EXTurntable.cpp | 1 + Turntables.h | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/IO_EXTurntable.cpp b/IO_EXTurntable.cpp index eba8321..dcbe018 100644 --- a/IO_EXTurntable.cpp +++ b/IO_EXTurntable.cpp @@ -95,6 +95,7 @@ void EXTurntable::_broadcastStatus (VPIN vpin, uint8_t status) { Turntable *tto = Turntable::getByVpin(vpin); if (tto) { CommandDistributor::broadcastTurntable(tto->getId(), tto->getPosition(), status); + tto->setMoving(status); } } diff --git a/Turntables.h b/Turntables.h index 67ab0e3..30cba82 100644 --- a/Turntables.h +++ b/Turntables.h @@ -109,6 +109,9 @@ protected: // Store the previous position to allow checking for changes uint8_t _previousPosition = 0; + // Store the current state of the turntable + bool _isMoving = false; + /* * Constructor */ @@ -159,6 +162,8 @@ public: void addPosition(uint16_t value); uint16_t getPositionValue(uint8_t position); uint8_t getPositionCount(); + bool isMoving() { return _isMoving; } + void setMoving(bool moving) { _isMoving=moving; } /* * Virtual functions