1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-26 17:46:14 +01:00

Minor progress

This commit is contained in:
peteGSX 2023-08-27 19:30:56 +10:00
parent 1425da20b5
commit 2202cb0c5e
2 changed files with 4 additions and 3 deletions

View File

@ -1060,15 +1060,15 @@ bool DCCEXParser::parseI(Print *stream, int16_t params, int16_t p[])
default: // If we're here, it must be creating a turntable object default: // If we're here, it must be creating a turntable object
{ {
DIAG(F("Params: %d"), params);
if (params > 5 && params < 41 && p[1] == HASH_KEYWORD_EXTT) { if (params > 5 && params < 41 && p[1] == HASH_KEYWORD_EXTT) {
DIAG(F("Create EXTT turntable %d on vpin %d and address %d with %d positions"), p[0], p[2], p[3], params - 4); DIAG(F("Create EXTT turntable %d on vpin %d and address %d with %d positions"), p[0], p[2], p[3], params - 4);
if (Turntable::get(p[0])) return false;
if (!EXTTTurntable::create(p[0], (VPIN)p[2], (uint8_t)p[3])) 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]);
for ( uint8_t i = params - 4; i > 0; i--) { for (uint8_t i = params - 4; i > 0; i--) {
tto->addPosition(p[i + 3]); tto->addPosition(p[i + 3]);
DIAG(F("Add position %d"), p[i + 3]);
} }
tto->addPosition(0); // Need to add position 0 as 0 so positions start at 1
} else if (params > 3 && params < 39 && p[1] == HASH_KEYWORD_DCC) { } 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); DIAG(F("Create DCC turntable %d at base address %d with %d positions"), p[0], p[2], params - 2);
} else { } else {

View File

@ -51,6 +51,7 @@ EXTurntable::EXTurntable(VPIN firstVpin, int nPins, I2CAddress I2CAddress) {
void EXTurntable::_begin() { void EXTurntable::_begin() {
I2CManager.begin(); I2CManager.begin();
if (I2CManager.exists(_I2CAddress)) { if (I2CManager.exists(_I2CAddress)) {
DIAG(F("EX-Turntable device found, I2C:%s"), _I2CAddress.toString());
#ifdef DIAG_IO #ifdef DIAG_IO
_display(); _display();
#endif #endif