mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-12-24 13:21:23 +01:00
Merge pull request #230 from DCC-EX/ServoSignal
WRITE CV ON PROG <W CV VALUE>
This commit is contained in:
commit
6994139e57
@ -346,7 +346,9 @@ void DCCEXParser::parse(Print *stream, byte *com, RingStream * ringStream)
|
|||||||
break;
|
break;
|
||||||
if (params == 1) // <W id> Write new loco id (clearing consist and managing short/long)
|
if (params == 1) // <W id> Write new loco id (clearing consist and managing short/long)
|
||||||
DCC::setLocoId(p[0],callback_Wloco);
|
DCC::setLocoId(p[0],callback_Wloco);
|
||||||
else // WRITE CV ON PROG <W CV VALUE [CALLBACKNUM] [CALLBACKSUB]>
|
else if (params == 4) // WRITE CV ON PROG <W CV VALUE [CALLBACKNUM] [CALLBACKSUB]>
|
||||||
|
DCC::writeCVByte(p[0], p[1], callback_W4);
|
||||||
|
else // WRITE CV ON PROG <W CV VALUE>
|
||||||
DCC::writeCVByte(p[0], p[1], callback_W);
|
DCC::writeCVByte(p[0], p[1], callback_W);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -943,6 +945,13 @@ void DCCEXParser::commitAsyncReplyStream() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DCCEXParser::callback_W(int16_t result)
|
void DCCEXParser::callback_W(int16_t result)
|
||||||
|
{
|
||||||
|
StringFormatter::send(getAsyncReplyStream(),
|
||||||
|
F("<r %d %d>\n"), stashP[0], result == 1 ? stashP[1] : -1);
|
||||||
|
commitAsyncReplyStream();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DCCEXParser::callback_W4(int16_t result)
|
||||||
{
|
{
|
||||||
StringFormatter::send(getAsyncReplyStream(),
|
StringFormatter::send(getAsyncReplyStream(),
|
||||||
F("<r%d|%d|%d %d>\n"), stashP[2], stashP[3], stashP[0], result == 1 ? stashP[1] : -1);
|
F("<r%d|%d|%d %d>\n"), stashP[2], stashP[3], stashP[0], result == 1 ? stashP[1] : -1);
|
||||||
|
@ -60,6 +60,7 @@ struct DCCEXParser
|
|||||||
static int16_t stashP[MAX_COMMAND_PARAMS];
|
static int16_t stashP[MAX_COMMAND_PARAMS];
|
||||||
static bool stashCallback(Print * stream, int16_t p[MAX_COMMAND_PARAMS], RingStream * ringStream);
|
static bool stashCallback(Print * stream, int16_t p[MAX_COMMAND_PARAMS], RingStream * ringStream);
|
||||||
static void callback_W(int16_t result);
|
static void callback_W(int16_t result);
|
||||||
|
static void callback_W4(int16_t result);
|
||||||
static void callback_B(int16_t result);
|
static void callback_B(int16_t result);
|
||||||
static void callback_R(int16_t result);
|
static void callback_R(int16_t result);
|
||||||
static void callback_Rloco(int16_t result);
|
static void callback_Rloco(int16_t result);
|
||||||
|
Loading…
Reference in New Issue
Block a user