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,19 +2015,21 @@ PX4IO::print_status()
printf("\n"); printf("\n");
} }
for (unsigned i = 0; i < _max_rc_input; i++) { if (extended_status) {
unsigned base = PX4IO_P_RC_CONFIG_STRIDE * i; for (unsigned i = 0; i < _max_rc_input; i++) {
uint16_t options = io_reg_get(PX4IO_PAGE_RC_CONFIG, base + PX4IO_P_RC_CONFIG_OPTIONS); unsigned base = PX4IO_P_RC_CONFIG_STRIDE * i;
printf("input %u min %u center %u max %u deadzone %u assigned %u options 0x%04x%s%s\n", uint16_t options = io_reg_get(PX4IO_PAGE_RC_CONFIG, base + PX4IO_P_RC_CONFIG_OPTIONS);
i, printf("input %u min %u center %u max %u deadzone %u assigned %u options 0x%04x%s%s\n",
io_reg_get(PX4IO_PAGE_RC_CONFIG, base + PX4IO_P_RC_CONFIG_MIN), i,
io_reg_get(PX4IO_PAGE_RC_CONFIG, base + PX4IO_P_RC_CONFIG_CENTER), io_reg_get(PX4IO_PAGE_RC_CONFIG, base + PX4IO_P_RC_CONFIG_MIN),
io_reg_get(PX4IO_PAGE_RC_CONFIG, base + PX4IO_P_RC_CONFIG_MAX), io_reg_get(PX4IO_PAGE_RC_CONFIG, base + PX4IO_P_RC_CONFIG_CENTER),
io_reg_get(PX4IO_PAGE_RC_CONFIG, base + PX4IO_P_RC_CONFIG_DEADZONE), io_reg_get(PX4IO_PAGE_RC_CONFIG, base + PX4IO_P_RC_CONFIG_MAX),
io_reg_get(PX4IO_PAGE_RC_CONFIG, base + PX4IO_P_RC_CONFIG_ASSIGNMENT), io_reg_get(PX4IO_PAGE_RC_CONFIG, base + PX4IO_P_RC_CONFIG_DEADZONE),
options, io_reg_get(PX4IO_PAGE_RC_CONFIG, base + PX4IO_P_RC_CONFIG_ASSIGNMENT),
((options & PX4IO_P_RC_CONFIG_OPTIONS_ENABLED) ? " ENABLED" : ""), options,
((options & PX4IO_P_RC_CONFIG_OPTIONS_REVERSE) ? " REVERSED" : "")); ((options & PX4IO_P_RC_CONFIG_OPTIONS_ENABLED) ? " ENABLED" : ""),
((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);
} }

View File

@ -240,9 +240,9 @@ PX4IO_Uploader::upload(const char *filenames[])
close(_io_fd); close(_io_fd);
_io_fd = -1; _io_fd = -1;
// sleep for enough time for the IO chip to boot. This makes // sleep for enough time for the IO chip to boot. This makes
// forceupdate more reliably startup IO again after update // forceupdate more reliably startup IO again after update
up_udelay(100*1000); up_udelay(100*1000);
return ret; return ret;
} }