Make protocol decoder tolerant to leading whitespace

pull/122/head
D.R.racer 2021-09-14 18:41:53 +02:00 committed by DRracer
parent ee353cd98c
commit e59e7e3884
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;