mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-23 16:16:13 +01:00
Compare commits
5 Commits
bbba53f3d1
...
cfd04ad5c7
Author | SHA1 | Date | |
---|---|---|---|
|
cfd04ad5c7 | ||
|
501238d894 | ||
|
dd2a916c83 | ||
|
d21aef533b | ||
|
7ebbe8bed2 |
|
@ -1117,6 +1117,21 @@ bool DCCEXParser::parseD(Print *stream, int16_t params, int16_t p[])
|
|||
return true;
|
||||
|
||||
#ifdef HAS_ENOUGH_MEMORY
|
||||
#ifdef Z21_PROTOCOL
|
||||
case "Z21THROTTLE"_hk: // <D Z21THROTTLE ON/OFF>
|
||||
case "Z21THR"_hk: // <D Z21THR ON/OFF>
|
||||
Diag::Z21THROTTLE = onOff;
|
||||
return true;
|
||||
case "Z21THROTTLEVERBOSE"_hk: // <D Z21THROTTLEVERBOSE ON/OFF>
|
||||
case "Z21THRV"_hk: // <D Z21THV ON/OFF>
|
||||
Diag::Z21THROTTLEVERBOSE = onOff;
|
||||
return true;
|
||||
case "Z21THROTTLEDATA"_hk: // <D Z21THROTTLEDATA ON/OFF>
|
||||
case "Z21THRD"_hk: // <D Z21THD ON/OFF>
|
||||
Diag::Z21THROTTLEDATA = onOff;
|
||||
return true;
|
||||
#endif // Z21_PROTOCOL
|
||||
|
||||
case "WIFI"_hk: // <D WIFI ON/OFF>
|
||||
Diag::WIFI = onOff;
|
||||
return true;
|
||||
|
|
|
@ -294,7 +294,7 @@ void DCCWaveform::schedulePacket(const byte buffer[], byte byteCount, byte repea
|
|||
// The resets will be zero not only now but as well repeats packets into the future
|
||||
clearResets(repeats+1);
|
||||
{
|
||||
int ret;
|
||||
int ret = 0;
|
||||
do {
|
||||
if(isMainTrack) {
|
||||
if (rmtMainChannel != NULL)
|
||||
|
|
|
@ -1 +1 @@
|
|||
#define GITHUB_SHA "devel-z21-202404011058Z"
|
||||
#define GITHUB_SHA "devel-z21-202404012202Z"
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
* You should have received a copy of the GNU General Public License
|
||||
* along with CommandStation. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifdef Z21_PROTOCOL
|
||||
#include <WiFi.h>
|
||||
#include <WiFiClient.h>
|
||||
|
||||
|
@ -35,3 +36,4 @@ public:
|
|||
|
||||
static WiFiUDP client;
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -25,9 +25,9 @@ bool Diag::ACK=false;
|
|||
bool Diag::CMD=false;
|
||||
bool Diag::WIFI=false;
|
||||
bool Diag::WITHROTTLE=false;
|
||||
bool Diag::Z21THROTTLE=true;
|
||||
bool Diag::Z21THROTTLEVERBOSE=true;
|
||||
bool Diag::Z21THROTTLEDATA=true;
|
||||
bool Diag::Z21THROTTLE=false;
|
||||
bool Diag::Z21THROTTLEVERBOSE=false;
|
||||
bool Diag::Z21THROTTLEDATA=false;
|
||||
bool Diag::ETHERNET=false;
|
||||
bool Diag::LCN=false;
|
||||
|
||||
|
|
|
@ -123,7 +123,6 @@
|
|||
return true;
|
||||
}
|
||||
|
||||
#define DIAG_IO
|
||||
// Static setClosed function is invoked from close(), throw() etc. to perform the
|
||||
// common parts of the turnout operation. Code which is specific to a turnout
|
||||
// type should be placed in the virtual function setClosedInternal(bool) which is
|
||||
|
|
|
@ -707,27 +707,43 @@ bool Z21Throttle::parse(byte *networkPacket, int len) {
|
|||
|
||||
int lengthData = GETINT16(p);
|
||||
l -= lengthData;
|
||||
|
||||
// This is not an error, just several X bus packets in one UDP packet
|
||||
if (Diag::Z21THROTTLEDATA) // only care if diag is on
|
||||
if (p == networkPacket && lengthData != len) {
|
||||
diagPacket(networkPacket, len);
|
||||
}
|
||||
|
||||
// This is a client error, report always
|
||||
if (l < 0) {
|
||||
DIAG(F("ERROR: Xbus data exceeds UDP packet size: l < 0 pos=%d, l=%d"), p-networkPacket, l);
|
||||
diagPacket(p, len);
|
||||
return false;
|
||||
}
|
||||
|
||||
// This is kinda client error but not harmful
|
||||
// Report if diag and we are done with parsing this UDP packet
|
||||
if (l > 0 && lengthData < 4) {
|
||||
// The client did send a too long UDP packet which was not filled with X bus packet(s)
|
||||
// The Z21 App does this sometimes
|
||||
if (Diag::Z21THROTTLEDATA) {
|
||||
DIAG(F("WARNING: Xbus data does not fill UDP packet size: l > 0 pos=%d, l=%d, lengthData=%d"),
|
||||
p-networkPacket, l, lengthData);
|
||||
diagPacket(p, len);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// length of the data = total length - length of length (!) - length of header
|
||||
// Error, this should not happen
|
||||
lengthData -= 4;
|
||||
if (lengthData < 0) {
|
||||
DIAG(F("ERROR: lengthData < 0 SHOULD NOT GET HERE"));
|
||||
diagPacket(networkPacket, len);
|
||||
return false;
|
||||
}
|
||||
|
||||
// All checks done, start looking at packet content
|
||||
p += 2;
|
||||
Header = GETINT16(p);
|
||||
p += 2;
|
||||
|
|
Loading…
Reference in New Issue
Block a user