mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-24 16:46:13 +01:00
Compare commits
2 Commits
ebbeea5fbb
...
7a305e179c
Author | SHA1 | Date | |
---|---|---|---|
|
7a305e179c | ||
|
8437b0e7aa |
|
@ -812,13 +812,12 @@ void DCCEXParser::parseOne(Print *stream, byte *com, RingStream * ringStream)
|
|||
const FSH *tpdesc = NULL;
|
||||
for (uint8_t p = 0; p < posCount; p++) {
|
||||
StringFormatter::send(stream, F("<jP"));
|
||||
int16_t value = tto->getPositionValue(p);
|
||||
int16_t angle = tto->getPositionAngle(p);
|
||||
#ifdef EXRAIL_ACTIVE
|
||||
tpdesc = RMFT2::getTurntablePositionDescription(id, p);
|
||||
#endif
|
||||
if (tpdesc == NULL) tpdesc = F("");
|
||||
StringFormatter::send(stream, F(" %d %d %d %d \"%S\""), id, p, value, angle, tpdesc);
|
||||
StringFormatter::send(stream, F(" %d %d %d \"%S\""), id, p, angle, tpdesc);
|
||||
StringFormatter::send(stream, F(">\n"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -409,11 +409,12 @@ private:
|
|||
void _begin() override;
|
||||
void _loop(unsigned long currentMicros) override;
|
||||
int _read(VPIN vpin) override;
|
||||
void _broadcastStatus (VPIN vpin, uint8_t status);
|
||||
void _broadcastStatus (VPIN vpin, uint8_t status, uint8_t activity);
|
||||
void _writeAnalogue(VPIN vpin, int value, uint8_t activity, uint16_t duration) override;
|
||||
void _display() override;
|
||||
uint8_t _stepperStatus;
|
||||
uint8_t _previousStatus;
|
||||
uint8_t _currentActivity;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
|
|
@ -72,7 +72,9 @@ void EXTurntable::_loop(unsigned long currentMicros) {
|
|||
I2CManager.read(_I2CAddress, readBuffer, 1);
|
||||
_stepperStatus = readBuffer[0];
|
||||
if (_stepperStatus != _previousStatus && _stepperStatus == 0) { // Broadcast when a rotation finishes
|
||||
_broadcastStatus(_firstVpin, _stepperStatus);
|
||||
if ( _currentActivity < 4) {
|
||||
_broadcastStatus(_firstVpin, _stepperStatus, _currentActivity);
|
||||
}
|
||||
_previousStatus = _stepperStatus;
|
||||
}
|
||||
delayUntil(currentMicros + 100000); // Wait 100ms before checking again
|
||||
|
@ -90,12 +92,14 @@ int EXTurntable::_read(VPIN vpin) {
|
|||
}
|
||||
|
||||
// If a status change has occurred for a turntable object, broadcast it
|
||||
void EXTurntable::_broadcastStatus (VPIN vpin, uint8_t status) {
|
||||
void EXTurntable::_broadcastStatus (VPIN vpin, uint8_t status, uint8_t activity) {
|
||||
Turntable *tto = Turntable::getByVpin(vpin);
|
||||
if (tto) {
|
||||
if (activity < 4) {
|
||||
tto->setMoving(status);
|
||||
CommandDistributor::broadcastTurntable(tto->getId(), tto->getPosition(), status);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// writeAnalogue to send the steps and activity to Turntable-EX.
|
||||
|
@ -124,9 +128,10 @@ void EXTurntable::_writeAnalogue(VPIN vpin, int value, uint8_t activity, uint16_
|
|||
DIAG(F("I2CManager write I2C Address:%d stepsMSB:%d stepsLSB:%d activity:%d"),
|
||||
_I2CAddress.toString(), stepsMSB, stepsLSB, activity);
|
||||
#endif
|
||||
_stepperStatus = 1; // Tell the device driver Turntable-EX is busy
|
||||
if (activity < 4) _stepperStatus = 1; // Tell the device driver Turntable-EX is busy
|
||||
_previousStatus = _stepperStatus;
|
||||
_broadcastStatus(vpin, _stepperStatus); // Broadcast when the rotation starts
|
||||
_currentActivity = activity;
|
||||
_broadcastStatus(vpin, _stepperStatus, activity); // Broadcast when the rotation starts
|
||||
I2CManager.write(_I2CAddress, 3, stepsMSB, stepsLSB, activity);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
|
||||
#include "StringFormatter.h"
|
||||
|
||||
#define VERSION "5.1.6"
|
||||
#define VERSION "5.1.7"
|
||||
// 5.1.7 - Fix turntable broadcasts for non-movement activities and <JP> result
|
||||
// 5.1.6 - STM32F4xx native I2C driver added
|
||||
// 5.1.5 - Added turntable object and EXRAIL commands
|
||||
// - <I ...>, <JO ...>, <JP ...> - turntable commands
|
||||
|
|
Loading…
Reference in New Issue
Block a user