diff --git a/DCCEXParser.cpp b/DCCEXParser.cpp index 995162b..48c45fb 100644 --- a/DCCEXParser.cpp +++ b/DCCEXParser.cpp @@ -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 { - DIAG(F("Params: %d"), params); 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); + if (Turntable::get(p[0])) return false; if (!EXTTTurntable::create(p[0], (VPIN)p[2], (uint8_t)p[3])) return false; 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]); - 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) { DIAG(F("Create DCC turntable %d at base address %d with %d positions"), p[0], p[2], params - 2); } else { diff --git a/IO_EXTurntable.cpp b/IO_EXTurntable.cpp index b57fa25..8c7057b 100644 --- a/IO_EXTurntable.cpp +++ b/IO_EXTurntable.cpp @@ -51,6 +51,7 @@ EXTurntable::EXTurntable(VPIN firstVpin, int nPins, I2CAddress I2CAddress) { void EXTurntable::_begin() { I2CManager.begin(); if (I2CManager.exists(_I2CAddress)) { + DIAG(F("EX-Turntable device found, I2C:%s"), _I2CAddress.toString()); #ifdef DIAG_IO _display(); #endif