mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-24 08:36:14 +01:00
Compare commits
4 Commits
306e071b70
...
31508b641d
Author | SHA1 | Date | |
---|---|---|---|
|
31508b641d | ||
|
b5d9798144 | ||
|
566ce1b7f8 | ||
|
2afb5f3d6c |
|
@ -105,6 +105,7 @@ void CommandDistributor::parse(byte clientId,byte * buffer, RingStream * stream
|
|||
void CommandDistributor::forget(byte clientId) {
|
||||
if (clients[clientId]==WITHROTTLE_TYPE) WiThrottle::forget(clientId);
|
||||
clients[clientId]=NONE_TYPE;
|
||||
if (virtualLCDClient==clientId) virtualLCDClient=RingStream::NO_CLIENT;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -285,3 +286,51 @@ void CommandDistributor::broadcastRouteState(uint16_t routeId, byte state ) {
|
|||
void CommandDistributor::broadcastRouteCaption(uint16_t routeId, const FSH* caption ) {
|
||||
broadcastReply(COMMAND_TYPE, F("<jB %d \"%S\">\n"),routeId,caption);
|
||||
}
|
||||
|
||||
Print * CommandDistributor::getVirtualLCDSerial(byte screen, byte row) {
|
||||
Print * stream=virtualLCDSerial;
|
||||
#ifdef CD_HANDLE_RING
|
||||
rememberVLCDClient=RingStream::NO_CLIENT;
|
||||
if (!stream && virtualLCDClient!=RingStream::NO_CLIENT) {
|
||||
// If we are broadcasting from a wifi/eth process we need to complete its output
|
||||
// before merging broadcasts in the ring, then reinstate it in case
|
||||
// the process continues to output to its client.
|
||||
if ((rememberVLCDClient = ring->peekTargetMark()) != RingStream::NO_CLIENT) {
|
||||
ring->commit();
|
||||
}
|
||||
ring->mark(virtualLCDClient);
|
||||
stream=ring;
|
||||
}
|
||||
#endif
|
||||
if (stream) StringFormatter::send(stream,F("<@ %d %d \""), screen,row);
|
||||
return stream;
|
||||
}
|
||||
|
||||
void CommandDistributor::commitVirtualLCDSerial() {
|
||||
#ifdef CD_HANDLE_RING
|
||||
if (virtualLCDClient!=RingStream::NO_CLIENT) {
|
||||
StringFormatter::send(ring,F("\">\n"));
|
||||
ring->commit();
|
||||
if (rememberVLCDClient!=RingStream::NO_CLIENT) ring->mark(rememberVLCDClient);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
StringFormatter::send(virtualLCDSerial,F("\">\n"));
|
||||
}
|
||||
|
||||
void CommandDistributor::setVirtualLCDSerial(Print * stream) {
|
||||
#ifdef CD_HANDLE_RING
|
||||
virtualLCDClient=RingStream::NO_CLIENT;
|
||||
if (stream && stream->availableForWrite()==RingStream::THIS_IS_A_RINGSTREAM) {
|
||||
virtualLCDClient=((RingStream *) stream)->peekTargetMark();
|
||||
virtualLCDSerial=nullptr;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
virtualLCDSerial=stream;
|
||||
}
|
||||
|
||||
Print* CommandDistributor::virtualLCDSerial=nullptr;
|
||||
byte CommandDistributor::virtualLCDClient=0xFF;
|
||||
byte CommandDistributor::rememberVLCDClient=0;
|
||||
|
||||
|
|
|
@ -60,8 +60,15 @@ public :
|
|||
static void forget(byte clientId);
|
||||
static void broadcastRouteState(uint16_t routeId,byte state);
|
||||
static void broadcastRouteCaption(uint16_t routeId,const FSH * caption);
|
||||
|
||||
|
||||
// Handling code for virtual LCD receiver.
|
||||
static Print * getVirtualLCDSerial(byte screen, byte row);
|
||||
static void commitVirtualLCDSerial();
|
||||
static void setVirtualLCDSerial(Print * stream);
|
||||
private:
|
||||
static Print * virtualLCDSerial;
|
||||
static byte virtualLCDClient;
|
||||
static byte rememberVLCDClient;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -659,7 +659,7 @@ void DCCEXParser::parseOne(Print *stream, byte *com, RingStream * ringStream)
|
|||
return;
|
||||
break;
|
||||
#endif
|
||||
case '=': // TACK MANAGER CONTROL <= [params]>
|
||||
case '=': // TRACK MANAGER CONTROL <= [params]>
|
||||
if (TrackManager::parseJ(stream, params, p))
|
||||
return;
|
||||
break;
|
||||
|
@ -832,6 +832,10 @@ void DCCEXParser::parseOne(Print *stream, byte *com, RingStream * ringStream)
|
|||
case 'L': // LCC interface implemented in EXRAIL parser
|
||||
break; // Will <X> if not intercepted by EXRAIL
|
||||
|
||||
case '@': // JMRI saying "give me virtual LCD msgs"
|
||||
CommandDistributor::setVirtualLCDSerial(stream);
|
||||
return;
|
||||
|
||||
default: //anything else will diagnose and drop out to <X>
|
||||
DIAG(F("Opcode=%c params=%d"), opcode, params);
|
||||
for (int i = 0; i < params; i++)
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "StringFormatter.h"
|
||||
#include <stdarg.h>
|
||||
#include "DisplayInterface.h"
|
||||
#include "CommandDistributor.h"
|
||||
|
||||
bool Diag::ACK=false;
|
||||
bool Diag::CMD=false;
|
||||
|
@ -45,6 +46,14 @@ void StringFormatter::lcd(byte row, const FSH* input...) {
|
|||
send2(&USB_SERIAL,input,args);
|
||||
send(&USB_SERIAL,F(" *>\n"));
|
||||
|
||||
// send to virtual LCD collector (if any)
|
||||
Print * virtualLCD=CommandDistributor::getVirtualLCDSerial(0,row);
|
||||
if (virtualLCD) {
|
||||
va_start(args, input);
|
||||
send2(virtualLCD,input,args);
|
||||
CommandDistributor::commitVirtualLCDSerial();
|
||||
}
|
||||
|
||||
DisplayInterface::setRow(row);
|
||||
va_start(args, input);
|
||||
send2(DisplayInterface::getDisplayHandler(),input,args);
|
||||
|
@ -52,6 +61,14 @@ void StringFormatter::lcd(byte row, const FSH* input...) {
|
|||
|
||||
void StringFormatter::lcd2(uint8_t display, byte row, const FSH* input...) {
|
||||
va_list args;
|
||||
|
||||
// send to virtual LCD collector (if any)
|
||||
Print * virtualLCD=CommandDistributor::getVirtualLCDSerial(display,row);
|
||||
if (virtualLCD) {
|
||||
va_start(args, input);
|
||||
send2(virtualLCD,input,args);
|
||||
CommandDistributor::commitVirtualLCDSerial();
|
||||
}
|
||||
|
||||
DisplayInterface::setRow(display, row);
|
||||
va_start(args, input);
|
||||
|
|
|
@ -54,6 +54,5 @@ class StringFormatter
|
|||
private:
|
||||
static void send2(Print * serial, const FSH* input,va_list args);
|
||||
static void printPadded(Print* stream, long value, byte width, bool formatLeft);
|
||||
|
||||
};
|
||||
#endif
|
||||
|
|
13
version.h
13
version.h
|
@ -182,9 +182,18 @@
|
|||
// TrackManager DCC & DC up to 8 Districts Architecture
|
||||
// Automatic ALIAS(name)
|
||||
// Command Parser now accepts Underscore in Alias Names
|
||||
// 4.1.6 Support for new EX-MotorShield8874 Dual 5Amp Shield
|
||||
// 4.1.5 Bugfix LCN number parsing
|
||||
// 4.1.4 Bugfix for issue #299 Turnout Description NULL
|
||||
// 4.1.3 Bugfix: Ethernet init order
|
||||
// 4.1.2 Bugfix: Ethernet shield W5100 does not report HW or link level
|
||||
// 4.1.1 Bugfix: preserve turnout format
|
||||
// Bugfix: parse multiple commands in one buffer string correct
|
||||
// Bugfix: </> command signal status in Exrail
|
||||
// Bugfix: parse multiple commands in one buffer string correctly (ex: <s><Q>)
|
||||
// Bugfix: </> command signal status of EX-RAIL tasks or threads
|
||||
// Bugfix: EX-RAIL read long loco address
|
||||
// Bugfix: Add space character after version string 4.1.1 for JMRI parsing.
|
||||
// Improved display and loop time for signals make service start to be outside the DONT_TOUCH_WIFI_CONF area
|
||||
// Improve WiFi startup by making service start to be outside the DONT_TOUCH_WIFI_CONF area
|
||||
// 4.1.0 ...
|
||||
//
|
||||
// 4.0.2 EXRAIL additions:
|
||||
|
|
Loading…
Reference in New Issue
Block a user