Hotfix: Improve PX4IO monitor command

This commit is contained in:
Lorenz Meier 2014-06-23 13:44:36 +02:00
parent 59dfca8507
commit d58a992e91
2 changed files with 24 additions and 20 deletions

View File

@ -197,8 +197,10 @@ public:
* Print IO status. * Print IO status.
* *
* Print all relevant IO status information * Print all relevant IO status information
*
* @param extended_status Shows more verbose information (in particular RC config)
*/ */
void print_status(); void print_status(bool extended_status);
/** /**
* Fetch and print debug console output. * Fetch and print debug console output.
@ -1850,7 +1852,7 @@ PX4IO::mixer_send(const char *buf, unsigned buflen, unsigned retries)
} }
void void
PX4IO::print_status() PX4IO::print_status(bool extended_status)
{ {
/* basic configuration */ /* basic configuration */
printf("protocol %u hardware %u bootloader %u buffer %uB crc 0x%04x%04x\n", printf("protocol %u hardware %u bootloader %u buffer %uB crc 0x%04x%04x\n",
@ -2013,6 +2015,7 @@ PX4IO::print_status()
printf("\n"); printf("\n");
} }
if (extended_status) {
for (unsigned i = 0; i < _max_rc_input; i++) { for (unsigned i = 0; i < _max_rc_input; i++) {
unsigned base = PX4IO_P_RC_CONFIG_STRIDE * i; unsigned base = PX4IO_P_RC_CONFIG_STRIDE * i;
uint16_t options = io_reg_get(PX4IO_PAGE_RC_CONFIG, base + PX4IO_P_RC_CONFIG_OPTIONS); uint16_t options = io_reg_get(PX4IO_PAGE_RC_CONFIG, base + PX4IO_P_RC_CONFIG_OPTIONS);
@ -2027,6 +2030,7 @@ PX4IO::print_status()
((options & PX4IO_P_RC_CONFIG_OPTIONS_ENABLED) ? " ENABLED" : ""), ((options & PX4IO_P_RC_CONFIG_OPTIONS_ENABLED) ? " ENABLED" : ""),
((options & PX4IO_P_RC_CONFIG_OPTIONS_REVERSE) ? " REVERSED" : "")); ((options & PX4IO_P_RC_CONFIG_OPTIONS_REVERSE) ? " REVERSED" : ""));
} }
}
printf("failsafe"); printf("failsafe");
@ -2853,7 +2857,7 @@ monitor(void)
if (g_dev != nullptr) { if (g_dev != nullptr) {
printf("\033[2J\033[H"); /* move cursor home and clear screen */ printf("\033[2J\033[H"); /* move cursor home and clear screen */
(void)g_dev->print_status(); (void)g_dev->print_status(false);
(void)g_dev->print_debug(); (void)g_dev->print_debug();
printf("\n\n\n[ Use 'px4io debug <N>' for more output. Hit <enter> three times to exit monitor mode ]\n"); printf("\n\n\n[ Use 'px4io debug <N>' for more output. Hit <enter> three times to exit monitor mode ]\n");
@ -3119,7 +3123,7 @@ px4io_main(int argc, char *argv[])
if (!strcmp(argv[1], "status")) { if (!strcmp(argv[1], "status")) {
printf("[px4io] loaded\n"); printf("[px4io] loaded\n");
g_dev->print_status(); g_dev->print_status(true);
exit(0); exit(0);
} }