1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-12-24 21:21:24 +01:00

Working with 15 positions

This commit is contained in:
peteGSX 2023-08-29 19:04:45 +10:00
parent b0d8510127
commit 6cad794411
6 changed files with 42 additions and 8 deletions

View File

@ -692,6 +692,8 @@ void DCCEXParser::parseOne(Print *stream, byte *com, RingStream * ringStream)
} }
StringFormatter::send(stream, F(">\n")); StringFormatter::send(stream, F(">\n"));
return; return;
// No turntables without HAL support
#ifndef IO_NO_HAL
case HASH_KEYWORD_O: // <JO returns turntable list case HASH_KEYWORD_O: // <JO returns turntable list
StringFormatter::send(stream, F("<jO")); StringFormatter::send(stream, F("<jO"));
if (params==1) { // <JO> if (params==1) { // <JO>
@ -721,15 +723,19 @@ void DCCEXParser::parseOne(Print *stream, byte *com, RingStream * ringStream)
} }
StringFormatter::send(stream, F(">\n")); StringFormatter::send(stream, F(">\n"));
return; return;
#endif
default: break; default: break;
} // switch(p[1]) } // switch(p[1])
break; // case J break; // case J
} }
// No turntables without HAL support
#ifndef IO_NO_HAL
case 'I': // TURNTABLE <I ...> case 'I': // TURNTABLE <I ...>
if (parseI(stream, params, p)) if (parseI(stream, params, p))
return; return;
break; break;
#endif
default: //anything else will diagnose and drop out to <X> default: //anything else will diagnose and drop out to <X>
DIAG(F("Opcode=%c params=%d"), opcode, params); DIAG(F("Opcode=%c params=%d"), opcode, params);
@ -1051,12 +1057,13 @@ bool DCCEXParser::parseD(Print *stream, int16_t params, int16_t p[])
} }
// ========================== // ==========================
// Turntable // Turntable - no support if no HAL
// <I> - list all // <I> - list all
// <I id steps> - operate (DCC) // <I id steps> - operate (DCC)
// <I id steps activity> - operate (EXTT) // <I id steps activity> - operate (EXTT)
// <I id EXTT i2caddress vpin position1 position2 ...> - create EXTT // <I id EXTT i2caddress vpin position1 position2 ...> - create EXTT
// <I id DCC linear1 linear2 ...> - create DCC? - This TBA // <I id DCC linear1 linear2 ...> - create DCC? - This TBA
#ifndef IO_NO_HAL
bool DCCEXParser::parseI(Print *stream, int16_t params, int16_t p[]) bool DCCEXParser::parseI(Print *stream, int16_t params, int16_t p[])
{ {
switch (params) switch (params)
@ -1114,6 +1121,7 @@ bool DCCEXParser::parseI(Print *stream, int16_t params, int16_t p[])
return true; return true;
} }
} }
#endif
// CALLBACKS must be static // CALLBACKS must be static
bool DCCEXParser::stashCallback(Print *stream, int16_t p[MAX_COMMAND_PARAMS], RingStream * ringStream) bool DCCEXParser::stashCallback(Print *stream, int16_t p[MAX_COMMAND_PARAMS], RingStream * ringStream)

View File

@ -24,6 +24,7 @@
#include <Arduino.h> #include <Arduino.h>
#include "FSH.h" #include "FSH.h"
#include "RingStream.h" #include "RingStream.h"
#include "defines.h"
typedef void (*FILTER_CALLBACK)(Print * stream, byte & opcode, byte & paramCount, int16_t p[]); typedef void (*FILTER_CALLBACK)(Print * stream, byte & opcode, byte & paramCount, int16_t p[]);
typedef void (*AT_COMMAND_CALLBACK)(HardwareSerial * stream,const byte * command); typedef void (*AT_COMMAND_CALLBACK)(HardwareSerial * stream,const byte * command);
@ -37,7 +38,7 @@ struct DCCEXParser
static void setFilter(FILTER_CALLBACK filter); static void setFilter(FILTER_CALLBACK filter);
static void setRMFTFilter(FILTER_CALLBACK filter); static void setRMFTFilter(FILTER_CALLBACK filter);
static void setAtCommandCallback(AT_COMMAND_CALLBACK filter); static void setAtCommandCallback(AT_COMMAND_CALLBACK filter);
static const int MAX_COMMAND_PARAMS=10; // Must not exceed this static const int MAX_COMMAND_PARAMS=MAX_PARSER_PARAMS; // Must not exceed this
private: private:
@ -49,7 +50,9 @@ struct DCCEXParser
static bool parseS(Print * stream, int16_t params, int16_t p[]); static bool parseS(Print * stream, int16_t params, int16_t p[]);
static bool parsef(Print * stream, int16_t params, int16_t p[]); static bool parsef(Print * stream, int16_t params, int16_t p[]);
static bool parseD(Print * stream, int16_t params, int16_t p[]); static bool parseD(Print * stream, int16_t params, int16_t p[]);
#ifndef IO_NO_HAL
static bool parseI(Print * stream, int16_t params, int16_t p[]); static bool parseI(Print * stream, int16_t params, int16_t p[]);
#endif
static Print * getAsyncReplyStream(); static Print * getAsyncReplyStream();
static void commitAsyncReplyStream(); static void commitAsyncReplyStream();

View File

@ -27,12 +27,6 @@
// Define symbol DIAG_LOOPTIMES to enable CS loop execution time to be reported // Define symbol DIAG_LOOPTIMES to enable CS loop execution time to be reported
//#define DIAG_LOOPTIMES //#define DIAG_LOOPTIMES
// Define symbol IO_NO_HAL to reduce FLASH footprint when HAL features not required
// The HAL is disabled by default on Nano and Uno platforms, because of limited flash space.
#if defined(ARDUINO_AVR_NANO) || defined(ARDUINO_AVR_UNO)
#define IO_NO_HAL
#endif
// Define symbol IO_SWITCH_OFF_SERVO to set the PCA9685 output to 0 when an // Define symbol IO_SWITCH_OFF_SERVO to set the PCA9685 output to 0 when an
// animation has completed. This switches off the servo motor, preventing // animation has completed. This switches off the servo motor, preventing
// the continuous buzz sometimes found on servos, and reducing the // the continuous buzz sometimes found on servos, and reducing the

View File

@ -26,6 +26,8 @@
#include "EXRAIL2.h" #include "EXRAIL2.h"
#include "DCC.h" #include "DCC.h"
// No turntable support without HAL
#ifndef IO_NO_HAL
/* /*
* Protected static data * Protected static data
@ -180,3 +182,5 @@ EXTTTurntable::EXTTTurntable(uint16_t id, VPIN vpin, uint8_t i2caddress) :
#endif #endif
return true; return true;
} }
#endif

View File

@ -25,6 +25,9 @@
#include "IODevice.h" #include "IODevice.h"
#include "StringFormatter.h" #include "StringFormatter.h"
// No turntable support without HAL
#ifndef IO_NO_HAL
// Turntable type definitions // Turntable type definitions
// EXTT = EX-Turntable // EXTT = EX-Turntable
// DCC = DCC accessory turntables - to be added later // DCC = DCC accessory turntables - to be added later
@ -203,3 +206,5 @@ protected:
}; };
#endif #endif
#endif

View File

@ -213,6 +213,26 @@
// //
#define WIFI_SERIAL_LINK_SPEED 115200 #define WIFI_SERIAL_LINK_SPEED 115200
////////////////////////////////////////////////////////////////////////////////
//
// Define symbol IO_NO_HAL to reduce FLASH footprint when HAL features not required
// The HAL is disabled by default on Nano and Uno platforms, because of limited flash space.
//
#if defined(ARDUINO_AVR_NANO) || defined(ARDUINO_AVR_UNO)
#define IO_NO_HAL
#endif
////////////////////////////////////////////////////////////////////////////////
//
// This defines the maximum number of parameters DCCEXParser will accept.
// The increase is required to allow for a sufficient number of turntable positions.
//
#ifdef IO_NO_HAL
#define MAX_PARSER_PARAMS 10
#else
#define MAX_PARSER_PARAMS 20
#endif
#if __has_include ( "myAutomation.h") #if __has_include ( "myAutomation.h")
#if defined(HAS_ENOUGH_MEMORY) || defined(DISABLE_EEPROM) || defined(DISABLE_PROG) #if defined(HAS_ENOUGH_MEMORY) || defined(DISABLE_EEPROM) || defined(DISABLE_PROG)
#define EXRAIL_ACTIVE #define EXRAIL_ACTIVE