1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-23 08:06:13 +01:00

Fix device driver, disable objects, start parser

This commit is contained in:
peteGSX 2023-08-21 06:43:06 +10:00
parent 1491da4813
commit 98f8022268
5 changed files with 29 additions and 9 deletions

View File

@ -41,7 +41,7 @@
#include "TrackManager.h"
#include "DCCTimer.h"
#include "EXRAIL2.h"
#include "Turntables.h"
// #include "Turntables.h"
// This macro can't be created easily as a portable function because the
// flashlist requires a far pointer for high flash access.
@ -96,6 +96,7 @@ const int16_t HASH_KEYWORD_ANOUT = -26399;
const int16_t HASH_KEYWORD_WIFI = -5583;
const int16_t HASH_KEYWORD_ETHERNET = -30767;
const int16_t HASH_KEYWORD_WIT = 31594;
const int16_t HASH_KEYWORD_EXTT = 8573;
int16_t DCCEXParser::stashP[MAX_COMMAND_PARAMS];
bool DCCEXParser::stashBusy;
@ -1021,25 +1022,45 @@ bool DCCEXParser::parseD(Print *stream, int16_t params, int16_t p[])
// ==========================
// Turntable
// <I> - list all
// <I id> - delete
// <I id steps> - operate (DCC)
// <I id steps activity> - operate (EXTT)
// <I id EXTT i2caddress vpin position1 position2 ...> - create EXTT
// <I id DCC linear1 linear2 ...> - create DCC? - This TBA
bool DCCEXParser::parseI(Print *stream, int16_t params, int16_t p[])
{
switch (params)
{
case 0: // <I> list turntable objects
return Turntable::printAll(stream);
StringFormatter::send(stream, F("<i all>\n"));
return true;
// return Turntable::printAll(stream);
case 1: // <T id> delete turntable
if (!Turntable::remove(p[0]))
return false;
StringFormatter::send(stream, F("<i>\n"));
// if (!Turntable::remove(p[0]))
// return false;
StringFormatter::send(stream, F("<i delete>\n"));
return true;
case 2: // <T id position> - rotate to position for DCC turntables
case 3: // <T id position activity> rotate to position for EX-Turntable
{
DIAG(F("Got %d parameters (2 or 3)"), params);
return true;
}
default:
{
if (params < 40) {
DIAG(F("Create turntable with %d parameters"), params);
return true;
}
}
break;
}
return false;
}
// CALLBACKS must be static

View File

@ -542,7 +542,6 @@ protected:
#include "IO_PCF8575.h"
#include "IO_duinoNodes.h"
#include "IO_EXIOExpander.h"
#include "IO_EXTurntable.h"
#endif // iodevice_h

View File

@ -20,9 +20,9 @@
/*
* The IO_EXTurntable device driver is used to control a turntable via an Arduino with a stepper motor over I2C.
*
* The EX-Turntable code lives in a separate repo (https://github.com/DCC-EX/Turntable-EX) and contains the stepper motor logic.
* The EX-Turntable code lives in a separate repo (https://github.com/DCC-EX/EX-Turntable) and contains the stepper motor logic.
*
* This device driver sends a step position to Turntable-EX to indicate the step position to move to using either of these commands:
* This device driver sends a step position to EX-Turntable to indicate the step position to move to using either of these commands:
* <D TT vpin steps activity> in the serial console
* MOVETT(vpin, steps, activity) in EX-RAIL
* Refer to the documentation for further information including the valid activities.