Make protocol decoder tolerant to leading whitespace

pull/98/head
D.R.racer 2021-09-14 18:41:53 +02:00
parent 7a99d3fbfa
commit 76ed8f7ad9
1 changed files with 4 additions and 0 deletions

View File

@ -104,6 +104,10 @@ DecodeStatus Protocol::DecodeResponse(uint8_t c) {
responseMsg.request.value = 0;
rspState = ResponseStates::RequestValue;
return DecodeStatus::NeedMoreData;
case 0x0a:
case 0x0d:
// skip leading whitespace if any (makes integration with other SW easier/tolerant)
return DecodeStatus::NeedMoreData;
default:
rspState = ResponseStates::Error;
return DecodeStatus::Error;