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

Merge pull request #211 from DCC-EX/EXRAILbroadcast

BROADCAST msg - -  user defined - for use in EXRAIL automation
This commit is contained in:
Ash-4 2022-02-17 00:16:56 -06:00 committed by GitHub
commit 3ca75d9615
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 305 additions and 3 deletions

2
.gitignore vendored
View File

@ -7,7 +7,7 @@ Release/*
.pio/ .pio/
.vscode/ .vscode/
config.h config.h
.vscode/extensions.json .vscode/*
mySetup.h mySetup.h
mySetup.cpp mySetup.cpp
myHal.cpp myHal.cpp

View File

@ -135,3 +135,8 @@ void CommandDistributor::broadcastPower() {
LCD(2,F("Power %S%S"),state=='1'?F("On"):F("Off"),reason); LCD(2,F("Power %S%S"),state=='1'?F("On"):F("Off"),reason);
broadcast(true); broadcast(true);
} }
void CommandDistributor::broadcastText(const FSH * msg) {
StringFormatter::send(broadcastBufferWriter,F("%S"),msg);
broadcast(false);
}

View File

@ -32,6 +32,7 @@ public :
static void broadcastSensor(int16_t id, bool value); static void broadcastSensor(int16_t id, bool value);
static void broadcastTurnout(int16_t id, bool isClosed); static void broadcastTurnout(int16_t id, bool isClosed);
static void broadcastPower(); static void broadcastPower();
static void broadcastText(const FSH * msg);
static void forget(byte clientId); static void forget(byte clientId);
private: private:
static void broadcast(bool includeWithrottleClients); static void broadcast(bool includeWithrottleClients);

View File

@ -46,7 +46,7 @@
#include "Turnouts.h" #include "Turnouts.h"
#include "Sensors.h" #include "Sensors.h"
#include "Outputs.h" #include "Outputs.h"
#include "EXRAIL.h"
#include "CommandDistributor.h" #include "CommandDistributor.h"
#include "EXRAIL.h"
#endif #endif

View File

@ -32,6 +32,7 @@
#undef ATTIMEOUT #undef ATTIMEOUT
#undef AUTOMATION #undef AUTOMATION
#undef AUTOSTART #undef AUTOSTART
#undef BROADCAST
#undef CALL #undef CALL
#undef CLOSE #undef CLOSE
#undef DEACTIVATE #undef DEACTIVATE
@ -121,6 +122,7 @@
#define ATTIMEOUT(sensor_id,timeout_ms) #define ATTIMEOUT(sensor_id,timeout_ms)
#define AUTOMATION(id, description) #define AUTOMATION(id, description)
#define AUTOSTART #define AUTOSTART
#define BROADCAST(msg)
#define CALL(route) #define CALL(route)
#define CLOSE(id) #define CLOSE(id)
#define DEACTIVATE(addr,subaddr) #define DEACTIVATE(addr,subaddr)

View File

@ -69,6 +69,8 @@ void RMFT2::emitWithrottleDescriptions(Print * stream) {
// Pass 3... Create Text sending functions // Pass 3... Create Text sending functions
#include "EXRAIL2MacroReset.h" #include "EXRAIL2MacroReset.h"
const int StringMacroTracker1=__COUNTER__; const int StringMacroTracker1=__COUNTER__;
#undef BROADCAST
#define BROADCAST(msg) case (__COUNTER__ - StringMacroTracker1) : CommandDistributor::broadcastText(F(msg));break;
#undef PRINT #undef PRINT
#define PRINT(msg) case (__COUNTER__ - StringMacroTracker1) : printMessage2(F(msg));break; #define PRINT(msg) case (__COUNTER__ - StringMacroTracker1) : printMessage2(F(msg));break;
#undef LCN #undef LCN
@ -170,6 +172,7 @@ const FLASH int16_t RMFT2::SignalDefinitions[] = {
#define ATTIMEOUT(sensor_id,timeout) OPCODE_ATTIMEOUT1,0,0,OPCODE_ATTIMEOUT2,V(sensor_id),OPCODE_PAD,V(timeout/100L), #define ATTIMEOUT(sensor_id,timeout) OPCODE_ATTIMEOUT1,0,0,OPCODE_ATTIMEOUT2,V(sensor_id),OPCODE_PAD,V(timeout/100L),
#define AUTOMATION(id, description) OPCODE_AUTOMATION, V(id), #define AUTOMATION(id, description) OPCODE_AUTOMATION, V(id),
#define AUTOSTART OPCODE_AUTOSTART,0,0, #define AUTOSTART OPCODE_AUTOSTART,0,0,
#define BROADCAST(msg) PRINT(msg)
#define CALL(route) OPCODE_CALL,V(route), #define CALL(route) OPCODE_CALL,V(route),
#define CLOSE(id) OPCODE_CLOSE,V(id), #define CLOSE(id) OPCODE_CLOSE,V(id),
#define DEACTIVATE(addr,subaddr) OPCODE_DCCACTIVATE,V(addr<<3 | subaddr<<1), #define DEACTIVATE(addr,subaddr) OPCODE_DCCACTIVATE,V(addr<<3 | subaddr<<1),

View File

@ -1 +1 @@
#define GITHUB_SHA "58ef7d2" #define GITHUB_SHA "a26d988"

291
config.json Normal file
View File

@ -0,0 +1,291 @@
[
{
"Name": "BaseStationClassic",
"Git": "DCC-EX/BaseStation-Classic",
"Libraries": [
{
"Name": "Ethernet",
"Repo": "arduino-libraries/Ethernet",
"Location": "libraries/Ethernet",
"LibraryDownloadAvailable": true
}
],
"SupportedBoards": [
{
"Name": "Uno",
"FQBN": "arduino:avr:uno",
"Platforms": [
{
"Architecture": "avr",
"Package": "arduino"
}
],
"SupportedMotoShields": [
{
"Name": "Arduino Motor Shield",
"ShieldType": 0
},
{
"Name": "Pololu MC33926 Motor Shield",
"ShieldType": 1
}
],
"ExtraLibraries": [
]
},
{
"Name": "Mega",
"FQBN": "arduino:avr:mega",
"Platforms": [
{
"Architecture": "avr",
"Package": "arduino"
}
],
"SupportedMotoShields": [
{
"Name": "Arduino Motor Shield",
"ShieldType": 0
},
{
"Name": "Pololu MC33926 Motor Shield",
"ShieldType": 1
}
],
"ExtraLibraries": [
]
}
],
"DisplayName": "Base Station Classic",
"InputFileLocation": "DCCpp",
"AllowAdvanced": false,
"ConfigFile": "DCCpp/Config.h"
},
{
"Name": "CommandStation-EX",
"Git": "DCC-EX/CommandStation-EX",
"Libraries": [
{
"Name": "Ethernet",
"Repo": "arduino-libraries/Ethernet",
"Location": "libraries/Ethernet",
"LibraryDownloadAvailable": true
},
{
"Name": "DIO2",
"Repo": "",
"Location": "libraries/DIO2",
"LibraryDownloadAvailable": true
}
],
"SupportedBoards": [
{
"Name": "Uno",
"FQBN": "arduino:avr:uno",
"Platforms": [
{
"Architecture": "avr",
"Package": "arduino"
}
],
"SupportedMotoShields": [
{
"Name": "Arduino Motor Shield",
"ShieldType": 0
},
{
"Name": "Pololu MC33926 Motor Shield",
"ShieldType": 1
}
],
"ExtraLibraries": [
]
},
{
"Name": "Mega",
"FQBN": "arduino:avr:mega",
"Platforms": [
{
"Architecture": "avr",
"Package": "arduino"
}
],
"SupportedMotoShields": [
{
"Name": "Arduino Motor Shield",
"ShieldType": 0
},
{
"Name": "Pololu MC33926 Motor Shield",
"ShieldType": 1
}
],
"ExtraLibraries": [
]
},
{
"Name": "Mega Wifi",
"FQBN": "arduino:avr:mega",
"Platforms": [
{
"Architecture": "avr",
"Package": "arduino"
}
],
"SupportedMotoShields": [
{
"Name": "Arduino Motor Shield",
"ShieldType": 0
},
{
"Name": "Pololu MC33926 Motor Shield",
"ShieldType": 1
}
],
"ExtraLibraries": [
]
},
{
"Name": "Nano",
"FQBN": "arduino:avr:mega",
"Platforms": [
{
"Architecture": "avr",
"Package": "arduino"
}
],
"SupportedMotoShields": [
{
"Name": "Arduino Motor Shield",
"ShieldType": 0
},
{
"Name": "Pololu MC33926 Motor Shield",
"ShieldType": 1
}
],
"ExtraLibraries": [
]
},
{
"Name": "Nano Every",
"FQBN": "arduino:avr:mega",
"Platforms": [
{
"Architecture": "avr",
"Package": "arduino"
}
],
"SupportedMotoShields": [
{
"Name": "Arduino Motor Shield",
"ShieldType": 0
},
{
"Name": "Pololu MC33926 Motor Shield",
"ShieldType": 1
}
],
"ExtraLibraries": [
]
},
{
"Name": "Teensy 3.x",
"FQBN": "arduino:avr:mega",
"Platforms": [
{
"Architecture": "avr",
"Package": "arduino"
}
],
"SupportedMotoShields": [
{
"Name": "Arduino Motor Shield",
"ShieldType": 0
},
{
"Name": "Pololu MC33926 Motor Shield",
"ShieldType": 1
}
],
"ExtraLibraries": [
]
},
{
"Name": "Teensy 4.x",
"FQBN": "arduino:avr:mega",
"Platforms": [
{
"Architecture": "avr",
"Package": "arduino"
}
],
"SupportedMotoShields": [
{
"Name": "Arduino Motor Shield",
"ShieldType": 0
},
{
"Name": "Pololu MC33926 Motor Shield",
"ShieldType": 1
}
],
"ExtraLibraries": [
]
},
{
"Name": "SAMD21",
"FQBN": "SparkFun:samd",
"Platforms": [
{
"Architecture": "avr",
"Package": "arduino"
},
{
"Architecture": "samd",
"Package": "arduino"
},
{
"Architecture": "samd",
"Package": "SparkFun"
}
],
"SupportedMotoShields": [
{
"Name": "Arduino Motor Shield",
"ShieldType": 0
},
{
"Name": "Pololu MC33926 Motor Shield",
"ShieldType": 1
},
{
"Name": "FireBox MK1",
"ShieldType": 3
},
{
"Name": "FireBox MK1S",
"ShieldType": 4
}
],
"ExtraLibraries": [
]
}
],
"DisplayName": "CommandStation EX",
"InputFileLocation": "",
"AllowAdvanced": true,
"ConfigFile": "config.h"
}
]