mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-12-24 05:11:24 +01:00
Merge branch 'Broadcast' into EXRAILPlus
This commit is contained in:
commit
c15d536e9b
@ -492,10 +492,10 @@ void DCCEXParser::parse(Print *stream, byte *com, RingStream * ringStream)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
case '+': // Complex Wifi interface command (not usual parse)
|
case '+': // Complex Wifi interface command (not usual parse)
|
||||||
if (atCommandCallback) {
|
if (atCommandCallback && !ringStream) {
|
||||||
DCCWaveform::mainTrack.setPowerMode(POWERMODE::OFF);
|
DCCWaveform::mainTrack.setPowerMode(POWERMODE::OFF);
|
||||||
DCCWaveform::progTrack.setPowerMode(POWERMODE::OFF);
|
DCCWaveform::progTrack.setPowerMode(POWERMODE::OFF);
|
||||||
atCommandCallback(com);
|
atCommandCallback(stream,com);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#include "RingStream.h"
|
#include "RingStream.h"
|
||||||
|
|
||||||
typedef void (*FILTER_CALLBACK)(Print * stream, byte & opcode, byte & paramCount, int16_t p[]);
|
typedef void (*FILTER_CALLBACK)(Print * stream, byte & opcode, byte & paramCount, int16_t p[]);
|
||||||
typedef void (*AT_COMMAND_CALLBACK)(const byte * command);
|
typedef void (*AT_COMMAND_CALLBACK)(Print * stream,const byte * command);
|
||||||
|
|
||||||
struct DCCEXParser
|
struct DCCEXParser
|
||||||
{
|
{
|
||||||
|
@ -757,6 +757,7 @@ void RMFT2::loop2() {
|
|||||||
|
|
||||||
case OPCODE_UNJOIN:
|
case OPCODE_UNJOIN:
|
||||||
DCC::setProgTrackSyncMain(false);
|
DCC::setProgTrackSyncMain(false);
|
||||||
|
CommandDistributor::broadcastPower();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OPCODE_READ_LOCO1: // READ_LOCO is implemented as 2 separate opcodes
|
case OPCODE_READ_LOCO1: // READ_LOCO is implemented as 2 separate opcodes
|
||||||
|
@ -316,12 +316,38 @@ wifiSerialState WifiInterface::setup2(const FSH* SSid, const FSH* password,
|
|||||||
|
|
||||||
|
|
||||||
// This function is used to allow users to enter <+ commands> through the DCCEXParser
|
// This function is used to allow users to enter <+ commands> through the DCCEXParser
|
||||||
|
// <+command> sends AT+command to the ES and returns to the caller.
|
||||||
// Once the user has made whatever changes to the AT commands, a <+X> command can be used
|
// Once the user has made whatever changes to the AT commands, a <+X> command can be used
|
||||||
// to force on the connectd flag so that the loop will start picking up wifi traffic.
|
// to force on the connectd flag so that the loop will start picking up wifi traffic.
|
||||||
// If the settings are corrupted <+RST> will clear this and then you must restart the arduino.
|
// If the settings are corrupted <+RST> will clear this and then you must restart the arduino.
|
||||||
|
|
||||||
void WifiInterface::ATCommand(const byte * command) {
|
// Using the <+> command with no command string causes the code to enter an echo loop so that all
|
||||||
|
// input is directed to the ES and all ES output written to the USB Serial.
|
||||||
|
// The sequence "!!!" returns the Arduino to the normal loop mode
|
||||||
|
|
||||||
|
|
||||||
|
void WifiInterface::ATCommand(HardwareSerial * stream,const byte * command) {
|
||||||
command++;
|
command++;
|
||||||
|
if (*command=='\0') { // User gave <+> command
|
||||||
|
stream->print(F("\nES AT command passthrough mode, use ! to exit\n"));
|
||||||
|
while(stream->available()) stream->read(); // Drain serial input first
|
||||||
|
bool startOfLine=true;
|
||||||
|
while(true) {
|
||||||
|
while (wifiStream->available()) stream->write(wifiStream->read());
|
||||||
|
if (stream->available()) {
|
||||||
|
int cx=stream->read();
|
||||||
|
// A newline followed by !!! is an exit
|
||||||
|
if (cx=='\n' || cx=='\r') startOfLine=true;
|
||||||
|
else if (startOfLine && cx=='!') break;
|
||||||
|
else startOfLine=false;
|
||||||
|
stream->write(cx);
|
||||||
|
wifiStream->write(cx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stream->print(F("Passthrough Ended"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (*command=='X') {
|
if (*command=='X') {
|
||||||
connected = true;
|
connected = true;
|
||||||
DIAG(F("++++++ Wifi Connction forced on ++++++++"));
|
DIAG(F("++++++ Wifi Connction forced on ++++++++"));
|
||||||
|
@ -37,7 +37,7 @@ public:
|
|||||||
const int port,
|
const int port,
|
||||||
const byte channel);
|
const byte channel);
|
||||||
static void loop();
|
static void loop();
|
||||||
static void ATCommand(const byte *command);
|
static void ATCommand(HardwareSerial * stream,const byte *command);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static wifiSerialState setup(Stream &setupStream, const FSH *SSSid, const FSH *password,
|
static wifiSerialState setup(Stream &setupStream, const FSH *SSSid, const FSH *password,
|
||||||
|
Loading…
Reference in New Issue
Block a user