mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-12-23 12:51:24 +01:00
AT command version
+ Withrottle minor fix
This commit is contained in:
parent
177e243507
commit
928a9d834a
@ -218,12 +218,12 @@ void WiThrottle::locoAction(Print & stream, byte* aval, char throttleChar, int c
|
||||
case 'q':
|
||||
if (aval[1]=='V') { //qV
|
||||
LOOPLOCOS(throttleChar, cab) {
|
||||
StringFormatter::send(stream,F("M%cAL%d<;>V%d\n"), throttleChar, myLocos[loco].cab, DCC::getThrottleSpeed(myLocos[loco].cab));
|
||||
StringFormatter::send(stream,F("M%cA%c%d<;>V%d\n"), throttleChar, LorS(myLocos[loco].cab), myLocos[loco].cab, DCC::getThrottleSpeed(myLocos[loco].cab));
|
||||
}
|
||||
}
|
||||
else if (aval[1]=='R') { // qR
|
||||
LOOPLOCOS(throttleChar, cab) {
|
||||
StringFormatter::send(stream,F("M%cAL%d<;>R%d\n"), throttleChar, myLocos[loco].cab, DCC::getThrottleDirection(myLocos[loco].cab));
|
||||
StringFormatter::send(stream,F("M%cA%c%d<;>R%d\n"), throttleChar, LorS(myLocos[loco].cab), myLocos[loco].cab, DCC::getThrottleDirection(myLocos[loco].cab));
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -271,3 +271,7 @@ void WiThrottle::checkHeartbeat() {
|
||||
// TODO Check if anything has changed on my locos since last notified!
|
||||
}
|
||||
}
|
||||
|
||||
char WiThrottle::LorS(int cab) {
|
||||
return (cab<127)?'S':'L';
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ class WiThrottle {
|
||||
static WiThrottle* firstThrottle;
|
||||
static int getInt(byte * cmd);
|
||||
static int getLocoId(byte * cmd);
|
||||
|
||||
static char LorS(int cab);
|
||||
WiThrottle* nextThrottle;
|
||||
int clientid;
|
||||
|
||||
|
@ -56,15 +56,19 @@ bool WifiInterface::setup2(Stream & wifiStream, const __FlashStringHelper* SSid,
|
||||
//checkForOK(wifiStream,5000,END_DETAIL_SEARCH,true); // Show startup but ignore unreadable upto ready
|
||||
checkForOK(wifiStream,5000,READY_SEARCH,true);
|
||||
|
||||
StringFormatter::send(wifiStream,F("AT+CWMODE=1\r\n")); // configure as access point
|
||||
StringFormatter::send(wifiStream,F("AT+CWMODE=3\r\n")); // configure as server or access point
|
||||
checkForOK(wifiStream,1000,OK_SEARCH,true); // Not always OK, sometimes "no change"
|
||||
|
||||
// StringFormatter::send(wifiStream, F("AT+CWHOSTNAME=\"%S\"\r\n"), hostname); // Set Host name for Wifi Client
|
||||
// checkForOK(wifiStream,5000, OK_SEARCH, true);
|
||||
(void) hostname; // not currently in use
|
||||
StringFormatter::send(wifiStream, F("AT+CWHOSTNAME=\"%S\"\r\n"), hostname); // Set Host name for Wifi Client
|
||||
checkForOK(wifiStream,2000, OK_SEARCH, true);
|
||||
|
||||
|
||||
// Older ES versions have AT+CWJAP, newer ones have AT+CWJAP_CUR and AT+CWHOSTNAME
|
||||
StringFormatter::send(wifiStream,F("AT+CWJAP=\"%S\",\"%S\"\r\n"),SSid,password);
|
||||
if (!checkForOK(wifiStream,20000,OK_SEARCH,true)) return false;
|
||||
if (!checkForOK(wifiStream,20000,OK_SEARCH,true)) {
|
||||
StringFormatter::send(wifiStream,F("AT+CWJAP_CUR=\"%S\",\"%S\"\r\n"),SSid,password);
|
||||
if (!checkForOK(wifiStream,20000,OK_SEARCH,true)) return false;
|
||||
}
|
||||
|
||||
StringFormatter::send(wifiStream,F("AT+CIFSR\r\n")); // get ip address //192.168.4.1
|
||||
if (!checkForOK(wifiStream,10000,OK_SEARCH,true)) return false;
|
||||
|
Loading…
Reference in New Issue
Block a user