1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-12-25 05:31:24 +01:00

Add move check

This commit is contained in:
peteGSX 2023-09-04 07:38:26 +10:00
parent 1e48c59cd8
commit dd890e65bf
2 changed files with 6 additions and 0 deletions

View File

@ -95,6 +95,7 @@ void EXTurntable::_broadcastStatus (VPIN vpin, uint8_t status) {
Turntable *tto = Turntable::getByVpin(vpin); Turntable *tto = Turntable::getByVpin(vpin);
if (tto) { if (tto) {
CommandDistributor::broadcastTurntable(tto->getId(), tto->getPosition(), status); CommandDistributor::broadcastTurntable(tto->getId(), tto->getPosition(), status);
tto->setMoving(status);
} }
} }

View File

@ -109,6 +109,9 @@ protected:
// Store the previous position to allow checking for changes // Store the previous position to allow checking for changes
uint8_t _previousPosition = 0; uint8_t _previousPosition = 0;
// Store the current state of the turntable
bool _isMoving = false;
/* /*
* Constructor * Constructor
*/ */
@ -159,6 +162,8 @@ public:
void addPosition(uint16_t value); void addPosition(uint16_t value);
uint16_t getPositionValue(uint8_t position); uint16_t getPositionValue(uint8_t position);
uint8_t getPositionCount(); uint8_t getPositionCount();
bool isMoving() { return _isMoving; }
void setMoving(bool moving) { _isMoving=moving; }
/* /*
* Virtual functions * Virtual functions