1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-24 08:36:14 +01:00

Compare commits

...

7 Commits

Author SHA1 Message Date
Kcsmith0708
858e28586f
Merge 2afb5f3d6c into f2ff1ba22a 2023-11-07 19:09:39 -08:00
Harald Barth
f2ff1ba22a version 5.1.19 2023-11-06 22:14:39 +01:00
Harald Barth
043e6fdb26 Only flag 2.2.0.0-dev as broken, not 2.2.0.0 2023-11-06 22:13:03 +01:00
Asbelos
24e0f189e1 fix TURNOUTL 2023-11-01 20:19:59 +00:00
Harald Barth
33b2820095 Bugfix version detection logic and better message 2023-10-28 19:21:29 +02:00
Harald Barth
7b3b16b211 Divide out C for config and D for diag commands 2023-10-23 11:45:52 +02:00
Kcsmith0708
2afb5f3d6c
Update version.h
Added Updated Versiom 4.1.1 thru 4.1.6
2023-08-24 14:57:57 -04:00
6 changed files with 76 additions and 45 deletions

View File

@ -49,7 +49,7 @@ Once a new OPCODE is decided upon, update this list.
b, Write CV bit on main b, Write CV bit on main
B, Write CV bit B, Write CV bit
c, Request current command c, Request current command
C, C, configure the CS
d, d,
D, Diagnostic commands D, Diagnostic commands
e, Erase EEPROM e, Erase EEPROM
@ -693,7 +693,7 @@ void DCCEXParser::parseOne(Print *stream, byte *com, RingStream * ringStream)
Sensor::printAll(stream); Sensor::printAll(stream);
return; return;
case 's': // <s> case 's': // STATUS <s>
StringFormatter::send(stream, F("<iDCC-EX V-%S / %S / %S G-%S>\n"), F(VERSION), F(ARDUINO_TYPE), DCC::getMotorShieldName(), F(GITHUB_SHA)); StringFormatter::send(stream, F("<iDCC-EX V-%S / %S / %S G-%S>\n"), F(VERSION), F(ARDUINO_TYPE), DCC::getMotorShieldName(), F(GITHUB_SHA));
CommandDistributor::broadcastPower(); // <s> is the only "get power status" command we have CommandDistributor::broadcastPower(); // <s> is the only "get power status" command we have
Turnout::printAll(stream); //send all Turnout states Turnout::printAll(stream); //send all Turnout states
@ -714,13 +714,17 @@ void DCCEXParser::parseOne(Print *stream, byte *com, RingStream * ringStream)
case ' ': // < > case ' ': // < >
StringFormatter::send(stream, F("\n")); StringFormatter::send(stream, F("\n"));
return; return;
case 'C': // CONFIG <C [params]>
if (parseC(stream, params, p))
return;
break;
#ifndef DISABLE_DIAG #ifndef DISABLE_DIAG
case 'D': // < > case 'D': // DIAG <D [params]>
if (parseD(stream, params, p)) if (parseD(stream, params, p))
return; return;
break; break;
#endif #endif
case '=': // <= Track manager control > case '=': // TACK MANAGER CONTROL <= [params]>
if (TrackManager::parseJ(stream, params, p)) if (TrackManager::parseJ(stream, params, p))
return; return;
break; break;
@ -1114,19 +1118,28 @@ bool DCCEXParser::parseS(Print *stream, int16_t params, int16_t p[])
return false; return false;
} }
bool DCCEXParser::parseD(Print *stream, int16_t params, int16_t p[]) bool DCCEXParser::parseC(Print *stream, int16_t params, int16_t p[]) {
{
if (params == 0) if (params == 0)
return false; return false;
bool onOff = (params > 0) && (p[1] == 1 || p[1] == HASH_KEYWORD_ON); // dont care if other stuff or missing... just means off bool onOff = (params > 0) && (p[1] == 1 || p[1] == HASH_KEYWORD_ON); // dont care if other stuff or missing... just means off
switch (p[0]) switch (p[0])
{ {
case HASH_KEYWORD_CABS: // <D CABS> #ifndef DISABLE_PROG
DCC::displayCabList(stream); case HASH_KEYWORD_PROGBOOST:
TrackManager::progTrackBoosted=true;
return true;
#endif
case HASH_KEYWORD_RESET:
DCCTimer::reset();
break; // and <X> if we didnt restart
case HASH_KEYWORD_SPEED28:
DCC::setGlobalSpeedsteps(28);
DIAG(F("28 Speedsteps"));
return true; return true;
case HASH_KEYWORD_RAM: // <D RAM> case HASH_KEYWORD_SPEED128:
StringFormatter::send(stream, F("Free memory=%d\n"), DCCTimer::getMinimumFreeMemory()); DCC::setGlobalSpeedsteps(128);
DIAG(F("128 Speedsteps"));
return true; return true;
#ifndef DISABLE_PROG #ifndef DISABLE_PROG
@ -1146,12 +1159,33 @@ bool DCCEXParser::parseD(Print *stream, int16_t params, int16_t p[])
LCD(0, F("Ack Retry=%d Sum=%d"), p[2], DCCACK::setAckRetry(p[2])); // <D ACK RETRY 2> LCD(0, F("Ack Retry=%d Sum=%d"), p[2], DCCACK::setAckRetry(p[2])); // <D ACK RETRY 2>
} }
} else { } else {
StringFormatter::send(stream, F("Ack diag %S\n"), onOff ? F("on") : F("off")); DIAG(F("Ack diag %S"), onOff ? F("on") : F("off"));
Diag::ACK = onOff; Diag::ACK = onOff;
} }
return true; return true;
#endif #endif
default: // invalid/unknown
break;
}
return false;
}
bool DCCEXParser::parseD(Print *stream, int16_t params, int16_t p[])
{
if (params == 0)
return false;
bool onOff = (params > 0) && (p[1] == 1 || p[1] == HASH_KEYWORD_ON); // dont care if other stuff or missing... just means off
switch (p[0])
{
case HASH_KEYWORD_CABS: // <D CABS>
DCC::displayCabList(stream);
return true;
case HASH_KEYWORD_RAM: // <D RAM>
DIAG(F("Free memory=%d"), DCCTimer::getMinimumFreeMemory());
return true;
case HASH_KEYWORD_CMD: // <D CMD ON/OFF> case HASH_KEYWORD_CMD: // <D CMD ON/OFF>
Diag::CMD = onOff; Diag::CMD = onOff;
return true; return true;
@ -1173,34 +1207,14 @@ bool DCCEXParser::parseD(Print *stream, int16_t params, int16_t p[])
Diag::LCN = onOff; Diag::LCN = onOff;
return true; return true;
#endif #endif
#ifndef DISABLE_PROG
case HASH_KEYWORD_PROGBOOST:
TrackManager::progTrackBoosted=true;
return true;
#endif
case HASH_KEYWORD_RESET:
DCCTimer::reset();
break; // and <X> if we didnt restart
#ifndef DISABLE_EEPROM #ifndef DISABLE_EEPROM
case HASH_KEYWORD_EEPROM: // <D EEPROM NumEntries> case HASH_KEYWORD_EEPROM: // <D EEPROM NumEntries>
if (params >= 2) if (params >= 2)
EEStore::dump(p[1]); EEStore::dump(p[1]);
return true; return true;
#endif #endif
case HASH_KEYWORD_SPEED28:
DCC::setGlobalSpeedsteps(28);
StringFormatter::send(stream, F("28 Speedsteps"));
return true;
case HASH_KEYWORD_SPEED128:
DCC::setGlobalSpeedsteps(128);
StringFormatter::send(stream, F("128 Speedsteps"));
return true;
case HASH_KEYWORD_SERVO: // <D SERVO vpin position [profile]> case HASH_KEYWORD_SERVO: // <D SERVO vpin position [profile]>
case HASH_KEYWORD_ANOUT: // <D ANOUT vpin position [profile]> case HASH_KEYWORD_ANOUT: // <D ANOUT vpin position [profile]>
IODevice::writeAnalogue(p[1], p[2], params>3 ? p[3] : 0); IODevice::writeAnalogue(p[1], p[2], params>3 ? p[3] : 0);
break; break;
@ -1223,7 +1237,7 @@ bool DCCEXParser::parseD(Print *stream, int16_t params, int16_t p[])
break; break;
default: // invalid/unknown default: // invalid/unknown
break; return parseC(stream, params, p);
} }
return false; return false;
} }

View File

@ -49,6 +49,7 @@ struct DCCEXParser
static bool parseZ(Print * stream, int16_t params, int16_t p[]); static bool parseZ(Print * stream, int16_t params, int16_t p[]);
static bool parseS(Print * stream, int16_t params, int16_t p[]); static bool parseS(Print * stream, int16_t params, int16_t p[]);
static bool parsef(Print * stream, int16_t params, int16_t p[]); static bool parsef(Print * stream, int16_t params, int16_t p[]);
static bool parseC(Print * stream, int16_t params, int16_t p[]);
static bool parseD(Print * stream, int16_t params, int16_t p[]); static bool parseD(Print * stream, int16_t params, int16_t p[]);
#ifndef IO_NO_HAL #ifndef IO_NO_HAL
static bool parseI(Print * stream, int16_t params, int16_t p[]); static bool parseI(Print * stream, int16_t params, int16_t p[]);

View File

@ -204,6 +204,8 @@ void RMFT2::printMessage(uint16_t id) {
#include "EXRAIL2MacroReset.h" #include "EXRAIL2MacroReset.h"
#undef TURNOUT #undef TURNOUT
#define TURNOUT(id,addr,subaddr,description...) O_DESC(id,description) #define TURNOUT(id,addr,subaddr,description...) O_DESC(id,description)
#undef TURNOUTL
#define TURNOUTL(id,addr,description...) O_DESC(id,description)
#undef PIN_TURNOUT #undef PIN_TURNOUT
#define PIN_TURNOUT(id,pin,description...) O_DESC(id,description) #define PIN_TURNOUT(id,pin,description...) O_DESC(id,description)
#undef SERVO_TURNOUT #undef SERVO_TURNOUT

View File

@ -1 +1 @@
#define GITHUB_SHA "devel-202309241855Z" #define GITHUB_SHA "devel-202310230944Z"

View File

@ -201,19 +201,21 @@ wifiSerialState WifiInterface::setup2(const FSH* SSid, const FSH* password,
// Display the AT version information // Display the AT version information
StringFormatter::send(wifiStream, F("AT+GMR\r\n")); StringFormatter::send(wifiStream, F("AT+GMR\r\n"));
if (checkForOK(2000, F("AT version:"), true, false)) { if (checkForOK(2000, F("AT version:"), true, false)) {
char version[] = "0.0.0.0"; char version[] = "0.0.0.0-xxx";
for (int i=0; i<8;i++) { for (int i=0; i<11;i++) {
while(!wifiStream->available()); while(!wifiStream->available());
version[i]=wifiStream->read(); version[i]=wifiStream->read();
StringFormatter::printEscape(version[i]); StringFormatter::printEscape(version[i]);
}
if ((version[0] == '0') || if ((version[0] == '0') ||
(version[0] == '2' && version[2] == '0') || (version[0] == '2' && version[2] == '0') ||
(version[0] == '2' && version[2] == '2' && version[4] == '0' && version[6] == '0')) { (version[0] == '2' && version[2] == '2' && version[4] == '0' && version[6] == '0'
SSid = F("DCCEX_SAYS_BROKEN_FIRMWARE"); && version[7] == '-' && version[8] == 'd' && version[9] == 'e' && version[10] == 'v')) {
DIAG(F("You need to up/downgrade the ESP firmware"));
SSid = F("UPDATE_ESP_FIRMWARE");
forceAP = true; forceAP = true;
} }
} }
}
checkForOK(2000, true, false); checkForOK(2000, true, false);
#ifdef DONT_TOUCH_WIFI_CONF #ifdef DONT_TOUCH_WIFI_CONF

View File

@ -3,7 +3,10 @@
#include "StringFormatter.h" #include "StringFormatter.h"
#define VERSION "5.1.16" #define VERSION "5.1.19"
// 5.1.19 - Only flag 2.2.0.0-dev as broken, not 2.2.0.0
// 5.1.18 - TURNOUTL bugfix
// 5.1.17 - Divide out C for config and D for diag commands
// 5.1.16 - Remove I2C address from EXTT_TURNTABLE macro to work with MUX, requires separate HAL macro to create // 5.1.16 - Remove I2C address from EXTT_TURNTABLE macro to work with MUX, requires separate HAL macro to create
// 5.1.15 - LCC/Adapter support and Exrail feature-compile-out. // 5.1.15 - LCC/Adapter support and Exrail feature-compile-out.
// 5.1.14 - Fixed IFTTPOSITION // 5.1.14 - Fixed IFTTPOSITION
@ -175,9 +178,18 @@
// TrackManager DCC & DC up to 8 Districts Architecture // TrackManager DCC & DC up to 8 Districts Architecture
// Automatic ALIAS(name) // Automatic ALIAS(name)
// Command Parser now accepts Underscore in Alias Names // 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 // 4.1.1 Bugfix: preserve turnout format
// Bugfix: parse multiple commands in one buffer string correct // Bugfix: parse multiple commands in one buffer string correctly (ex: <s><Q>)
// Bugfix: </> command signal status in Exrail // 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.1.0 ...
// //
// 4.0.2 EXRAIL additions: // 4.0.2 EXRAIL additions: