mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-22 23:56:13 +01:00
Withrottle connect improvements
This commit is contained in:
parent
576e1fe11c
commit
789b72a170
|
@ -131,7 +131,8 @@ void WiThrottle::parse(RingStream * stream, byte * cmdx) {
|
||||||
else if (!heartrateSent) {
|
else if (!heartrateSent) {
|
||||||
heartrateSent=true;
|
heartrateSent=true;
|
||||||
// allow heartbeat to slow down once all metadata sent
|
// allow heartbeat to slow down once all metadata sent
|
||||||
StringFormatter::send(stream,F("*%d\n"),HEARTBEAT_SECONDS);
|
StringFormatter::send(stream,F("*%d\nHMConnected\n"),HEARTBEAT_SECONDS);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,7 +188,7 @@ void WiThrottle::parse(RingStream * stream, byte * cmdx) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'N': // Heartbeat (2), only send if connection completed by 'HU' message
|
case 'N': // Heartbeat (2), only send if connection completed by 'HU' message
|
||||||
StringFormatter::send(stream, F("*%d\n"), heartrateSent ? HEARTBEAT_SECONDS : HEARTBEAT_SECONDS/2); // return timeout value
|
StringFormatter::send(stream, F("*%d\n"), heartrateSent ? HEARTBEAT_SECONDS : HEARTBEAT_PRELOAD); // return timeout value
|
||||||
break;
|
break;
|
||||||
case 'M': // multithrottle
|
case 'M': // multithrottle
|
||||||
multithrottle(stream, cmd);
|
multithrottle(stream, cmd);
|
||||||
|
@ -500,8 +501,8 @@ void WiThrottle::sendIntro(Print* stream) {
|
||||||
StringFormatter::send(stream,F("HtDCC-EX v%S, %S, %S, %S\n"), F(VERSION), F(ARDUINO_TYPE), DCC::getMotorShieldName(), F(GITHUB_SHA));
|
StringFormatter::send(stream,F("HtDCC-EX v%S, %S, %S, %S\n"), F(VERSION), F(ARDUINO_TYPE), DCC::getMotorShieldName(), F(GITHUB_SHA));
|
||||||
StringFormatter::send(stream,F("PTT]\\[Turnouts}|{Turnout]\\[THROW}|{2]\\[CLOSE}|{4\n"));
|
StringFormatter::send(stream,F("PTT]\\[Turnouts}|{Turnout]\\[THROW}|{2]\\[CLOSE}|{4\n"));
|
||||||
StringFormatter::send(stream,F("PPA%x\n"),TrackManager::getMainPower()==POWERMODE::ON);
|
StringFormatter::send(stream,F("PPA%x\n"),TrackManager::getMainPower()==POWERMODE::ON);
|
||||||
// set heartbeat to 5 seconds because we need to sync the metadata (1 second is too short!)
|
// set heartbeat to 2 seconds because we need to sync the metadata (1 second is too short!)
|
||||||
StringFormatter::send(stream,F("*%d\n"), HEARTBEAT_SECONDS/2);
|
StringFormatter::send(stream,F("*%d\nHMConnecting..\n"), HEARTBEAT_PRELOAD);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WiThrottle::sendTurnouts(Print* stream) {
|
void WiThrottle::sendTurnouts(Print* stream) {
|
||||||
|
|
|
@ -45,7 +45,8 @@ class WiThrottle {
|
||||||
~WiThrottle();
|
~WiThrottle();
|
||||||
|
|
||||||
static const int MAX_MY_LOCO=10; // maximum number of locos assigned to a single client
|
static const int MAX_MY_LOCO=10; // maximum number of locos assigned to a single client
|
||||||
static const int HEARTBEAT_SECONDS=10; // heartbeat at 4secs to provide messaging transport
|
static const int HEARTBEAT_SECONDS=10; // heartbeat at 10 secs to provide messaging transport
|
||||||
|
static const int HEARTBEAT_PRELOAD=2; // request fast callback when connecting multiple messages
|
||||||
static const int ESTOP_SECONDS=20; // eStop if no incoming messages for more than 8secs
|
static const int ESTOP_SECONDS=20; // eStop if no incoming messages for more than 8secs
|
||||||
static WiThrottle* firstThrottle;
|
static WiThrottle* firstThrottle;
|
||||||
static int getInt(byte * cmd);
|
static int getInt(byte * cmd);
|
||||||
|
|
|
@ -31,7 +31,6 @@ WifiInboundHandler * WifiInboundHandler::singleton;
|
||||||
|
|
||||||
void WifiInboundHandler::setup(Stream * ESStream) {
|
void WifiInboundHandler::setup(Stream * ESStream) {
|
||||||
singleton=new WifiInboundHandler(ESStream);
|
singleton=new WifiInboundHandler(ESStream);
|
||||||
// DIAG(F("WifiInbound Setup2 %P %P"), ESStream,singleton);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WifiInboundHandler::loop() {
|
void WifiInboundHandler::loop() {
|
||||||
|
@ -45,7 +44,6 @@ WifiInboundHandler::WifiInboundHandler(Stream * ESStream) {
|
||||||
inboundRing=new RingStream(INBOUND_RING);
|
inboundRing=new RingStream(INBOUND_RING);
|
||||||
outboundRing=new RingStream(OUTBOUND_RING);
|
outboundRing=new RingStream(OUTBOUND_RING);
|
||||||
pendingCipsend=false;
|
pendingCipsend=false;
|
||||||
// DIAG(F("WifiInbound setup1 %P"), wifiStream);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -53,20 +51,13 @@ WifiInboundHandler::WifiInboundHandler(Stream * ESStream) {
|
||||||
// +IPD,x,lll:data is stored in streamer[x]
|
// +IPD,x,lll:data is stored in streamer[x]
|
||||||
// Other input returns
|
// Other input returns
|
||||||
void WifiInboundHandler::loop1() {
|
void WifiInboundHandler::loop1() {
|
||||||
static bool XX=true;
|
|
||||||
if (XX) DIAG(F("Wifi 1"));
|
|
||||||
|
|
||||||
// First handle all inbound traffic events because they will block the sending
|
// First handle all inbound traffic events because they will block the sending
|
||||||
if (loop2()!=INBOUND_IDLE) {
|
if (loop2()!=INBOUND_IDLE) return;
|
||||||
if (XX) DIAG(F("Wifi 2"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (XX) DIAG(F("Wifi 3"));
|
|
||||||
|
|
||||||
WiThrottle::loop(outboundRing);
|
WiThrottle::loop(outboundRing);
|
||||||
if (XX) DIAG(F("Wifi 4"));
|
|
||||||
XX=false;
|
// if nothing is already CIPSEND pending, we can CIPSEND one reply
|
||||||
// if nothing is already CIPSEND pending, we can CIPSEND one reply
|
|
||||||
if (clientPendingCIPSEND<0) {
|
if (clientPendingCIPSEND<0) {
|
||||||
clientPendingCIPSEND=outboundRing->read();
|
clientPendingCIPSEND=outboundRing->read();
|
||||||
if (clientPendingCIPSEND>=0) {
|
if (clientPendingCIPSEND>=0) {
|
||||||
|
@ -97,9 +88,6 @@ if (XX) DIAG(F("Wifi 3"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// This is a Finite State Automation (FSA) handling the inbound bytes from an ES AT command processor
|
// This is a Finite State Automation (FSA) handling the inbound bytes from an ES AT command processor
|
||||||
|
|
||||||
WifiInboundHandler::INBOUND_STATE WifiInboundHandler::loop2() {
|
WifiInboundHandler::INBOUND_STATE WifiInboundHandler::loop2() {
|
||||||
|
|
|
@ -4,7 +4,10 @@
|
||||||
#include "StringFormatter.h"
|
#include "StringFormatter.h"
|
||||||
|
|
||||||
|
|
||||||
#define VERSION "4.2.7a"
|
#define VERSION "4.2.9"
|
||||||
|
// 4.2.9 Withrottle connecting improvements
|
||||||
|
// 4.2.8 Report board type when provided
|
||||||
|
// 4.2.7 Cleanup wifi disconnect issues and highmem
|
||||||
// 4.2.6 FIX: Remove RAM thief
|
// 4.2.6 FIX: Remove RAM thief
|
||||||
// FIX: ADC port 8-15 fix
|
// FIX: ADC port 8-15 fix
|
||||||
// 4.2.5 Make GETFLASHW code more universal
|
// 4.2.5 Make GETFLASHW code more universal
|
||||||
|
|
Loading…
Reference in New Issue
Block a user