arjav1528 commented on issue #17273: URL: https://github.com/apache/nuttx/issues/17273#issuecomment-3873190176
> Yeah, I may have a patch for this to improve its behavior and performance. > > In this case, the UART interface is being read so fast that there is an odd number of characters in the UART buffer (not enough to read two chars). shall I work on the issue, @linguini1 I gone through your PR, but I found some things which might be wrong in my opinion 1.hex_to_byte macro is wrong. It only adds the two nibbles instead of forming a byte. For eg, "a0" becomes 10+0 = 10 instead of 0xa0 = 160. It should be (char_to_byte((hex)[0]) << 4) + char_to_byte((hex)[1]) so the first character is the high nibble 2.wrong buffer offset in parse_bytes call. The code calls parse_bytes(priv, (uint8_t *)buffer, buflen) in a loop, so each call overwrites from the start of the user buffer instead of appending. It should pass the current write position and remaining length, e.g. parse_bytes(priv, (uint8_t *)buffer + received, buflen - received). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
