Closed meikjaeckle closed 8 months ago
In the following if statement, assignment was used instead of comparison: https://github.com/shining-man/bsc_fw/blob/8075238d0f13a4ee5efc9743936257e9ce5bd892/src/BscSerial.cpp#L426
I would suggest to replace the whole "else" block by following code, to fix the issue and get rid of the additional memory allocation for the String.
Modern variant:
else { auto GetReasonStr = [u8_lReason]() { return (1==u8_lReason) ? "Checksum wrong" : "Filter"; }; BSC_LOGE(TAG,"ERROR: device=%i, reason=%s",i,GetReasonStr()); }
or classic variant:
else { const char* reasonStr = (1==u8_lReason) ? "Checksum wrong" : "Filter"; BSC_LOGE(TAG,"ERROR: device=%i, reason=%s",i,reasonStr); }
The issue is fixed
In the following if statement, assignment was used instead of comparison: https://github.com/shining-man/bsc_fw/blob/8075238d0f13a4ee5efc9743936257e9ce5bd892/src/BscSerial.cpp#L426
I would suggest to replace the whole "else" block by following code, to fix the issue and get rid of the additional memory allocation for the String.
Modern variant:
or classic variant: