diff --git a/EXRAIL2.cpp b/EXRAIL2.cpp index 2324ea8..acdd5ba 100644 --- a/EXRAIL2.cpp +++ b/EXRAIL2.cpp @@ -803,6 +803,12 @@ void RMFT2::loop2() { CommandDistributor::broadcastPower(); break; + case OPCODE_POWERON: + TrackManager::setMainPower(POWERMODE::ON); + DCCWaveform::setJoin(false); + CommandDistributor::broadcastPower(); + break; + case OPCODE_UNJOIN: DCCWaveform::setJoin(false); CommandDistributor::broadcastPower(); diff --git a/EXRAIL2.h b/EXRAIL2.h index 29b9816..3e855d9 100644 --- a/EXRAIL2.h +++ b/EXRAIL2.h @@ -44,7 +44,7 @@ enum OPCODE : byte {OPCODE_THROW,OPCODE_CLOSE, OPCODE_PAD,OPCODE_FOLLOW,OPCODE_CALL,OPCODE_RETURN, OPCODE_JOIN,OPCODE_UNJOIN,OPCODE_READ_LOCO1,OPCODE_READ_LOCO2,OPCODE_POM, OPCODE_START,OPCODE_SETLOCO,OPCODE_SENDLOCO, - OPCODE_PAUSE, OPCODE_RESUME,OPCODE_POWEROFF, + OPCODE_PAUSE, OPCODE_RESUME,OPCODE_POWEROFF,OPCODE_POWERON, OPCODE_ONCLOSE, OPCODE_ONTHROW, OPCODE_SERVOTURNOUT, OPCODE_PINTURNOUT, OPCODE_PRINT,OPCODE_DCCACTIVATE, OPCODE_ONACTIVATE,OPCODE_ONDEACTIVATE,OPCODE_IFGTE,OPCODE_IFLT, diff --git a/EXRAIL2MacroReset.h b/EXRAIL2MacroReset.h index 962322a..5ef34c6 100644 --- a/EXRAIL2MacroReset.h +++ b/EXRAIL2MacroReset.h @@ -79,6 +79,7 @@ #undef PRINT #undef POM #undef POWEROFF +#undef POWERON #undef READ_LOCO #undef RED #undef RESERVE @@ -170,6 +171,7 @@ #define PRINT(msg) #define POM(cv,value) #define POWEROFF +#define POWERON #define READ_LOCO #define RED(signal_id) #define RESERVE(blockid) diff --git a/EXRAILMacros.h b/EXRAILMacros.h index 7e70e83..2a9057b 100644 --- a/EXRAILMacros.h +++ b/EXRAILMacros.h @@ -216,6 +216,7 @@ const FLASH int16_t RMFT2::SignalDefinitions[] = { #define PIN_TURNOUT(id,pin,description...) OPCODE_PINTURNOUT,V(id),OPCODE_PAD,V(pin), #define POM(cv,value) OPCODE_POM,V(cv),OPCODE_PAD,V(value), #define POWEROFF OPCODE_POWEROFF,0,0, +#define POWERON OPCODE_POWERON,0,0, #define PRINT(msg) OPCODE_PRINT,V(__COUNTER__ - StringMacroTracker2), #define READ_LOCO OPCODE_READ_LOCO1,0,0,OPCODE_READ_LOCO2,0,0, #define RED(signal_id) OPCODE_RED,V(signal_id), diff --git a/TrackManager.cpp b/TrackManager.cpp index 5c67f83..bfb6199 100644 --- a/TrackManager.cpp +++ b/TrackManager.cpp @@ -20,6 +20,7 @@ #include "TrackManager.h" #include "FSH.h" #include "DCCWaveform.h" +#include "DCC.h" #include "MotorDriver.h" #include "DIAG.h" // Virtualised Motor shield multi-track hardware Interface @@ -65,6 +66,7 @@ void TrackManager::Setup(const FSH * shieldname, // && (mainDriver->getFaultPin() != UNUSED_PIN)); DIAG(F("Signal pin config: %S accuracy waveform"), MotorDriver::usePWM ? F("high") : F("normal") ); + DCC::begin(shieldname); } void TrackManager::addTrack(byte t, MotorDriver* driver) {