mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-24 00:26:13 +01:00
Compare commits
No commits in common. "8216579f62e166bcaf474fa182162233d1cbbec2" and "a508ee7055edfbc72de4aa5559f31869f213006d" have entirely different histories.
8216579f62
...
a508ee7055
|
@ -1113,11 +1113,11 @@ bool DCCEXParser::parseD(Print *stream, int16_t params, int16_t p[])
|
||||||
|
|
||||||
case "ANOUT"_hk: // <D ANOUT vpin position [profile]>
|
case "ANOUT"_hk: // <D ANOUT vpin position [profile]>
|
||||||
IODevice::writeAnalogue(p[1], p[2], params>3 ? p[3] : 0);
|
IODevice::writeAnalogue(p[1], p[2], params>3 ? p[3] : 0);
|
||||||
return true;
|
break;
|
||||||
|
|
||||||
case "ANIN"_hk: // <D ANIN vpin> Display analogue input value
|
case "ANIN"_hk: // <D ANIN vpin> Display analogue input value
|
||||||
DIAG(F("VPIN=%u value=%d"), p[1], IODevice::readAnalogue(p[1]));
|
DIAG(F("VPIN=%u value=%d"), p[1], IODevice::readAnalogue(p[1]));
|
||||||
return true;
|
break;
|
||||||
|
|
||||||
#if !defined(IO_NO_HAL)
|
#if !defined(IO_NO_HAL)
|
||||||
case "HAL"_hk:
|
case "HAL"_hk:
|
||||||
|
@ -1125,12 +1125,12 @@ bool DCCEXParser::parseD(Print *stream, int16_t params, int16_t p[])
|
||||||
IODevice::DumpAll();
|
IODevice::DumpAll();
|
||||||
else if (p[1] == "RESET"_hk)
|
else if (p[1] == "RESET"_hk)
|
||||||
IODevice::reset();
|
IODevice::reset();
|
||||||
return true;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case "TT"_hk: // <D TT vpin steps activity>
|
case "TT"_hk: // <D TT vpin steps activity>
|
||||||
IODevice::writeAnalogue(p[1], p[2], params>3 ? p[3] : 0);
|
IODevice::writeAnalogue(p[1], p[2], params>3 ? p[3] : 0);
|
||||||
return true;
|
break;
|
||||||
|
|
||||||
default: // invalid/unknown
|
default: // invalid/unknown
|
||||||
return parseC(stream, params, p);
|
return parseC(stream, params, p);
|
||||||
|
|
|
@ -74,70 +74,6 @@
|
||||||
#define ALIAS(name,value...) const int name= 1##value##0 ==10 ? -__COUNTER__ : value##0/10;
|
#define ALIAS(name,value...) const int name= 1##value##0 ==10 ? -__COUNTER__ : value##0/10;
|
||||||
#include "myAutomation.h"
|
#include "myAutomation.h"
|
||||||
|
|
||||||
// Pass 1d Detect sequence duplicates.
|
|
||||||
// This pass generates no runtime data or code
|
|
||||||
#include "EXRAIL2MacroReset.h"
|
|
||||||
#undef AUTOMATION
|
|
||||||
#define AUTOMATION(id, description) id,
|
|
||||||
#undef ROUTE
|
|
||||||
#define ROUTE(id, description) id,
|
|
||||||
#undef SEQUENCE
|
|
||||||
#define SEQUENCE(id) id,
|
|
||||||
constexpr int16_t compileTimeSequenceList[]={
|
|
||||||
#include "myAutomation.h"
|
|
||||||
0
|
|
||||||
};
|
|
||||||
constexpr int16_t stuffSize=sizeof(compileTimeSequenceList)/sizeof(int16_t) - 1;
|
|
||||||
|
|
||||||
|
|
||||||
// Compile time function to check for sequence nos.
|
|
||||||
constexpr bool hasseq(const int16_t value, const uint16_t pos=0 ) {
|
|
||||||
return pos>=stuffSize? false :
|
|
||||||
compileTimeSequenceList[pos]==value
|
|
||||||
|| hasseq(value,pos+1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Compile time function to check for duplicate sequence nos.
|
|
||||||
constexpr bool hasdup(const int16_t value, const uint16_t pos ) {
|
|
||||||
return pos>=stuffSize? false :
|
|
||||||
compileTimeSequenceList[pos]==value
|
|
||||||
|| hasseq(value,pos+1)
|
|
||||||
|| hasdup(compileTimeSequenceList[pos],pos+1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static_assert(!hasdup(compileTimeSequenceList[0],1),"Duplicate SEQUENCE/ROUTE/AUTOMATION detected");
|
|
||||||
|
|
||||||
//pass 1s static asserts to
|
|
||||||
// - check call and follows etc for existing sequence numbers
|
|
||||||
// - check range on LATCH/UNLATCH
|
|
||||||
// This pass generates no runtime data or code
|
|
||||||
#include "EXRAIL2MacroReset.h"
|
|
||||||
#undef CALL
|
|
||||||
#define CALL(id) static_assert(hasseq(id),"Sequence not found");
|
|
||||||
#undef FOLLOW
|
|
||||||
#define FOLLOW(id) static_assert(hasseq(id),"Sequence not found");
|
|
||||||
#undef START
|
|
||||||
#define START(id) static_assert(hasseq(id),"Sequence not found");
|
|
||||||
#undef SENDLOCO
|
|
||||||
#define SENDLOCO(cab,id) static_assert(hasseq(id),"Sequence not found");
|
|
||||||
#undef LATCH
|
|
||||||
#define LATCH(id) static_assert(id>=0 && id<MAX_FLAGS,"Id out of valid range 0-255" );
|
|
||||||
#undef UNLATCH
|
|
||||||
#define UNLATCH(id) static_assert(id>=0 && id<MAX_FLAGS,"Id out of valid range 0-255" );
|
|
||||||
#undef RESERVE
|
|
||||||
#define RESERVE(id) static_assert(id>=0 && id<MAX_FLAGS,"Id out of valid range 0-255" );
|
|
||||||
#undef FREE
|
|
||||||
#define FREE(id) static_assert(id>=0 && id<MAX_FLAGS,"Id out of valid range 0-255" );
|
|
||||||
#undef SPEED
|
|
||||||
#define SPEED(speed) static_assert(speed>=0 && speed<128,"Speed out of valid range 0-127");
|
|
||||||
#undef FWD
|
|
||||||
#define FWD(speed) static_assert(speed>=0 && speed<128,"Speed out of valid range 0-127");
|
|
||||||
#undef REV
|
|
||||||
#define REV(speed) static_assert(speed>=0 && speed<128,"Speed out of valid range 0-127");
|
|
||||||
|
|
||||||
#include "myAutomation.h"
|
|
||||||
|
|
||||||
// Pass 1h Implements HAL macro by creating exrailHalSetup function
|
// Pass 1h Implements HAL macro by creating exrailHalSetup function
|
||||||
// Also allows creating EXTurntable object
|
// Also allows creating EXTurntable object
|
||||||
#include "EXRAIL2MacroReset.h"
|
#include "EXRAIL2MacroReset.h"
|
||||||
|
|
|
@ -3,12 +3,7 @@
|
||||||
|
|
||||||
#include "StringFormatter.h"
|
#include "StringFormatter.h"
|
||||||
|
|
||||||
#define VERSION "5.2.25"
|
#define VERSION "5.2.23"
|
||||||
// 5.2.25 - Fix bug causing <X> after working <D commands
|
|
||||||
// 5.2.24 - Exrail macro asserts to catch
|
|
||||||
// : duplicate/missing automation/route/sequence/call ids
|
|
||||||
// : latches and reserves out of range
|
|
||||||
// : speeds out of range
|
|
||||||
// 5.2.23 - KeywordHasher _hk (no functional change)
|
// 5.2.23 - KeywordHasher _hk (no functional change)
|
||||||
// 5.2.22 - Bugfixes: Empty turnout descriptions ok; negative route numbers valid.
|
// 5.2.22 - Bugfixes: Empty turnout descriptions ok; negative route numbers valid.
|
||||||
// 5.2.21 - Add STARTUP_DELAY config option to delay CS bootup
|
// 5.2.21 - Add STARTUP_DELAY config option to delay CS bootup
|
||||||
|
|
Loading…
Reference in New Issue
Block a user