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

shell_putc() prints chars twice when using buffered output #22

Open
joemcool opened this issue Nov 13, 2021 · 0 comments
Open

shell_putc() prints chars twice when using buffered output #22

joemcool opened this issue Nov 13, 2021 · 0 comments

Comments

@joemcool
Copy link

shell_putc() calls both shell_writer() and obhandle->shell_bwriter() if both are not 0. This results in chars being printed twice, once by each writer. There is no way to avoid this condition when using buffered output, since shell_writer() is required by shell_init() and there's no way to undefined it.

Steps to reproduce:
--Initialize the shell as in the Shell_Basic example
--Add a buffered writer, something like:

void shell_buffered_writer(char* buffer, uint8_t count)  
{  
  // If we can write to a client  
  if(client==true && client.connected())  
  {  
    client.write(buffer, count);  
  }  
}

--Write enough output with shell_print() to trigger a buffered write
--Observe that the output is written twice

Proposed solution:
Rework the if statements in shell_putc() so that only one writer is called

joemcool added a commit to joemcool/Shell that referenced this issue Nov 13, 2021
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