Skip to content
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
6 changes: 6 additions & 0 deletions sys/console/full/include/console/console.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ int console_read(char *str, int cnt, int *newline);
#endif
void console_blocking_mode(void);
void console_non_blocking_mode(void);
/**
* Switch console echo state for input data on or off
*
* @param on Let console know if it should echo the input (!= 0),
* or disable the echo (= 0).
*/
void console_echo(int on);

int console_vprintf(const char *fmt, va_list ap);
Expand Down
8 changes: 5 additions & 3 deletions sys/console/full/src/console.c
Original file line number Diff line number Diff line change
Expand Up @@ -981,7 +981,7 @@ handle_nlip(uint8_t byte)
insert_char(&input->line[cur], byte);
if (byte == '\n') {
input->line[cur] = '\0';
console_echo(1);
console_echo(echo);
nlip_state = 0;

console_handle_line();
Expand Down Expand Up @@ -1160,8 +1160,10 @@ console_handle_char(uint8_t byte)
console_switch_to_prompt();
console_clear_line();
} else {
console_filter_out('\r');
console_filter_out('\n');
if (echo) {
console_filter_out('\r');
console_filter_out('\n');
}
}
if (!MYNEWT_VAL_CHOICE(CONSOLE_HISTORY, none)) {
console_history_add(input->line);
Expand Down