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

Remove hardcoded line length limit #20

Merged
merged 2 commits into from
Mar 21, 2022

Conversation

abhaybd
Copy link
Contributor

@abhaybd abhaybd commented Mar 19, 2022

The length of a single print statement seems arbitrarily limited to 119 characters (120 byte buffer). This could create unforeseen issues where long print statements are being truncated unexpectedly, especially since this isn't documented anywhere.

This PR removes the line length restriction, by pre-calculating the required buffer length. Then the buffer is created, preferably using a variable-length array, or heap allocation if VLAs aren't supported.

This change would make the library more intuitive, since print statements aren't being truncated unexpectedly.

@CLAassistant
Copy link

CLAassistant commented Mar 19, 2022

CLA assistant check
All committers have signed the CLA.

@github-actions
Copy link

Memory usage change @ 0f3038b

Board flash % RAM for global variables %
arduino:avr:leonardo 🔺 +80 - +80 +0.28 - +0.28 0 - 0 0.0 - 0.0
arduino:avr:mega 🔺 +80 - +80 +0.03 - +0.03 0 - 0 0.0 - 0.0
arduino:avr:nano 🔺 +80 - +80 +0.26 - +0.26 0 - 0 0.0 - 0.0
arduino:mbed_nano:nano33ble 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:mbed_nano:nanorp2040connect 🔺 +14 - +14 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:mbed_portenta:envie_m4 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:mbed_portenta:envie_m7 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:megaavr:nona4809 🔺 +62 - +62 +0.13 - +0.13 0 - 0 0.0 - 0.0
arduino:sam:arduino_due_x_dbg 🔺 +16 - +16 0.0 - 0.0 N/A N/A
arduino:samd:mkrzero 🔺 +8 - +8 0.0 - 0.0 0 - 0 0.0 - 0.0
Click for full report table
Board examples/Arduino_Debug_Basic
flash
% examples/Arduino_Debug_Basic
RAM for global variables
% examples/Arduino_Debug_Advance
flash
% examples/Arduino_Debug_Advance
RAM for global variables
%
arduino:avr:leonardo 80 0.28 0 0.0 80 0.28 0 0.0
arduino:avr:mega 80 0.03 0 0.0 80 0.03 0 0.0
arduino:avr:nano 80 0.26 0 0.0 80 0.26 0 0.0
arduino:mbed_nano:nano33ble 0 0.0 0 0.0
arduino:mbed_nano:nanorp2040connect 14 0.0 0 0.0
arduino:mbed_portenta:envie_m4 0 0.0 0 0.0
arduino:mbed_portenta:envie_m7 0 0.0 0 0.0
arduino:megaavr:nona4809 62 0.13 0 0.0 62 0.13 0 0.0
arduino:sam:arduino_due_x_dbg 16 0.0 N/A N/A
arduino:samd:mkrzero 8 0.0 0 0.0
Click for full report CSV
Board,examples/Arduino_Debug_Basic<br>flash,%,examples/Arduino_Debug_Basic<br>RAM for global variables,%,examples/Arduino_Debug_Advance<br>flash,%,examples/Arduino_Debug_Advance<br>RAM for global variables,%
arduino:avr:leonardo,80,0.28,0,0.0,80,0.28,0,0.0
arduino:avr:mega,80,0.03,0,0.0,80,0.03,0,0.0
arduino:avr:nano,80,0.26,0,0.0,80,0.26,0,0.0
arduino:mbed_nano:nano33ble,0,0.0,0,0.0,,,,
arduino:mbed_nano:nanorp2040connect,14,0.0,0,0.0,,,,
arduino:mbed_portenta:envie_m4,0,0.0,0,0.0,,,,
arduino:mbed_portenta:envie_m7,0,0.0,0,0.0,,,,
arduino:megaavr:nona4809,62,0.13,0,0.0,62,0.13,0,0.0
arduino:sam:arduino_due_x_dbg,16,0.0,N/A,N/A,,,,
arduino:samd:mkrzero,8,0.0,0,0.0,,,,

Copy link
Contributor

@aentinger aentinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@aentinger aentinger merged commit 7d284fa into arduino-libraries:master Mar 21, 2022
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.

3 participants