mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-24 16:46:13 +01:00
Compare commits
No commits in common. "7a305e179ceae37f6eb8165e25ac25bfb693cdd7" and "ebbeea5fbb8198ed7d3e7679b4dea6bd212a002b" have entirely different histories.
7a305e179c
...
ebbeea5fbb
|
@ -812,12 +812,13 @@ 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 \"%S\""), id, p, angle, tpdesc);
|
||||
StringFormatter::send(stream, F(" %d %d %d %d \"%S\""), id, p, value, angle, tpdesc);
|
||||
StringFormatter::send(stream, F(">\n"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -409,12 +409,11 @@ private:
|
|||
void _begin() override;
|
||||
void _loop(unsigned long currentMicros) override;
|
||||
int _read(VPIN vpin) override;
|
||||
void _broadcastStatus (VPIN vpin, uint8_t status, uint8_t activity);
|
||||
void _broadcastStatus (VPIN vpin, uint8_t status);
|
||||
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,9 +72,7 @@ void EXTurntable::_loop(unsigned long currentMicros) {
|
|||
I2CManager.read(_I2CAddress, readBuffer, 1);
|
||||
_stepperStatus = readBuffer[0];
|
||||
if (_stepperStatus != _previousStatus && _stepperStatus == 0) { // Broadcast when a rotation finishes
|
||||
if ( _currentActivity < 4) {
|
||||
_broadcastStatus(_firstVpin, _stepperStatus, _currentActivity);
|
||||
}
|
||||
_broadcastStatus(_firstVpin, _stepperStatus);
|
||||
_previousStatus = _stepperStatus;
|
||||
}
|
||||
delayUntil(currentMicros + 100000); // Wait 100ms before checking again
|
||||
|
@ -92,15 +90,13 @@ 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, uint8_t activity) {
|
||||
void EXTurntable::_broadcastStatus (VPIN vpin, uint8_t status) {
|
||||
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.
|
||||
// Sends 3 bytes containing the MSB and LSB of the step count, and activity.
|
||||
|
@ -128,10 +124,9 @@ 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
|
||||
if (activity < 4) _stepperStatus = 1; // Tell the device driver Turntable-EX is busy
|
||||
_stepperStatus = 1; // Tell the device driver Turntable-EX is busy
|
||||
_previousStatus = _stepperStatus;
|
||||
_currentActivity = activity;
|
||||
_broadcastStatus(vpin, _stepperStatus, activity); // Broadcast when the rotation starts
|
||||
_broadcastStatus(vpin, _stepperStatus); // Broadcast when the rotation starts
|
||||
I2CManager.write(_I2CAddress, 3, stepsMSB, stepsLSB, activity);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,8 +3,7 @@
|
|||
|
||||
#include "StringFormatter.h"
|
||||
|
||||
#define VERSION "5.1.7"
|
||||
// 5.1.7 - Fix turntable broadcasts for non-movement activities and <JP> result
|
||||
#define VERSION "5.1.6"
|
||||
// 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