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

printDebug function nitpicks #70

Merged
merged 5 commits into from
May 11, 2021
Merged

printDebug function nitpicks #70

merged 5 commits into from
May 11, 2021

Conversation

dmadison
Copy link
Owner

Small improvements to the printDebug functions:

  • All single character ternary calls are now const qualified, both to indicate intent and maybe help with optimization.
  • All sprintf calls have been replaced with snprintf to head off any potential buffer overruns.
  • Two of the buffers have been marginally increased in size to account for edge cases where the uint16_t control values take up all five potential decimal characters of the type (10,000+). This should never happen during normal operation because it's dependent on the data returned by the controller, but the Arduino SAMD core was complaining that the buffer could overrun.

Unrelated, but I also changed the capitalization on two Map constants for the uDrawTablet for style consistency. No functional change.

With the SAMD21 core this was creating compiler warnings that the worst-case string, with 5-digit uint16_t values, would not fit in the buffer. Increasing these buffer sizes slightly to account for that edge case, although it "should" never occur if the extension controllers are behaving as expected.
Being a little more cautious about these buffers and avoiding overruns, at the expense of a tiny bit of flash memory.
Style nitpick, no functional change.
@dmadison dmadison merged commit 9b0b087 into master May 11, 2021
@dmadison dmadison deleted the printDebug branch May 11, 2021 03:14
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

Successfully merging this pull request may close these issues.

None yet

1 participant