1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2025-07-28 09:53:45 +02:00

better long/short addr handling under <R>; configurable long/short border

This commit is contained in:
Harald Barth
2021-11-25 00:10:11 +01:00
parent f05b3d1730
commit 3bddeeda3e
5 changed files with 53 additions and 11 deletions

View File

@@ -960,8 +960,17 @@ void DCCEXParser::callback_R(int16_t result)
void DCCEXParser::callback_Rloco(int16_t result)
{
if (result <= 0)
StringFormatter::send(getAsyncReplyStream(), F("<r ERROR>\n"));
else if (result & LONG_ADDR_MARKER ) { //long addr
result = result & ~LONG_ADDR_MARKER;
if (result > HIGHEST_SHORT_ADDR) //real long
StringFormatter::send(getAsyncReplyStream(), F("<r %d>\n"), result);
else
StringFormatter::send(getAsyncReplyStream(), F("<r LONG %d UNSUPPORTED>\n"), result);
} else // short addr
StringFormatter::send(getAsyncReplyStream(), F("<r %d>\n"), result);
commitAsyncReplyStream();
commitAsyncReplyStream();
}
void DCCEXParser::callback_Wloco(int16_t result)