mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-22 15:46:14 +01:00
NEOPIXEL EXRAIL
This commit is contained in:
parent
0cb175544e
commit
ead6e5afa1
13
EXRAIL2.cpp
13
EXRAIL2.cpp
|
@ -969,6 +969,10 @@ void RMFT2::loop2() {
|
|||
}
|
||||
break;
|
||||
|
||||
case OPCODE_NEOPIXEL: // OPCODE_NEOPIXEL,V(vpin),OPCODE_PAD,V(rgbcolour)
|
||||
IODevice::writeAnalogue(operand,getOperand(1));
|
||||
break;
|
||||
|
||||
#ifndef IO_NO_HAL
|
||||
case OPCODE_WAITFORTT: // OPCODE_WAITFOR,V(turntable_id)
|
||||
if (Turntable::ttMoving(operand)) {
|
||||
|
@ -1154,6 +1158,15 @@ int16_t RMFT2::getSignalSlot(int16_t id) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (sigtype== NEOPIXEL_SIGNAL_FLAG) {
|
||||
// redpin,amberpin,greenpin are the 3 rgbs
|
||||
VPIN colour=redpin;
|
||||
if (rag==SIGNAL_AMBER) colour=amberpin;
|
||||
if (rag==SIGNAL_GREEN) colour=greenpin;
|
||||
IODevice::writeAnalogue(sigid, colour);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// LED or similar 3 pin signal, (all pins zero would be a virtual signal)
|
||||
// If amberpin is zero, synthesise amber from red+green
|
||||
|
|
|
@ -71,7 +71,7 @@ enum OPCODE : byte {OPCODE_THROW,OPCODE_CLOSE,
|
|||
OPCODE_ROUTE_ACTIVE,OPCODE_ROUTE_INACTIVE,OPCODE_ROUTE_HIDDEN,
|
||||
OPCODE_ROUTE_DISABLED,
|
||||
OPCODE_STASH,OPCODE_CLEAR_STASH,OPCODE_CLEAR_ALL_STASH,OPCODE_PICKUP_STASH,
|
||||
|
||||
OPCODE_NEOPIXEL,
|
||||
// OPcodes below this point are skip-nesting IF operations
|
||||
// placed here so that they may be skipped as a group
|
||||
// see skipIfBlock()
|
||||
|
@ -160,7 +160,10 @@ class LookList {
|
|||
static const int16_t ACTIVE_HIGH_SIGNAL_FLAG=0x2000;
|
||||
static const int16_t DCC_SIGNAL_FLAG=0x1000;
|
||||
static const int16_t DCCX_SIGNAL_FLAG=0x3000;
|
||||
static const int16_t NEOPIXEL_SIGNAL_FLAG=0x5000;
|
||||
static const int16_t SIGNAL_ID_MASK=0x0FFF;
|
||||
// Neopixel has last bit 1 for colour on, otherwise black (to allow for blinking etc with SET/RESET)
|
||||
static const int16_t NEOPIXEL_FLAG_ON=0x0001;
|
||||
// Throttle Info Access functions built by exrail macros
|
||||
static const byte rosterNameCount;
|
||||
static const int16_t HIGHFLASH routeIdList[];
|
||||
|
|
|
@ -97,6 +97,9 @@
|
|||
#undef LCCX
|
||||
#undef LCN
|
||||
#undef MOVETT
|
||||
#undef NEOPIXEL
|
||||
#undef NEOPIXEL_OFF
|
||||
#undef NEOPIXEL_SIGNAL
|
||||
#undef ONACTIVATE
|
||||
#undef ONACTIVATEL
|
||||
#undef ONAMBER
|
||||
|
@ -254,6 +257,9 @@
|
|||
#define SCREEN(display,row,msg)
|
||||
#define LCN(msg)
|
||||
#define MOVETT(id,steps,activity)
|
||||
#define NEOPIXEL(id,colour)
|
||||
#define NEOPIXEL_OFF(id,colour)
|
||||
#define NEOPIXEL_SIGNAL(sigid,redcolour,ambercolour,greencolour)
|
||||
#define ONACTIVATE(addr,subaddr)
|
||||
#define ONACTIVATEL(linear)
|
||||
#define ONAMBER(signal_id)
|
||||
|
|
|
@ -174,6 +174,7 @@ bool exrailHalSetup() {
|
|||
#define DCC_SIGNAL(id,addr,subaddr) | FEATURE_SIGNAL
|
||||
#undef DCCX_SIGNAL
|
||||
#define DCCX_SIGNAL(id,redAspect,amberAspect,greenAspect) | FEATURE_SIGNAL
|
||||
#define NEOPIXEL_SIGNAL(sigid,redcolour,ambercolour,greencolour) | FEATURE_SIGNAL
|
||||
#undef VIRTUAL_SIGNAL
|
||||
#define VIRTUAL_SIGNAL(id) | FEATURE_SIGNAL
|
||||
|
||||
|
@ -405,6 +406,8 @@ const FSH * RMFT2::getRosterFunctions(int16_t id) {
|
|||
#define DCC_SIGNAL(id,addr,subaddr) id | RMFT2::DCC_SIGNAL_FLAG,addr,subaddr,0,
|
||||
#undef DCCX_SIGNAL
|
||||
#define DCCX_SIGNAL(id,redAspect,amberAspect,greenAspect) id | RMFT2::DCCX_SIGNAL_FLAG,redAspect,amberAspect,greenAspect,
|
||||
#undef NEOPIXEL_SIGNAL
|
||||
#define NEOPIXEL_SIGNAL(sigid,redcolour,ambercolour,greencolour) id | RMFT2::NEOPIXEL_SIGNAL_FLAG,redcolour | NEOPIXEL_FLAG_ON, ambercolour | NEOPIXEL_FLAG_ON, greencolour | NEOPIXEL_FLAG_ON,
|
||||
#undef VIRTUAL_SIGNAL
|
||||
#define VIRTUAL_SIGNAL(id) id,0,0,0,
|
||||
|
||||
|
@ -515,6 +518,9 @@ int RMFT2::onLCCLookup[RMFT2::countLCCLookup];
|
|||
#define STEALTH(code...) PRINT(dummy)
|
||||
#define LCN(msg) PRINT(msg)
|
||||
#define MOVETT(id,steps,activity) OPCODE_SERVO,V(id),OPCODE_PAD,V(steps),OPCODE_PAD,V(EXTurntable::activity),OPCODE_PAD,V(0),
|
||||
#define NEOPIXEL(id,colour) OPCODE_NEOPIXEL,V(id),OPCODE_PAD,V(colour| NEOPIXEL_FLAG_ON),
|
||||
#define NEOPIXEL_OFF(id,colour) OPCODE_NEOPIXEL,V(id),OPCODE_PAD,V(colour& ^NEOPIXEL_FLAG_ON),
|
||||
#define NEOPIXEL_SIGNAL(sigid,redcolour,ambercolour,greencolour)
|
||||
#define ONACTIVATE(addr,subaddr) OPCODE_ONACTIVATE,V(addr<<2|subaddr),
|
||||
#define ONACTIVATEL(linear) OPCODE_ONACTIVATE,V(linear+3),
|
||||
#define ONAMBER(signal_id) OPCODE_ONAMBER,V(signal_id),
|
||||
|
|
Loading…
Reference in New Issue
Block a user