mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-25 00:56:13 +01:00
Compare commits
No commits in common. "798241927f1909e0fb30272f1d4170d842d7fb22" and "9fa213e198f66c877a8fdc6db7bb03ee9ea3e1e4" have entirely different histories.
798241927f
...
9fa213e198
|
@ -708,7 +708,7 @@ void DCCEXParser::parseOne(Print *stream, byte *com, RingStream * ringStream)
|
||||||
StringFormatter::send(stream, F(" %d X"), id);
|
StringFormatter::send(stream, F(" %d X"), id);
|
||||||
} else {
|
} else {
|
||||||
uint8_t pos = tto->getPosition();
|
uint8_t pos = tto->getPosition();
|
||||||
uint8_t type = tto->isEXTT();
|
uint8_t type = tto->getType();
|
||||||
uint8_t posCount = tto->getPositionCount();
|
uint8_t posCount = tto->getPositionCount();
|
||||||
const FSH *todesc = NULL;
|
const FSH *todesc = NULL;
|
||||||
#ifdef EXRAIL_ACTIVE
|
#ifdef EXRAIL_ACTIVE
|
||||||
|
@ -1075,29 +1075,22 @@ bool DCCEXParser::parseI(Print *stream, int16_t params, int16_t p[])
|
||||||
return Turntable::printAll(stream);
|
return Turntable::printAll(stream);
|
||||||
|
|
||||||
case 1: // <I id> broadcast type and current position
|
case 1: // <I id> broadcast type and current position
|
||||||
{
|
return false;
|
||||||
Turntable *tto = Turntable::get(p[0]);
|
|
||||||
if (tto) {
|
|
||||||
bool type = tto->isEXTT();
|
|
||||||
uint8_t position = tto->getPosition();
|
|
||||||
StringFormatter::send(stream, F("<i %d %d>\n"), type, position);
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
|
|
||||||
case 2: // <I id position> - rotate to position for DCC turntables
|
case 2: // <I id position> - rotate to position for DCC turntables
|
||||||
{
|
{
|
||||||
Turntable *tto = Turntable::get(p[0]);
|
|
||||||
if (p[1] == HASH_KEYWORD_DCC) { // Create a DCC turntable
|
if (p[1] == HASH_KEYWORD_DCC) { // Create a DCC turntable
|
||||||
if (tto) return false;
|
DIAG(F("Create DCC turntable %d"), p[0]);
|
||||||
if (!DCCTurntable::create(p[0])) return false;
|
|
||||||
Turntable *tto = Turntable::get(p[0]);
|
|
||||||
tto->addPosition(0);
|
|
||||||
} else { // Otherwise move a DCC turntable
|
} else { // Otherwise move a DCC turntable
|
||||||
|
Turntable *tto = Turntable::get(p[0]);
|
||||||
if (tto) {
|
if (tto) {
|
||||||
if (!tto->setPosition(p[0], p[1])) return false;
|
if (tto->getPosition() == p[1]) return true;
|
||||||
|
uint16_t value = tto->getPositionValue(p[1]);
|
||||||
|
if (value) {
|
||||||
|
DIAG(F("Rotate DCC turntable %d to position %d"), p[0], p[1]);
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1107,24 +1100,34 @@ bool DCCEXParser::parseI(Print *stream, int16_t params, int16_t p[])
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
{
|
{
|
||||||
Turntable *tto = Turntable::get(p[0]);
|
|
||||||
if (!tto) return false;
|
|
||||||
if (p[1] == HASH_KEYWORD_ADD) { // <I id ADD value> add position value to turntable
|
if (p[1] == HASH_KEYWORD_ADD) { // <I id ADD value> add position value to turntable
|
||||||
tto->addPosition(p[2]);
|
Turntable *tto = Turntable::get(p[0]);
|
||||||
StringFormatter::send(stream, F("<i>\n"));
|
if (tto) {
|
||||||
|
tto->addPosition(p[2]);
|
||||||
|
StringFormatter::send(stream, F("<i>\n"));
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
} else { // <I id position activity> rotate to position for EX-Turntable
|
} else { // <I id position activity> rotate to position for EX-Turntable
|
||||||
if (!tto->setPosition(p[0], p[1], p[2])) return false;
|
Turntable *tto = Turntable::get(p[0]);
|
||||||
|
if (tto) {
|
||||||
|
if (!tto->setPosition(p[0], p[1], p[2])) return false;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case 4: // <I id EXTT vpin home> create an EXTT turntable
|
case 5: // <I id EXTT vpin i2caddress home> create an EXTT turntable
|
||||||
{
|
{
|
||||||
if (p[1] == HASH_KEYWORD_EXTT) {
|
if (p[1] == HASH_KEYWORD_EXTT) {
|
||||||
if (Turntable::get(p[0])) return false;
|
if (Turntable::get(p[0])) return false;
|
||||||
if (!EXTTTurntable::create(p[0], (VPIN)p[2])) return false;
|
if (!EXTTTurntable::create(p[0], (VPIN)p[2], (uint8_t)p[3])) return false;
|
||||||
Turntable *tto = Turntable::get(p[0]);
|
Turntable *tto = Turntable::get(p[0]);
|
||||||
tto->addPosition(p[3]);
|
tto->addPosition(p[4]);
|
||||||
|
} else if (params > 3 && params < 39 && p[1] == HASH_KEYWORD_DCC) {
|
||||||
|
DIAG(F("Create DCC turntable %d at base address %d with %d positions"), p[0], p[2], params - 2);
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,13 +176,6 @@ bool IODevice::exists(VPIN vpin) {
|
||||||
return findDevice(vpin) != NULL;
|
return findDevice(vpin) != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the status of the device att vpin.
|
|
||||||
uint8_t IODevice::getStatus(VPIN vpin) {
|
|
||||||
IODevice *dev = findDevice(vpin);
|
|
||||||
if (!dev) return false;
|
|
||||||
return dev->_deviceState;
|
|
||||||
}
|
|
||||||
|
|
||||||
// check whether the pin supports notification. If so, then regular _read calls are not required.
|
// check whether the pin supports notification. If so, then regular _read calls are not required.
|
||||||
bool IODevice::hasCallback(VPIN vpin) {
|
bool IODevice::hasCallback(VPIN vpin) {
|
||||||
IODevice *dev = findDevice(vpin);
|
IODevice *dev = findDevice(vpin);
|
||||||
|
|
|
@ -154,9 +154,6 @@ public:
|
||||||
// exists checks whether there is a device owning the specified vpin
|
// exists checks whether there is a device owning the specified vpin
|
||||||
static bool exists(VPIN vpin);
|
static bool exists(VPIN vpin);
|
||||||
|
|
||||||
// getStatus returns the state of the device at the specified vpin
|
|
||||||
static uint8_t getStatus(VPIN vpin);
|
|
||||||
|
|
||||||
// Enable shared interrupt on specified pin for GPIO extender modules. The extender module
|
// Enable shared interrupt on specified pin for GPIO extender modules. The extender module
|
||||||
// should pull down this pin when requesting a scan. The pin may be shared by multiple modules.
|
// should pull down this pin when requesting a scan. The pin may be shared by multiple modules.
|
||||||
// Without the shared interrupt, input states are scanned periodically to detect changes on
|
// Without the shared interrupt, input states are scanned periodically to detect changes on
|
||||||
|
@ -380,7 +377,6 @@ private:
|
||||||
uint8_t *_pinInUse;
|
uint8_t *_pinInUse;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef IO_NO_HAL
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
/*
|
/*
|
||||||
* IODevice subclass for EX-Turntable.
|
* IODevice subclass for EX-Turntable.
|
||||||
|
@ -409,13 +405,10 @@ private:
|
||||||
void _begin() override;
|
void _begin() override;
|
||||||
void _loop(unsigned long currentMicros) override;
|
void _loop(unsigned long currentMicros) override;
|
||||||
int _read(VPIN vpin) override;
|
int _read(VPIN vpin) override;
|
||||||
void _broadcastStatus (VPIN vpin, uint8_t status);
|
|
||||||
void _writeAnalogue(VPIN vpin, int value, uint8_t activity, uint16_t duration) override;
|
void _writeAnalogue(VPIN vpin, int value, uint8_t activity, uint16_t duration) override;
|
||||||
void _display() override;
|
void _display() override;
|
||||||
uint8_t _stepperStatus;
|
uint8_t _stepperStatus;
|
||||||
uint8_t _previousStatus;
|
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
|
@ -28,13 +28,12 @@
|
||||||
* Refer to the documentation for further information including the valid activities.
|
* Refer to the documentation for further information including the valid activities.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef IO_EXTurntable_h
|
||||||
|
#define IO_EXTurntable_h
|
||||||
|
|
||||||
#include "IODevice.h"
|
#include "IODevice.h"
|
||||||
#include "I2CManager.h"
|
#include "I2CManager.h"
|
||||||
#include "DIAG.h"
|
#include "DIAG.h"
|
||||||
#include "Turntables.h"
|
|
||||||
#include "CommandDistributor.h"
|
|
||||||
|
|
||||||
#ifndef IO_NO_HAL
|
|
||||||
|
|
||||||
void EXTurntable::create(VPIN firstVpin, int nPins, I2CAddress I2CAddress) {
|
void EXTurntable::create(VPIN firstVpin, int nPins, I2CAddress I2CAddress) {
|
||||||
new EXTurntable(firstVpin, nPins, I2CAddress);
|
new EXTurntable(firstVpin, nPins, I2CAddress);
|
||||||
|
@ -45,8 +44,6 @@ EXTurntable::EXTurntable(VPIN firstVpin, int nPins, I2CAddress I2CAddress) {
|
||||||
_firstVpin = firstVpin;
|
_firstVpin = firstVpin;
|
||||||
_nPins = nPins;
|
_nPins = nPins;
|
||||||
_I2CAddress = I2CAddress;
|
_I2CAddress = I2CAddress;
|
||||||
_stepperStatus = 0;
|
|
||||||
_previousStatus = 0;
|
|
||||||
addDevice(this);
|
addDevice(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,22 +80,10 @@ int EXTurntable::_read(VPIN vpin) {
|
||||||
if (_stepperStatus > 1) {
|
if (_stepperStatus > 1) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
if (_stepperStatus != _previousStatus) {
|
|
||||||
_broadcastStatus(vpin, _stepperStatus);
|
|
||||||
_previousStatus = _stepperStatus;
|
|
||||||
}
|
|
||||||
return _stepperStatus;
|
return _stepperStatus;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If a status change has occurred for a turntable object, broadcast it
|
|
||||||
void EXTurntable::_broadcastStatus (VPIN vpin, uint8_t status) {
|
|
||||||
Turntable *tto = Turntable::getByVpin(vpin);
|
|
||||||
if (tto) {
|
|
||||||
CommandDistributor::broadcastTurntable(tto->getId(), tto->getPosition(), status);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// writeAnalogue to send the steps and activity to Turntable-EX.
|
// writeAnalogue to send the steps and activity to Turntable-EX.
|
||||||
// Sends 3 bytes containing the MSB and LSB of the step count, and activity.
|
// Sends 3 bytes containing the MSB and LSB of the step count, and activity.
|
||||||
// value contains the steps, bit shifted to MSB + LSB.
|
// value contains the steps, bit shifted to MSB + LSB.
|
||||||
|
|
|
@ -57,6 +57,13 @@ void Turntable::add(Turntable *tto) {
|
||||||
turntablelistHash++;
|
turntablelistHash++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Find turntable from list
|
||||||
|
Turntable *Turntable::get(uint16_t id) {
|
||||||
|
for (Turntable *tto = _firstTurntable; tto != NULL; tto = tto->_nextTurntable)
|
||||||
|
if (tto->_turntableData.id == id) return tto;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
// Add a position
|
// Add a position
|
||||||
void Turntable::addPosition(uint16_t value) {
|
void Turntable::addPosition(uint16_t value) {
|
||||||
_turntablePositions.insert(value);
|
_turntablePositions.insert(value);
|
||||||
|
@ -88,39 +95,16 @@ uint8_t Turntable::getPositionCount() {
|
||||||
/*
|
/*
|
||||||
* Public static functions
|
* Public static functions
|
||||||
*/
|
*/
|
||||||
// Find turntable from list
|
|
||||||
Turntable *Turntable::get(uint16_t id) {
|
|
||||||
for (Turntable *tto = _firstTurntable; tto != nullptr; tto = tto->_nextTurntable)
|
|
||||||
if (tto->_turntableData.id == id) return tto;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find turntable via Vpin
|
|
||||||
Turntable *Turntable::getByVpin(VPIN vpin) {
|
|
||||||
for (Turntable *tto = _firstTurntable; tto != nullptr; tto = tto->_nextTurntable) {
|
|
||||||
if (tto->isEXTT()) {
|
|
||||||
EXTTTurntable *exttTto = static_cast<EXTTTurntable*>(tto);
|
|
||||||
if (exttTto->getVpin() == vpin) {
|
|
||||||
return tto;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Broadcast position changes
|
|
||||||
bool Turntable::setPositionStateOnly(uint16_t id, uint8_t position, bool moving) {
|
bool Turntable::setPositionStateOnly(uint16_t id, uint8_t position, bool moving) {
|
||||||
Turntable *tto = get(id);
|
Turntable *tto = get(id);
|
||||||
if (!tto) return false;
|
if (!tto) return false;
|
||||||
// Only need to broadcast from here if it's a DCC type, device driver broadcasts EXTT
|
CommandDistributor::broadcastTurntable(id, position, moving);
|
||||||
if (!tto->isEXTT()) { CommandDistributor::broadcastTurntable(id, position, moving); }
|
|
||||||
#if defined(EXRAIL_ACTIVE)
|
#if defined(EXRAIL_ACTIVE)
|
||||||
// RMFT2::turntableEvent(id, position);
|
// RMFT2::turntableEvent(id, position);
|
||||||
#endif
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initiate a turntable move
|
|
||||||
bool Turntable::setPosition(uint16_t id, uint8_t position, uint8_t activity) {
|
bool Turntable::setPosition(uint16_t id, uint8_t position, uint8_t activity) {
|
||||||
#if defined(DIAG_IO)
|
#if defined(DIAG_IO)
|
||||||
DIAG(F("Turntable(%d, %d)"), id, position);
|
DIAG(F("Turntable(%d, %d)"), id, position);
|
||||||
|
@ -132,12 +116,12 @@ bool Turntable::setPosition(uint16_t id, uint8_t position, uint8_t activity) {
|
||||||
if (ok) {
|
if (ok) {
|
||||||
// Broadcast a position change only if non zero has been set, or home/calibration sent
|
// Broadcast a position change only if non zero has been set, or home/calibration sent
|
||||||
if (position > 0 || (position == 0 && (activity == 2 || activity == 3))) {
|
if (position > 0 || (position == 0 && (activity == 2 || activity == 3))) {
|
||||||
tto->_turntableData.position = position;
|
if (tto->getType() == TURNTABLE_EXTT) {
|
||||||
if (tto->isEXTT()) {
|
|
||||||
tto->setPositionStateOnly(id, position, 1);
|
tto->setPositionStateOnly(id, position, 1);
|
||||||
} else {
|
} else {
|
||||||
tto->setPositionStateOnly(id, position, 0);
|
tto->setPositionStateOnly(id, position, 0);
|
||||||
}
|
}
|
||||||
|
tto->_turntableData.position = position;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ok;
|
return ok;
|
||||||
|
@ -148,39 +132,38 @@ bool Turntable::setPosition(uint16_t id, uint8_t position, uint8_t activity) {
|
||||||
*
|
*
|
||||||
*************************************************************************************/
|
*************************************************************************************/
|
||||||
// Private constructor
|
// Private constructor
|
||||||
EXTTTurntable::EXTTTurntable(uint16_t id, VPIN vpin) :
|
EXTTTurntable::EXTTTurntable(uint16_t id, VPIN vpin, uint8_t i2caddress) :
|
||||||
Turntable(id, TURNTABLE_EXTT)
|
Turntable(id, TURNTABLE_EXTT)
|
||||||
{
|
{
|
||||||
_exttTurntableData.vpin = vpin;
|
_exttTurntableData.vpin = vpin;
|
||||||
|
_exttTurntableData.i2caddress = i2caddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
using DevState = IODevice::DeviceStateEnum;
|
|
||||||
|
|
||||||
// Create function
|
// Create function
|
||||||
Turntable *EXTTTurntable::create(uint16_t id, VPIN vpin) {
|
Turntable *EXTTTurntable::create(uint16_t id, VPIN vpin, uint8_t i2caddress) {
|
||||||
#ifndef IO_NO_HAL
|
#ifndef IO_NO_HAL
|
||||||
Turntable *tto = get(id);
|
Turntable *tto = get(id);
|
||||||
if (tto) {
|
if (tto) {
|
||||||
if (tto->isType(TURNTABLE_EXTT)) {
|
if (tto->isType(TURNTABLE_EXTT)) {
|
||||||
EXTTTurntable *extt = (EXTTTurntable *)tto;
|
EXTTTurntable *extt = (EXTTTurntable *)tto;
|
||||||
extt->_exttTurntableData.vpin = vpin;
|
extt->_exttTurntableData.vpin = vpin;
|
||||||
|
extt->_exttTurntableData.i2caddress = i2caddress;
|
||||||
return tto;
|
return tto;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!IODevice::exists(vpin)) return nullptr;
|
tto = (Turntable *)new EXTTTurntable(id, vpin, i2caddress);
|
||||||
if (IODevice::getStatus(vpin) == DevState::DEVSTATE_FAILED) return nullptr;
|
|
||||||
tto = (Turntable *)new EXTTTurntable(id, vpin);
|
|
||||||
DIAG(F("Turntable 0x%x size %d size %d"), tto, sizeof(Turntable), sizeof(struct TurntableData));
|
DIAG(F("Turntable 0x%x size %d size %d"), tto, sizeof(Turntable), sizeof(struct TurntableData));
|
||||||
return tto;
|
return tto;
|
||||||
#else
|
#else
|
||||||
(void)id;
|
(void)id;
|
||||||
|
(void)i2caddress;
|
||||||
(void)vpin;
|
(void)vpin;
|
||||||
return NULL;
|
return NULL;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void EXTTTurntable::print(Print *stream) {
|
void EXTTTurntable::print(Print *stream) {
|
||||||
StringFormatter::send(stream, F("<i %d EXTURNTABLE %d>\n"), _turntableData.id, _exttTurntableData.vpin);
|
StringFormatter::send(stream, F("<i %d EXTURNTABLE %d %d>\n"), _turntableData.id, _exttTurntableData.vpin, _exttTurntableData.i2caddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
// EX-Turntable specific code for moving to the specified position
|
// EX-Turntable specific code for moving to the specified position
|
||||||
|
@ -202,43 +185,4 @@ using DevState = IODevice::DeviceStateEnum;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************************************************
|
|
||||||
* DCCTurntable - DCC Turntable device.
|
|
||||||
*
|
|
||||||
*************************************************************************************/
|
|
||||||
// Private constructor
|
|
||||||
DCCTurntable::DCCTurntable(uint16_t id) : Turntable(id, TURNTABLE_DCC) {}
|
|
||||||
|
|
||||||
// Create function
|
|
||||||
Turntable *DCCTurntable::create(uint16_t id) {
|
|
||||||
#ifndef IO_NO_HAL
|
|
||||||
Turntable *tto = get(id);
|
|
||||||
if (!tto) {
|
|
||||||
tto = (Turntable *)new DCCTurntable(id);
|
|
||||||
DIAG(F("Turntable 0x%x size %d size %d"), tto, sizeof(Turntable), sizeof(struct TurntableData));
|
|
||||||
}
|
|
||||||
return tto;
|
|
||||||
#else
|
|
||||||
(void)id;
|
|
||||||
return NULL;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void DCCTurntable::print(Print *stream) {
|
|
||||||
StringFormatter::send(stream, F("<i %d DCCTURNTABLE>\n"), _turntableData.id);
|
|
||||||
}
|
|
||||||
|
|
||||||
// EX-Turntable specific code for moving to the specified position
|
|
||||||
bool DCCTurntable::setPositionInternal(uint8_t position, uint8_t activity) {
|
|
||||||
#ifndef IO_NO_HAL
|
|
||||||
int16_t value = getPositionValue(position);
|
|
||||||
if (position == 0 || !value) return false; // Return false if it's not a valid position
|
|
||||||
// Set position via device driver
|
|
||||||
// DCC activate function here
|
|
||||||
#else
|
|
||||||
(void)position;
|
|
||||||
#endif
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
29
Turntables.h
29
Turntables.h
|
@ -135,7 +135,6 @@ protected:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static Turntable *get(uint16_t id);
|
static Turntable *get(uint16_t id);
|
||||||
static Turntable *getByVpin(VPIN vpin);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Static data
|
* Static data
|
||||||
|
@ -149,7 +148,7 @@ public:
|
||||||
inline bool isHidden() { return _turntableData.hidden; }
|
inline bool isHidden() { return _turntableData.hidden; }
|
||||||
inline void setHidden(bool h) {_turntableData.hidden=h; }
|
inline void setHidden(bool h) {_turntableData.hidden=h; }
|
||||||
inline bool isType(uint8_t type) { return _turntableData.turntableType == type; }
|
inline bool isType(uint8_t type) { return _turntableData.turntableType == type; }
|
||||||
inline bool isEXTT() const { return _turntableData.turntableType == TURNTABLE_EXTT; }
|
inline uint8_t getType() { return _turntableData.turntableType; }
|
||||||
inline uint16_t getId() { return _turntableData.id; }
|
inline uint16_t getId() { return _turntableData.id; }
|
||||||
inline Turntable *next() { return _nextTurntable; }
|
inline Turntable *next() { return _nextTurntable; }
|
||||||
void printState(Print *stream);
|
void printState(Print *stream);
|
||||||
|
@ -194,16 +193,16 @@ private:
|
||||||
// EXTTTurntableData contains device specific data
|
// EXTTTurntableData contains device specific data
|
||||||
struct EXTTTurntableData {
|
struct EXTTTurntableData {
|
||||||
VPIN vpin;
|
VPIN vpin;
|
||||||
|
uint8_t i2caddress;
|
||||||
} _exttTurntableData;
|
} _exttTurntableData;
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
EXTTTurntable(uint16_t id, VPIN vpin);
|
EXTTTurntable(uint16_t id, VPIN vpin, uint8_t i2caddress);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Create function
|
// Create function
|
||||||
static Turntable *create(uint16_t id, VPIN vpin);
|
static Turntable *create(uint16_t id, VPIN vpin, uint8_t i2caddress);
|
||||||
void print(Print *stream) override;
|
void print(Print *stream) override;
|
||||||
VPIN getVpin() const { return _exttTurntableData.vpin; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// EX-Turntable specific code for setting position
|
// EX-Turntable specific code for setting position
|
||||||
|
@ -211,26 +210,6 @@ protected:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*************************************************************************************
|
|
||||||
* DCCTurntable - DCC accessory Turntable device.
|
|
||||||
*
|
|
||||||
*************************************************************************************/
|
|
||||||
class DCCTurntable : public Turntable {
|
|
||||||
private:
|
|
||||||
// Constructor
|
|
||||||
DCCTurntable(uint16_t id);
|
|
||||||
|
|
||||||
public:
|
|
||||||
// Create function
|
|
||||||
static Turntable *create(uint16_t id);
|
|
||||||
void print(Print *stream) override;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
// DCC specific code for setting position
|
|
||||||
bool setPositionInternal(uint8_t position, uint8_t activity=0) override;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue
Block a user