forked from test34/can_wizard
adding support for changing prompt on the fly
This commit is contained in:
parent
823cb8d711
commit
49a969708c
1 changed files with 7 additions and 2 deletions
|
@ -55,8 +55,13 @@ void console_task_tx(void* arg) {
|
||||||
if (msg_to_print != NULL) {
|
if (msg_to_print != NULL) {
|
||||||
xSemaphoreTake(stdout_taken_sem, portMAX_DELAY);
|
xSemaphoreTake(stdout_taken_sem, portMAX_DELAY);
|
||||||
linenoiseHide(&ls);
|
linenoiseHide(&ls);
|
||||||
|
// if zero-length string - just refresh prompt. used for updating prompt
|
||||||
|
if(msg_to_print[0] != '\0') {
|
||||||
write(fd, msg_to_print, msg_to_print_size);
|
write(fd, msg_to_print, msg_to_print_size);
|
||||||
flushWrite();
|
flushWrite();
|
||||||
|
} else {
|
||||||
|
ls.prompt = "new prompt > ";
|
||||||
|
}
|
||||||
linenoiseShow(&ls);
|
linenoiseShow(&ls);
|
||||||
xSemaphoreGive(stdout_taken_sem);
|
xSemaphoreGive(stdout_taken_sem);
|
||||||
vRingbufferReturnItem(can_messages, (void *) msg_to_print);
|
vRingbufferReturnItem(can_messages, (void *) msg_to_print);
|
||||||
|
|
Loading…
Reference in a new issue