mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-23 16:16:13 +01:00
Compare commits
No commits in common. "cfd04ad5c7f991f32ce82e3d23bf99bb1344a819" and "bbba53f3d1682e376b1b807cbc613d14b6a0311b" have entirely different histories.
cfd04ad5c7
...
bbba53f3d1
|
@ -1117,21 +1117,6 @@ bool DCCEXParser::parseD(Print *stream, int16_t params, int16_t p[])
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
#ifdef HAS_ENOUGH_MEMORY
|
#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>
|
case "WIFI"_hk: // <D WIFI ON/OFF>
|
||||||
Diag::WIFI = onOff;
|
Diag::WIFI = onOff;
|
||||||
return true;
|
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
|
// The resets will be zero not only now but as well repeats packets into the future
|
||||||
clearResets(repeats+1);
|
clearResets(repeats+1);
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret;
|
||||||
do {
|
do {
|
||||||
if(isMainTrack) {
|
if(isMainTrack) {
|
||||||
if (rmtMainChannel != NULL)
|
if (rmtMainChannel != NULL)
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
#define GITHUB_SHA "devel-z21-202404012202Z"
|
#define GITHUB_SHA "devel-z21-202404011058Z"
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with CommandStation. If not, see <https://www.gnu.org/licenses/>.
|
* along with CommandStation. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#ifdef Z21_PROTOCOL
|
|
||||||
#include <WiFi.h>
|
#include <WiFi.h>
|
||||||
#include <WiFiClient.h>
|
#include <WiFiClient.h>
|
||||||
|
|
||||||
|
@ -36,4 +35,3 @@ public:
|
||||||
|
|
||||||
static WiFiUDP client;
|
static WiFiUDP client;
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
|
@ -25,9 +25,9 @@ bool Diag::ACK=false;
|
||||||
bool Diag::CMD=false;
|
bool Diag::CMD=false;
|
||||||
bool Diag::WIFI=false;
|
bool Diag::WIFI=false;
|
||||||
bool Diag::WITHROTTLE=false;
|
bool Diag::WITHROTTLE=false;
|
||||||
bool Diag::Z21THROTTLE=false;
|
bool Diag::Z21THROTTLE=true;
|
||||||
bool Diag::Z21THROTTLEVERBOSE=false;
|
bool Diag::Z21THROTTLEVERBOSE=true;
|
||||||
bool Diag::Z21THROTTLEDATA=false;
|
bool Diag::Z21THROTTLEDATA=true;
|
||||||
bool Diag::ETHERNET=false;
|
bool Diag::ETHERNET=false;
|
||||||
bool Diag::LCN=false;
|
bool Diag::LCN=false;
|
||||||
|
|
||||||
|
|
|
@ -123,6 +123,7 @@
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define DIAG_IO
|
||||||
// Static setClosed function is invoked from close(), throw() etc. to perform the
|
// 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
|
// 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
|
// type should be placed in the virtual function setClosedInternal(bool) which is
|
||||||
|
|
|
@ -707,43 +707,27 @@ bool Z21Throttle::parse(byte *networkPacket, int len) {
|
||||||
|
|
||||||
int lengthData = GETINT16(p);
|
int lengthData = GETINT16(p);
|
||||||
l -= lengthData;
|
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) {
|
if (p == networkPacket && lengthData != len) {
|
||||||
diagPacket(networkPacket, len);
|
diagPacket(networkPacket, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is a client error, report always
|
|
||||||
if (l < 0) {
|
if (l < 0) {
|
||||||
DIAG(F("ERROR: Xbus data exceeds UDP packet size: l < 0 pos=%d, l=%d"), p-networkPacket, l);
|
DIAG(F("ERROR: Xbus data exceeds UDP packet size: l < 0 pos=%d, l=%d"), p-networkPacket, l);
|
||||||
diagPacket(p, len);
|
diagPacket(p, len);
|
||||||
return false;
|
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) {
|
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"),
|
DIAG(F("WARNING: Xbus data does not fill UDP packet size: l > 0 pos=%d, l=%d, lengthData=%d"),
|
||||||
p-networkPacket, l, lengthData);
|
p-networkPacket, l, lengthData);
|
||||||
diagPacket(p, len);
|
diagPacket(p, len);
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// length of the data = total length - length of length (!) - length of header
|
// length of the data = total length - length of length (!) - length of header
|
||||||
// Error, this should not happen
|
|
||||||
lengthData -= 4;
|
lengthData -= 4;
|
||||||
if (lengthData < 0) {
|
if (lengthData < 0) {
|
||||||
DIAG(F("ERROR: lengthData < 0 SHOULD NOT GET HERE"));
|
DIAG(F("ERROR: lengthData < 0 SHOULD NOT GET HERE"));
|
||||||
diagPacket(networkPacket, len);
|
diagPacket(networkPacket, len);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// All checks done, start looking at packet content
|
|
||||||
p += 2;
|
p += 2;
|
||||||
Header = GETINT16(p);
|
Header = GETINT16(p);
|
||||||
p += 2;
|
p += 2;
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
#include "StringFormatter.h"
|
#include "StringFormatter.h"
|
||||||
|
|
||||||
#define VERSION "5.X.Y"
|
#define VERSION "5.X.Y"
|
||||||
// Make Z21 diag selectable from DCCEXParser
|
|
||||||
// Z21 error fix for turnout feedback
|
// Z21 error fix for turnout feedback
|
||||||
// Z21 add turnout and sensor broadcasts
|
// Z21 add turnout and sensor broadcasts
|
||||||
// Z21: report the (unchanged) loco mode back after every attempted change
|
// Z21: report the (unchanged) loco mode back after every attempted change
|
||||||
|
|
Loading…
Reference in New Issue
Block a user