Skip to content

Allow user to specify a bigger output buffer #25

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ void shell_putc(char c)
// Keep track of last byte
obhandle->buffertimer = millis();
// Empty buffer if it´s full before storing anything else
if (obhandle->buffercount >= 30) {
if (obhandle->buffercount >= CONFIG_SHELL_OUT_BUFFER_LEN) {
// Write output...
if (obhandle->shell_bwriter != 0)
obhandle->shell_bwriter(obhandle->outbuffer, obhandle->buffercount);
Expand Down
11 changes: 10 additions & 1 deletion Shell.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,15 @@
#define CONFIG_SHELL_FMT_BUFFER 70
#endif

/**
* This macro defines the length of the output buffer. This should be large
* enough to accommodate most large writes via the shell_print functions, but
* still small enough to fit in a single shell_bwriter call (ie, UINT_8T_MAX,
* 255 bytes). This buffer is also statically allocated, and should not be so
* large that it uses all the available RAM in the system.
*/
#define CONFIG_SHELL_OUT_BUFFER_LEN 30

/**
* End of user configurable parameters, do not touch anything below this line
*/
Expand Down Expand Up @@ -158,7 +167,7 @@ struct shell_command_entry {
};

struct shell_outbuffer_data {
char outbuffer[30];
char outbuffer[CONFIG_SHELL_OUT_BUFFER_LEN];
shell_bwriter_t shell_bwriter;
uint32_t buffertimer;
uint8_t buffercount;
Expand Down