Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pia_communicator map_to_ascii() seems partly nonsensical #7

Open
0cjs opened this issue Feb 25, 2020 · 0 comments
Open

pia_communicator map_to_ascii() seems partly nonsensical #7

0cjs opened this issue Feb 25, 2020 · 0 comments

Comments

@0cjs
Copy link
Contributor

0cjs commented Feb 25, 2020

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:

  1. 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.

  2. 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.

@0cjs 0cjs changed the title pia_communicator map_to_ascii() is partly nonsensical pia_communicator map_to_ascii() seems partly nonsensical Feb 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant