You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The map_to_ascii() function in pia_communicator seems to be at least partly nonsensical. It's passed the output of Serial.read(), which returns a byte read from the serial port. An examination of the standard AVR source code indicates that it will always return a value between 0 and 255 (if a character is available) and as far as I'm aware the AVR serial ports read values no larger than 8 bits. So:
The "Ctrl A-Z" code checks for values larger than 255, which can never be returned, and thus does nothing. If there is some sort of case (linking to a different library?) where the values this checks can be returned, this should be documented, otherwise the code should be removed.
The "Convert ESC key" code checking for a value of 203 doesn't make sense to me; it would be unusual for a terminal program with correct communications settings to set the high bit on ASCII characters, and if it did why would it do so only for ESC and not for any other characters? Again, remove or document.
The text was updated successfully, but these errors were encountered:
0cjs
changed the title
pia_communicator map_to_ascii() is partly nonsensical
pia_communicator map_to_ascii() seems partly nonsensical
Feb 25, 2020
The
map_to_ascii()
function in pia_communicator seems to be at least partly nonsensical. It's passed the output ofSerial.read()
, which returns a byte read from the serial port. An examination of the standard AVR source code indicates that it will always return a value between 0 and 255 (if a character is available) and as far as I'm aware the AVR serial ports read values no larger than 8 bits. So:The "Ctrl A-Z" code checks for values larger than 255, which can never be returned, and thus does nothing. If there is some sort of case (linking to a different library?) where the values this checks can be returned, this should be documented, otherwise the code should be removed.
The "Convert ESC key" code checking for a value of 203 doesn't make sense to me; it would be unusual for a terminal program with correct communications settings to set the high bit on ASCII characters, and if it did why would it do so only for ESC and not for any other characters? Again, remove or document.
The text was updated successfully, but these errors were encountered: