mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-12-23 21:01:25 +01:00
The auto create turnout feature should be there
This commit is contained in:
parent
11395dde2b
commit
4fce31158f
@ -135,21 +135,22 @@ void WiThrottle::parse(Print & stream, byte * cmdx) {
|
||||
bool newstate=false;
|
||||
Turnout * tt=Turnout::get(id);
|
||||
if (!tt) {
|
||||
// If turnout does not exist, create it
|
||||
int addr = ((id - 1) / 4) + 1;
|
||||
int subaddr = (id - 1) % 4;
|
||||
Turnout::create(id,addr,subaddr);
|
||||
StringFormatter::send(stream, F("HMTurnout %d created\n"),id);
|
||||
/*
|
||||
StringFormatter::send(stream, F("HMTurnout %d Unknown\n"),id);
|
||||
break;
|
||||
*/
|
||||
}
|
||||
switch (cmd[3]) {
|
||||
case 'T': newstate=true; break;
|
||||
case 'C': newstate=false; break;
|
||||
case '2': newstate=!Turnout::isActive(id);
|
||||
}
|
||||
// If turnout does not exist, create it
|
||||
if (Turnout::activate(id,newstate) == false) {
|
||||
int addr = ((id - 1) / 4) + 1;
|
||||
int subaddr = (id - 1) % 4;
|
||||
Turnout::create(id,addr,subaddr);
|
||||
Turnout::activate(id,newstate);
|
||||
}
|
||||
Turnout::activate(id,newstate);
|
||||
StringFormatter::send(stream, F("PTA%c%d\n"),newstate?'4':'2',id );
|
||||
}
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user