From 612cb95f85edb610c6551c995e3dd8ca61df5240 Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Tue, 17 Nov 2020 15:16:45 +0100 Subject: [PATCH 01/11] make AP password setable --- WifiInterface.cpp | 15 +++++++++++---- config.example.h | 17 +++++++++++++---- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/WifiInterface.cpp b/WifiInterface.cpp index 8020d85..6c6dc5a 100644 --- a/WifiInterface.cpp +++ b/WifiInterface.cpp @@ -170,8 +170,9 @@ wifiSerialState WifiInterface::setup2(const __FlashStringHelper* SSid, const __F // If the source code looks unconfigured, check if the // ESP8266 is preconfigured. We check the first 13 chars - // of the password. - if (strncmp_P("Your network ",(const char*)password,13) == 0) { + // of the SSid. + char *yourNetwork = "Your network "; + if (strncmp_P(yourNetwork, (const char*)SSid, 13) == 0) { delay(8000); // give a preconfigured ES8266 a chance to connect to a router StringFormatter::send(wifiStream, F("AT+CIFSR\r\n")); @@ -243,8 +244,14 @@ wifiSerialState WifiInterface::setup2(const __FlashStringHelper* SSid, const __F while (wifiStream->available()) StringFormatter::printEscape( wifiStream->read()); /// THIS IS A DIAG IN DISGUISE int i=0; - do StringFormatter::send(wifiStream, F("AT+CWSAP=\"DCCEX_%s\",\"PASS_%s\",1,4\r\n"), macTail, macTail); - while (i++<2 && !checkForOK(16000, OK_SEARCH, true)); // do twice if necessary but ignore failure as AP mode may still be ok + do { + if (strncmp_P(yourNetwork, (const char*)password, 13) == 0) { + // unconfigured + StringFormatter::send(wifiStream, F("AT+CWSAP=\"DCCEX_%s\",\"PASS_%s\",1,4\r\n"), macTail, macTail); + } else { + // password configured by user + StringFormatter::send(wifiStream, F("AT+CWSAP=\"DCCEX_%s\",\"%s\",1,4\r\n"), macTail, password); + } while (i++<2 && !checkForOK(16000, OK_SEARCH, true)); // do twice if necessary but ignore failure as AP mode may still be ok } else { diff --git a/config.example.h b/config.example.h index 3ceb675..79d0d23 100644 --- a/config.example.h +++ b/config.example.h @@ -44,14 +44,23 @@ The configuration file for DCC++ EX Command Station // // DEFINE WiFi Parameters (only in effect if WIFI is on) // +// If DONT_TOUCH_WIFI_CONF is set, all WIFI config will be done with +// the <+> commands and this sketch will not change anything over +// AT commands and the other WIFI_* defines below do not have any effect. //#define DONT_TOUCH_WIFI_CONF // -// if DONT_TOUCH_WIFI_CONF is set, all WIFI config will be done with -// the <+> commands and this sketch will not change anything over -// AT commands and the WIFI_* defines below do not have any effect. -// +// WIFI_SSID is the network name IF you want to use your home network. +// Do NOT change this if you want to use the WiFi in Access Point mode. +// Your SSID may not conain ``"'' (double quote, ASCII 0x22). #define WIFI_SSID "Your network name" +// +// WIFI_PASSWORD is the network password for your home network or if +// you want to change the password from default AP mode password +// to the AP password you want. +// Your password may not conain ``"'' (double quote, ASCII 0x22). #define WIFI_PASSWORD "Your network passwd" +// +// WIFI_HOSTNAME: You probably don't need to change this #define WIFI_HOSTNAME "dccex" ///////////////////////////////////////////////////////////////////////////////////// From df2e40fa11f06820d004d117f99548596fb141e5 Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Wed, 18 Nov 2020 23:42:37 +0100 Subject: [PATCH 02/11] empty SSID is "unconfigured" as well --- WifiInterface.cpp | 2 +- config.example.h | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/WifiInterface.cpp b/WifiInterface.cpp index 6c6dc5a..29a698c 100644 --- a/WifiInterface.cpp +++ b/WifiInterface.cpp @@ -172,7 +172,7 @@ wifiSerialState WifiInterface::setup2(const __FlashStringHelper* SSid, const __F // ESP8266 is preconfigured. We check the first 13 chars // of the SSid. char *yourNetwork = "Your network "; - if (strncmp_P(yourNetwork, (const char*)SSid, 13) == 0) { + if (strncmp_P(yourNetwork, (const char*)SSid, 13) == 0 || SSid[0] == '\0') { delay(8000); // give a preconfigured ES8266 a chance to connect to a router StringFormatter::send(wifiStream, F("AT+CIFSR\r\n")); diff --git a/config.example.h b/config.example.h index 79d0d23..ab55c21 100644 --- a/config.example.h +++ b/config.example.h @@ -49,8 +49,14 @@ The configuration file for DCC++ EX Command Station // AT commands and the other WIFI_* defines below do not have any effect. //#define DONT_TOUCH_WIFI_CONF // -// WIFI_SSID is the network name IF you want to use your home network. -// Do NOT change this if you want to use the WiFi in Access Point mode. +// WIFI_SSID is the network name IF you want to use your existing home network. +// Do NOT change this if you want to use the WiFi in Access Point (AP) mode. +// +// If you do NOT set the WIFI_SSID, the WiFi chip will first try +// to connect to the previously configured network and if that fails +// fall back to Access Point mode. The SSID of the AP will be +// automatically set to DCCEX_*. +// // Your SSID may not conain ``"'' (double quote, ASCII 0x22). #define WIFI_SSID "Your network name" // From 7753f6dbb5bc39e6c7ea6132fa271c0d5d4294c5 Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Wed, 18 Nov 2020 23:53:06 +0100 Subject: [PATCH 03/11] many typos fixed --- WifiInterface.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/WifiInterface.cpp b/WifiInterface.cpp index 29a698c..ac309ef 100644 --- a/WifiInterface.cpp +++ b/WifiInterface.cpp @@ -171,8 +171,8 @@ wifiSerialState WifiInterface::setup2(const __FlashStringHelper* SSid, const __F // If the source code looks unconfigured, check if the // ESP8266 is preconfigured. We check the first 13 chars // of the SSid. - char *yourNetwork = "Your network "; - if (strncmp_P(yourNetwork, (const char*)SSid, 13) == 0 || SSid[0] == '\0') { + const char *yourNetwork = "Your network "; + if (strncmp_P(yourNetwork, (const char*)SSid, 13) == 0 || ((const char *)SSid)[0] == '\0') { delay(8000); // give a preconfigured ES8266 a chance to connect to a router StringFormatter::send(wifiStream, F("AT+CIFSR\r\n")); @@ -247,10 +247,11 @@ wifiSerialState WifiInterface::setup2(const __FlashStringHelper* SSid, const __F do { if (strncmp_P(yourNetwork, (const char*)password, 13) == 0) { // unconfigured - StringFormatter::send(wifiStream, F("AT+CWSAP=\"DCCEX_%s\",\"PASS_%s\",1,4\r\n"), macTail, macTail); + StringFormatter::send(wifiStream, F("AT+CWSAP=\"DCCEX_%s\",\"PASS_%s\",1,4\r\n"), macTail, macTail); } else { // password configured by user StringFormatter::send(wifiStream, F("AT+CWSAP=\"DCCEX_%s\",\"%s\",1,4\r\n"), macTail, password); + } } while (i++<2 && !checkForOK(16000, OK_SEARCH, true)); // do twice if necessary but ignore failure as AP mode may still be ok } else { From 89b158f3d1d51dcc76be6da4472b91c25545a2bd Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Sat, 21 Nov 2020 22:20:15 +0100 Subject: [PATCH 04/11] cut timeouts shorter --- WifiInterface.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/WifiInterface.cpp b/WifiInterface.cpp index 8020d85..fce1f42 100644 --- a/WifiInterface.cpp +++ b/WifiInterface.cpp @@ -178,7 +178,7 @@ wifiSerialState WifiInterface::setup2(const __FlashStringHelper* SSid, const __F if (checkForOK(5000, (const char*) F("+CIFSR:STAIP"), true,false)) if (!checkForOK(1000, (const char*) F("0.0.0.0"), true,false)) ipOK = true; - } else { + } else { // Should this really be "else" here /haba if (!ipOK) { @@ -191,7 +191,7 @@ wifiSerialState WifiInterface::setup2(const __FlashStringHelper* SSid, const __F // AT command early version supports CWJAP/CWSAP if (SSid) { StringFormatter::send(wifiStream, F("AT+CWJAP=\"%S\",\"%S\"\r\n"), SSid, password); - ipOK = checkForOK(16000, OK_SEARCH, true); + ipOK = checkForOK(8000, OK_SEARCH, true); } DIAG(F("\n**\n")); @@ -203,10 +203,9 @@ wifiSerialState WifiInterface::setup2(const __FlashStringHelper* SSid, const __F if (SSid) { StringFormatter::send(wifiStream, F("AT+CWJAP_CUR=\"%S\",\"%S\"\r\n"), SSid, password); - ipOK = checkForOK(20000, OK_SEARCH, true); + ipOK = checkForOK(8000, OK_SEARCH, true); } } - delay(8000); // give a preconfigured ES8266 a chance to connect to a router if (ipOK) { // But we really only have the ESSID and password correct @@ -244,7 +243,7 @@ wifiSerialState WifiInterface::setup2(const __FlashStringHelper* SSid, const __F int i=0; do StringFormatter::send(wifiStream, F("AT+CWSAP=\"DCCEX_%s\",\"PASS_%s\",1,4\r\n"), macTail, macTail); - while (i++<2 && !checkForOK(16000, OK_SEARCH, true)); // do twice if necessary but ignore failure as AP mode may still be ok + while (i++<2 && !checkForOK(8000, OK_SEARCH, true)); // do twice if necessary but ignore failure as AP mode may still be ok } else { @@ -257,17 +256,17 @@ wifiSerialState WifiInterface::setup2(const __FlashStringHelper* SSid, const __F } StringFormatter::send(wifiStream, F("AT+CIPSERVER=0\r\n")); // turn off tcp server (to clean connections before CIPMUX=1) - checkForOK(10000, OK_SEARCH, true); // ignore result in case it already was off + checkForOK(1000, OK_SEARCH, true); // ignore result in case it already was off StringFormatter::send(wifiStream, F("AT+CIPMUX=1\r\n")); // configure for multiple connections - if (!checkForOK(10000, OK_SEARCH, true)) return WIFI_DISCONNECTED; + if (!checkForOK(1000, OK_SEARCH, true)) return WIFI_DISCONNECTED; StringFormatter::send(wifiStream, F("AT+CIPSERVER=1,%d\r\n"), port); // turn on server on port - if (!checkForOK(10000, OK_SEARCH, true)) return WIFI_DISCONNECTED; + if (!checkForOK(1000, OK_SEARCH, true)) return WIFI_DISCONNECTED; #endif //DONT_TOUCH_WIFI_CONF StringFormatter::send(wifiStream, F("AT+CIFSR\r\n")); // Display ip addresses to the DIAG - if (!checkForOK(10000, OK_SEARCH, true, false)) return WIFI_DISCONNECTED; + if (!checkForOK(1000, OK_SEARCH, true, false)) return WIFI_DISCONNECTED; DIAG(F("\nPORT=%d\n"),port); return WIFI_CONNECTED; From a3ddcb059a0f7c8f0e410aeda695882f3293be70 Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Sat, 21 Nov 2020 23:23:27 +0100 Subject: [PATCH 05/11] make connection timeout configurable --- WifiInterface.cpp | 11 +++++++---- config.example.h | 7 +++++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/WifiInterface.cpp b/WifiInterface.cpp index fce1f42..3e9a0f0 100644 --- a/WifiInterface.cpp +++ b/WifiInterface.cpp @@ -34,6 +34,9 @@ const unsigned long LOOP_TIMEOUT = 2000; bool WifiInterface::connected = false; Stream * WifiInterface::wifiStream; +#ifndef WIFI_CONNECT_TIMEOUT +#define WIFI_CONNECT_TIMEOUT 8000 +#endif //////////////////////////////////////////////////////////////////////////////// // @@ -172,7 +175,7 @@ wifiSerialState WifiInterface::setup2(const __FlashStringHelper* SSid, const __F // ESP8266 is preconfigured. We check the first 13 chars // of the password. if (strncmp_P("Your network ",(const char*)password,13) == 0) { - delay(8000); // give a preconfigured ES8266 a chance to connect to a router + delay(WIFI_CONNECT_TIMEOUT); // give a preconfigured ES8266 a chance to connect to a router StringFormatter::send(wifiStream, F("AT+CIFSR\r\n")); if (checkForOK(5000, (const char*) F("+CIFSR:STAIP"), true,false)) @@ -191,7 +194,7 @@ wifiSerialState WifiInterface::setup2(const __FlashStringHelper* SSid, const __F // AT command early version supports CWJAP/CWSAP if (SSid) { StringFormatter::send(wifiStream, F("AT+CWJAP=\"%S\",\"%S\"\r\n"), SSid, password); - ipOK = checkForOK(8000, OK_SEARCH, true); + ipOK = checkForOK(WIFI_CONNECT_TIMEOUT, OK_SEARCH, true); } DIAG(F("\n**\n")); @@ -203,7 +206,7 @@ wifiSerialState WifiInterface::setup2(const __FlashStringHelper* SSid, const __F if (SSid) { StringFormatter::send(wifiStream, F("AT+CWJAP_CUR=\"%S\",\"%S\"\r\n"), SSid, password); - ipOK = checkForOK(8000, OK_SEARCH, true); + ipOK = checkForOK(WIFI_CONNECT_TIMEOUT, OK_SEARCH, true); } } @@ -243,7 +246,7 @@ wifiSerialState WifiInterface::setup2(const __FlashStringHelper* SSid, const __F int i=0; do StringFormatter::send(wifiStream, F("AT+CWSAP=\"DCCEX_%s\",\"PASS_%s\",1,4\r\n"), macTail, macTail); - while (i++<2 && !checkForOK(8000, OK_SEARCH, true)); // do twice if necessary but ignore failure as AP mode may still be ok + while (i++<2 && !checkForOK(WIFI_CONNECT_TIMEOUT, OK_SEARCH, true)); // do twice if necessary but ignore failure as AP mode may still be ok } else { diff --git a/config.example.h b/config.example.h index 3ceb675..d3542d6 100644 --- a/config.example.h +++ b/config.example.h @@ -53,6 +53,13 @@ The configuration file for DCC++ EX Command Station #define WIFI_SSID "Your network name" #define WIFI_PASSWORD "Your network passwd" #define WIFI_HOSTNAME "dccex" +// +///////////////////////////////////////////////////////////////////////////////////// +// +// Wifi connect timeout in milliseconds. Default is 8000 (8 seconds). You only need +// to set this if you have an extremely slow Wifi router. +// +//#define WIFI_CONNECT_TIMEOUT 8000 ///////////////////////////////////////////////////////////////////////////////////// // From 31022094c11ccfbdee7eb15d772f1559005aa8df Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Mon, 23 Nov 2020 00:46:14 +0100 Subject: [PATCH 06/11] adjust timeouts --- WifiInterface.cpp | 7 ++++--- config.example.h | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/WifiInterface.cpp b/WifiInterface.cpp index 3e9a0f0..a80481c 100644 --- a/WifiInterface.cpp +++ b/WifiInterface.cpp @@ -35,7 +35,8 @@ bool WifiInterface::connected = false; Stream * WifiInterface::wifiStream; #ifndef WIFI_CONNECT_TIMEOUT -#define WIFI_CONNECT_TIMEOUT 8000 +// Tested how long it takes to FAIL an unknown SSID on firmware 1.7.4. +#define WIFI_CONNECT_TIMEOUT 14000 #endif //////////////////////////////////////////////////////////////////////////////// @@ -175,8 +176,8 @@ wifiSerialState WifiInterface::setup2(const __FlashStringHelper* SSid, const __F // ESP8266 is preconfigured. We check the first 13 chars // of the password. if (strncmp_P("Your network ",(const char*)password,13) == 0) { - delay(WIFI_CONNECT_TIMEOUT); // give a preconfigured ES8266 a chance to connect to a router - + delay(8000); // give a preconfigured ES8266 a chance to connect to a router + // typical connect time approx 7 seconds StringFormatter::send(wifiStream, F("AT+CIFSR\r\n")); if (checkForOK(5000, (const char*) F("+CIFSR:STAIP"), true,false)) if (!checkForOK(1000, (const char*) F("0.0.0.0"), true,false)) diff --git a/config.example.h b/config.example.h index d3542d6..a6412bc 100644 --- a/config.example.h +++ b/config.example.h @@ -56,10 +56,10 @@ The configuration file for DCC++ EX Command Station // ///////////////////////////////////////////////////////////////////////////////////// // -// Wifi connect timeout in milliseconds. Default is 8000 (8 seconds). You only need +// Wifi connect timeout in milliseconds. Default is 14000 (14 seconds). You only need // to set this if you have an extremely slow Wifi router. // -//#define WIFI_CONNECT_TIMEOUT 8000 +//#define WIFI_CONNECT_TIMEOUT 14000 ///////////////////////////////////////////////////////////////////////////////////// // From beca0b3368d83f29bf7284cd4065567f2fb6a4fe Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Mon, 23 Nov 2020 22:13:36 +0100 Subject: [PATCH 07/11] Safety measure: Turm power off at + command --- DCCEXParser.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/DCCEXParser.cpp b/DCCEXParser.cpp index 2b90136..87efd2e 100644 --- a/DCCEXParser.cpp +++ b/DCCEXParser.cpp @@ -402,6 +402,8 @@ void DCCEXParser::parse(Print *stream, byte *com, bool blocking) case '+': // Complex Wifi interface command (not usual parse) if (atCommandCallback) { + DCCWaveform::mainTrack.setPowerMode(POWERMODE::OFF); + DCCWaveform::progTrack.setPowerMode(POWERMODE::OFF); atCommandCallback(com); return; } From 3faa48476cb39ae8aefe7530ff063f7fc8de2d40 Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Tue, 24 Nov 2020 21:12:55 +0100 Subject: [PATCH 08/11] ack diag better messages --- DCCEXParser.cpp | 6 +++++- DCCWaveform.cpp | 7 ++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/DCCEXParser.cpp b/DCCEXParser.cpp index 2b90136..e122e71 100644 --- a/DCCEXParser.cpp +++ b/DCCEXParser.cpp @@ -49,6 +49,8 @@ const int HASH_KEYWORD_PROGBOOST = -6353; const int HASH_KEYWORD_EEPROM = -7168; const int HASH_KEYWORD_LIMIT = 27413; const int HASH_KEYWORD_ETHERNET = -30767; +//const int HASH_KEYWORD_MAX = 16244; +//const int HASH_KEYWORD_MIN = 15978; int DCCEXParser::stashP[MAX_PARAMS]; bool DCCEXParser::stashBusy; @@ -598,8 +600,10 @@ bool DCCEXParser::parseD(Print *stream, int params, int p[]) if (params >= 2 && p[1] == HASH_KEYWORD_LIMIT) { DCCWaveform::progTrack.setAckLimit(p[2]); StringFormatter::send(stream, F("\nAck limit=%dmA\n"), p[2]); - } else + } else { + StringFormatter::send(stream, F("\nAck diag %S\n"), onOff ? F("on") : F("off")); Diag::ACK = onOff; + } return true; case HASH_KEYWORD_CMD: // diff --git a/DCCWaveform.cpp b/DCCWaveform.cpp index bec16b3..36fb1b7 100644 --- a/DCCWaveform.cpp +++ b/DCCWaveform.cpp @@ -295,9 +295,10 @@ void DCCWaveform::setAckBaseline() { if (isMainTrack) return; int baseline = motorDriver->getCurrentRaw(); ackThreshold= baseline + motorDriver->mA2raw(ackLimitmA); - if (Diag::ACK) DIAG(F("\nACK baseline=%d/%dmA threshold=%d/%dmA"), + if (Diag::ACK) DIAG(F("\nACK baseline=%d/%dmA Threshold=%d/%dmA Duration: %dus <= pulse <= %dus"), baseline,motorDriver->raw2mA(baseline), - ackThreshold,motorDriver->raw2mA(ackThreshold)); + ackThreshold,motorDriver->raw2mA(ackThreshold), + MIN_ACK_PULSE_DURATION, MAX_ACK_PULSE_DURATION); } void DCCWaveform::setAckPending() { @@ -312,7 +313,7 @@ void DCCWaveform::setAckPending() { byte DCCWaveform::getAck() { if (ackPending) return (2); // still waiting - if (Diag::ACK) DIAG(F("\nACK-%S after %dmS max=%d/%dmA pulse=%duS"),ackDetected?F("OK"):F("FAIL"), ackCheckDuration, + if (Diag::ACK) DIAG(F("\n%S after %dmS max=%d/%dmA pulse=%duS"),ackDetected?F("ACK"):F("NO-ACK"), ackCheckDuration, ackMaxCurrent,motorDriver->raw2mA(ackMaxCurrent), ackPulseDuration); if (ackDetected) return (1); // Yes we had an ack return(0); // pending set off but not detected means no ACK. From edc39e734238838fb38156be74831927f7c55d5c Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Tue, 24 Nov 2020 21:39:21 +0100 Subject: [PATCH 09/11] ack pulse length configurable from diag --- DCCEXParser.cpp | 24 ++++++++++++++++-------- DCCWaveform.cpp | 6 +++--- DCCWaveform.h | 15 ++++++++++----- 3 files changed, 29 insertions(+), 16 deletions(-) diff --git a/DCCEXParser.cpp b/DCCEXParser.cpp index e122e71..e79a94a 100644 --- a/DCCEXParser.cpp +++ b/DCCEXParser.cpp @@ -49,8 +49,8 @@ const int HASH_KEYWORD_PROGBOOST = -6353; const int HASH_KEYWORD_EEPROM = -7168; const int HASH_KEYWORD_LIMIT = 27413; const int HASH_KEYWORD_ETHERNET = -30767; -//const int HASH_KEYWORD_MAX = 16244; -//const int HASH_KEYWORD_MIN = 15978; +const int HASH_KEYWORD_MAX = 16244; +const int HASH_KEYWORD_MIN = 15978; int DCCEXParser::stashP[MAX_PARAMS]; bool DCCEXParser::stashBusy; @@ -596,10 +596,18 @@ bool DCCEXParser::parseD(Print *stream, int params, int p[]) StringFormatter::send(stream, F("\nFree memory=%d\n"), freeMemory()); break; - case HASH_KEYWORD_ACK: // - if (params >= 2 && p[1] == HASH_KEYWORD_LIMIT) { - DCCWaveform::progTrack.setAckLimit(p[2]); - StringFormatter::send(stream, F("\nAck limit=%dmA\n"), p[2]); + case HASH_KEYWORD_ACK: // + if (params >= 3) { + if (p[1] == HASH_KEYWORD_LIMIT) { + DCCWaveform::progTrack.setAckLimit(p[2]); + StringFormatter::send(stream, F("\nAck limit=%dmA\n"), p[2]); + } else if (p[1] == HASH_KEYWORD_MIN) { + DCCWaveform::progTrack.setMinAckPulseDuration(p[2]); + StringFormatter::send(stream, F("\nAck min=%dus\n"), p[2]); + } else if (p[1] == HASH_KEYWORD_MAX) { + DCCWaveform::progTrack.setMaxAckPulseDuration(p[2]); + StringFormatter::send(stream, F("\nAck max=%dus\n"), p[2]); + } } else { StringFormatter::send(stream, F("\nAck diag %S\n"), onOff ? F("on") : F("off")); Diag::ACK = onOff; @@ -630,8 +638,8 @@ bool DCCEXParser::parseD(Print *stream, int params, int p[]) DCC::setProgTrackBoost(true); return true; - case HASH_KEYWORD_EEPROM: - if (params >= 1) + case HASH_KEYWORD_EEPROM: // + if (params >= 2) EEStore::dump(p[1]); return true; diff --git a/DCCWaveform.cpp b/DCCWaveform.cpp index 36fb1b7..123ba9e 100644 --- a/DCCWaveform.cpp +++ b/DCCWaveform.cpp @@ -298,7 +298,7 @@ void DCCWaveform::setAckBaseline() { if (Diag::ACK) DIAG(F("\nACK baseline=%d/%dmA Threshold=%d/%dmA Duration: %dus <= pulse <= %dus"), baseline,motorDriver->raw2mA(baseline), ackThreshold,motorDriver->raw2mA(ackThreshold), - MIN_ACK_PULSE_DURATION, MAX_ACK_PULSE_DURATION); + minAckPulseDuration, maxAckPulseDuration); } void DCCWaveform::setAckPending() { @@ -330,7 +330,7 @@ void DCCWaveform::checkAck() { lastCurrent=motorDriver->getCurrentRaw(); if (lastCurrent > ackMaxCurrent) ackMaxCurrent=lastCurrent; - // An ACK is a pulse lasting between MIN_ACK_PULSE_DURATION and MAX_ACK_PULSE_DURATION uSecs (refer @haba) + // An ACK is a pulse lasting between minAckPulseDuration and maxAckPulseDuration uSecs (refer @haba) if (lastCurrent>ackThreshold) { if (ackPulseStart==0) ackPulseStart=micros(); // leading edge of pulse detected @@ -343,7 +343,7 @@ void DCCWaveform::checkAck() { // detected trailing edge of pulse ackPulseDuration=micros()-ackPulseStart; - if (ackPulseDuration>=MIN_ACK_PULSE_DURATION && ackPulseDuration<=MAX_ACK_PULSE_DURATION) { + if (ackPulseDuration>=minAckPulseDuration && ackPulseDuration<=maxAckPulseDuration) { ackCheckDuration=millis()-ackCheckStart; ackDetected=true; ackPending=false; diff --git a/DCCWaveform.h b/DCCWaveform.h index 32041e6..c658577 100644 --- a/DCCWaveform.h +++ b/DCCWaveform.h @@ -27,10 +27,6 @@ const int POWER_SAMPLE_ON_WAIT = 100; const int POWER_SAMPLE_OFF_WAIT = 1000; const int POWER_SAMPLE_OVERLOAD_WAIT = 20; -// Ack time thresholds. Unit: microseconds -const int MIN_ACK_PULSE_DURATION = 2000; -const int MAX_ACK_PULSE_DURATION = 8500; - // Number of preamble bits. const int PREAMBLE_BITS_MAIN = 16; const int PREAMBLE_BITS_PROG = 22; @@ -79,7 +75,13 @@ class DCCWaveform { inline void setAckLimit(int mA) { ackLimitmA = mA; } - + inline void setMinAckPulseDuration(unsigned int i) { + minAckPulseDuration = i; + } + inline void setMaxAckPulseDuration(unsigned int i) { + maxAckPulseDuration = i; + } + private: static VirtualTimer * interruptTimer; static void interruptHandler(); @@ -128,6 +130,9 @@ class DCCWaveform { unsigned int ackPulseDuration; // micros unsigned long ackPulseStart; // micros + + unsigned int minAckPulseDuration = 2000; // micros + unsigned int maxAckPulseDuration = 8500; // micros }; #endif From 56569a9b44bb4aaeea9e6d80ee1fab11f6869149 Mon Sep 17 00:00:00 2001 From: LarryD <56610826+ldribin@users.noreply.github.com> Date: Wed, 25 Nov 2020 19:02:14 -0600 Subject: [PATCH 10/11] Partially fixed alignment issue. --- .../Prod-Release-Notes.md | 60 +++++++++---------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/Release - Architecture Doc/Prod-Release-Notes.md b/Release - Architecture Doc/Prod-Release-Notes.md index 526c3b7..2b95877 100644 --- a/Release - Architecture Doc/Prod-Release-Notes.md +++ b/Release - Architecture Doc/Prod-Release-Notes.md @@ -31,41 +31,41 @@ The DCC-EX Team is pleased to release CommandStation-EX-v3.0.0 as a Production R **Key Contributors** **Project Lead** - Fred Decker - Holly Springs, North Carolina, USA (FlightRisk) +- Fred Decker - Holly Springs, North Carolina, USA (FlightRisk) **CommandStation-EX Developers** - Chris Harlow - Bournemouth, UK (UKBloke) - Harald Barth - Stockholm, Sweden (Haba) - Fred Decker - Holly Springs, North Carolina, USA (FlightRisk) - Dave Cutting - Logan, Utah, USA (Dave Cutting/ David Cutting) - M Steve Todd - - Engine Driver and JMRI Interface - Scott Catalanno - Pennsylvania - Gregor Baues - Île-de-France, France (grbba) +- Chris Harlow - Bournemouth, UK (UKBloke) +- Harald Barth - Stockholm, Sweden (Haba) +- Fred Decker - Holly Springs, North Carolina, USA (FlightRisk) +- Dave Cutting - Logan, Utah, USA (Dave Cutting/ David Cutting) +- M Steve Todd - - Engine Driver and JMRI Interface +- Scott Catalanno - Pennsylvania +- Gregor Baues - Île-de-France, France (grbba) **exInstaller Software** - Anthony W - Dayton, Ohio, USA (Dex, Dex++) +- Anthony W - Dayton, Ohio, USA (Dex, Dex++) **Website and Documentation** - Mani Kumar - Bangalor, India (Mani / Mani Kumar) - Fred Decker - Holly Springs, North Carolina, USA (FlightRisk) - Dave Cutting - Logan, Utah, USA (Dave Cutting/ David Cutting) - Roger Beschizza - Dorset, UK (Roger Beschizza) - Keith Ledbetter - Chicago, Illinois, USA (Keith Ledbetter) - Kevin Smith - (KCSmith) +- Mani Kumar - Bangalor, India (Mani / Mani Kumar) +- Fred Decker - Holly Springs, North Carolina, USA (FlightRisk) +- Dave Cutting - Logan, Utah, USA (Dave Cutting/ David Cutting) +- Roger Beschizza - Dorset, UK (Roger Beschizza) +- Keith Ledbetter - Chicago, Illinois, USA (Keith Ledbetter) +-Kevin Smith - (KCSmith) **Beta Testing / Release Management / Support** - Larry Dribin larry@dribin.org - Release Management - Keith Ledbetter kwledbetter@hotmail.com - BradVan der Elst brad.vanderelst@gci.net - Andrew Pye andrew@ajpye.org - Mike Bowers springlake1925@gmail.com - Randy McKenzie kk4ej@yahoo.com - Roberto Bravin roberto.bravin@gmail.com - Sim Brigden sim.brigden@gmail.com - Alan Lautenslager alan.lautenslager@gmail.com - Martin Bafver martin.bafver@gmail.com - Mário André Silva andre_bb@live.com.pt - Anthony Kochevar ajkochevar@comcast.net - Gajanatha Kobbekaduwe gajanatha@gmail.com - Sumner Patterson - Blanding, Utah, USA (Sumner) - Paul - Virginia, USA (Paul1361) +- Larry Dribin - Release Management +- Keith Ledbetter +- BradVan der Elst +- Andrew Pye +- Mike Bowers +- Randy McKenzie +- Roberto Bravin +- Sim Brigden +- Alan Lautenslager +- Martin Bafver +- Mário André Silva +- Anthony Kochevar +- Gajanatha Kobbekaduwe +- Sumner Patterson +- Paul - Virginia, USA From e4eecae846aa8ab8f8666dab7858b405e6b68fb6 Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Thu, 26 Nov 2020 15:55:52 +0100 Subject: [PATCH 11/11] do not touch CR or CRLF of svg files --- .gitattributes | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitattributes b/.gitattributes index dfe0770..09d8971 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,3 @@ # Auto detect text files and perform LF normalization * text=auto +*.svg -text