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

Automatic ALIAS(name)

and _ in keywords
This commit is contained in:
Asbelos 2022-03-21 16:29:35 +00:00
parent 367e400d75
commit 269e1b36ea
3 changed files with 4 additions and 4 deletions

View File

@ -145,7 +145,7 @@ int16_t DCCEXParser::splitValues(int16_t result[MAX_COMMAND_PARAMS], const byte
runningValue = 16 * runningValue + (hot - 'A' + 10); runningValue = 16 * runningValue + (hot - 'A' + 10);
break; break;
} }
if (hot >= 'A' && hot <= 'Z') if (hot=='_' || (hot >= 'A' && hot <= 'Z'))
{ {
// Since JMRI got modified to send keywords in some rare cases, we need this // Since JMRI got modified to send keywords in some rare cases, we need this
// Super Kluge to turn keywords into a hash value that can be recognised later // Super Kluge to turn keywords into a hash value that can be recognised later

View File

@ -121,7 +121,7 @@
#define ACTIVATE(addr,subaddr) #define ACTIVATE(addr,subaddr)
#define ACTIVATEL(addr) #define ACTIVATEL(addr)
#define AFTER(sensor_id) #define AFTER(sensor_id)
#define ALIAS(name,value) #define ALIAS(name,value...)
#define AMBER(signal_id) #define AMBER(signal_id)
#define AT(sensor_id) #define AT(sensor_id)
#define ATGTE(sensor_id,value) #define ATGTE(sensor_id,value)

View File

@ -52,7 +52,7 @@
// Pass 1 Implements aliases // Pass 1 Implements aliases
#include "EXRAIL2MacroReset.h" #include "EXRAIL2MacroReset.h"
#undef ALIAS #undef ALIAS
#define ALIAS(name,value) const int name=value; #define ALIAS(name,value...) const int name= 1##value##0 ==10 ? -__COUNTER__ : value##0/10;
#include "myAutomation.h" #include "myAutomation.h"
// Pass 2 convert descriptions to withrottle format emitter function // Pass 2 convert descriptions to withrottle format emitter function
@ -170,7 +170,7 @@ const FLASH int16_t RMFT2::SignalDefinitions[] = {
#define ACTIVATE(addr,subaddr) OPCODE_DCCACTIVATE,V(addr<<3 | subaddr<<1 | 1), #define ACTIVATE(addr,subaddr) OPCODE_DCCACTIVATE,V(addr<<3 | subaddr<<1 | 1),
#define ACTIVATEL(addr) OPCODE_DCCACTIVATE,V((addr+3)<<1 | 1), #define ACTIVATEL(addr) OPCODE_DCCACTIVATE,V((addr+3)<<1 | 1),
#define AFTER(sensor_id) OPCODE_AT,V(sensor_id),OPCODE_AFTER,V(sensor_id), #define AFTER(sensor_id) OPCODE_AT,V(sensor_id),OPCODE_AFTER,V(sensor_id),
#define ALIAS(name,value) #define ALIAS(name,value...)
#define AMBER(signal_id) OPCODE_AMBER,V(signal_id), #define AMBER(signal_id) OPCODE_AMBER,V(signal_id),
#define AT(sensor_id) OPCODE_AT,V(sensor_id), #define AT(sensor_id) OPCODE_AT,V(sensor_id),
#define ATGTE(sensor_id,value) OPCODE_ATGTE,V(sensor_id),OPCODE_PAD,V(value), #define ATGTE(sensor_id,value) OPCODE_ATGTE,V(sensor_id),OPCODE_PAD,V(value),