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

listener: clear screen on multiple output #23986

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

julianoes
Copy link
Contributor

I suggest to clear the screen when using the listener with -n. This way the updates don't just scroll by which isn't legible but instead stay in place and update, similar to the top command.

I suggest to clear the screen when using the listener with -n.
This way the updates don't just scroll by which isn't legible but
instead stay in place and update, similar to the top command.
@julianoes julianoes requested a review from dagar November 20, 2024 00:28
Copy link

FLASH Analysis

px4_fmu-v5x
    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%     +68  [ = ]       0    .debug_info
    +0.7%     +68  [ = ]       0    ../../src/systemcmds/topic_listener/listener_main.cpp
  +0.0%     +27  [ = ]       0    .debug_line
    +1.4%     +27  [ = ]       0    ../../src/systemcmds/topic_listener/listener_main.cpp
  +0.0%     +24  +0.0%     +24    .text
    +2.4%     +20  +2.4%     +20    ../../src/systemcmds/topic_listener/listener_main.cpp
    +0.0%      +4  +0.0%      +4    [section .text]
  -0.0%     -16  [ = ]       0    .symtab
  -0.1%     -31  [ = ]       0    [Unmapped]
  +0.0%     +72  +0.0%     +24    TOTAL

px4_fmu-v6x
    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%     +68  [ = ]       0    .debug_info
    +0.7%     +68  [ = ]       0    ../../src/systemcmds/topic_listener/listener_main.cpp
  +0.0%     +27  [ = ]       0    .debug_line
    +1.4%     +27  [ = ]       0    ../../src/systemcmds/topic_listener/listener_main.cpp
  +0.0%     +16  +0.0%     +16    .text
    +2.4%     +20  +2.4%     +20    ../../src/systemcmds/topic_listener/listener_main.cpp
    -0.0%      -4  -0.0%      -4    [section .text]
  -0.0%     -15  [ = ]       0    [Unmapped]
  -0.0%     -16  [ = ]       0    .symtab
  +0.0%     +80  +0.0%     +16    TOTAL

@@ -113,6 +113,9 @@ void listener(const orb_id_t &id, unsigned num_msgs, int topic_instance,
fds[1].fd = sub;
fds[1].events = POLLIN;

// Clear screen
dprintf(1, "\033[2J\n");
Copy link
Member

Choose a reason for hiding this comment

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

Maybe only if num_msgs > 1? Or alternatively make sure we only fall into this case if it's going to be more than 1?

or catch it here perhaps? https://github.com/PX4/PX4-Autopilot/pull/23986/files#diff-95ea6d47bf95b7f58b56e2f57e462a07eee1d497fa4c1ff7f019f8e704470db6R59

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.

2 participants