mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-12-24 13:21:23 +01:00
Fix return values for outputs and sensors (<X> and <O> responses
This commit is contained in:
parent
9149bc0ee2
commit
369a75f958
@ -436,10 +436,17 @@ bool DCCEXParser::parseZ(Print *stream, int params, int p[])
|
|||||||
|
|
||||||
case 3: // <Z ID PIN INVERT>
|
case 3: // <Z ID PIN INVERT>
|
||||||
Output::create(p[0], p[1], p[2], 1);
|
Output::create(p[0], p[1], p[2], 1);
|
||||||
|
if (!Output::create(p[0], p[1], p[2], 1))
|
||||||
|
return false;
|
||||||
|
StringFormatter::send(stream, F("<O>"));
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case 1: // <Z ID>
|
case 1: // <Z ID>
|
||||||
return Output::remove(p[0]);
|
return Output::remove(p[0]);
|
||||||
|
if (!Output::remove(p[0]))
|
||||||
|
return false;
|
||||||
|
StringFormatter::send(stream, F("<O>"));
|
||||||
|
return true;
|
||||||
|
|
||||||
case 0: // <Z>
|
case 0: // <Z>
|
||||||
{
|
{
|
||||||
@ -548,11 +555,18 @@ bool DCCEXParser::parseS(Print *stream, int params, int p[])
|
|||||||
{
|
{
|
||||||
case 3: // <S id pin pullup> create sensor. pullUp indicator (0=LOW/1=HIGH)
|
case 3: // <S id pin pullup> create sensor. pullUp indicator (0=LOW/1=HIGH)
|
||||||
Sensor::create(p[0], p[1], p[2]);
|
Sensor::create(p[0], p[1], p[2]);
|
||||||
|
if (!Sensor::create(p[0], p[1], p[2]))
|
||||||
|
return false;
|
||||||
|
StringFormatter::send(stream, F("<O>"));
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case 1: // S id> remove sensor
|
case 1: // S id> remove sensor
|
||||||
if (Sensor::remove(p[0]))
|
if (Sensor::remove(p[0]))
|
||||||
return true;
|
return true;
|
||||||
|
if (!Sensor::remove(p[0]))
|
||||||
|
return false;
|
||||||
|
StringFormatter::send(stream, F("<O>"));
|
||||||
|
return true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0: // <S> lit sensor states
|
case 0: // <S> lit sensor states
|
||||||
|
Loading…
Reference in New Issue
Block a user