mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-28 19:48:31 -04:00
Rover: print mode as string in logs
This commit is contained in:
parent
02c3083f60
commit
fb6b736c78
@ -120,6 +120,7 @@ static Parameters g;
|
||||
// prototypes
|
||||
static void update_events(void);
|
||||
void gcs_send_text_fmt(const prog_char_t *fmt, ...);
|
||||
static void print_mode(AP_HAL::BetterStream *port, uint8_t mode);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// DataFlash
|
||||
|
@ -460,7 +460,9 @@ static void Log_Read(uint16_t log_num, uint16_t start_page, uint16_t end_page)
|
||||
|
||||
DataFlash.LogReadProcess(log_num, start_page, end_page,
|
||||
sizeof(log_structure)/sizeof(log_structure[0]),
|
||||
log_structure, cliSerial);
|
||||
log_structure,
|
||||
print_mode,
|
||||
cliSerial);
|
||||
}
|
||||
|
||||
// start a new log
|
||||
|
@ -634,7 +634,8 @@ static void
|
||||
print_switch(uint8_t p, uint8_t m)
|
||||
{
|
||||
cliSerial->printf_P(PSTR("Pos %d: "),p);
|
||||
print_mode(m);
|
||||
print_mode(cliSerial, m);
|
||||
cliSerial->println();
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -511,29 +511,29 @@ uint16_t board_voltage(void)
|
||||
}
|
||||
|
||||
static void
|
||||
print_mode(uint8_t mode)
|
||||
print_mode(AP_HAL::BetterStream *port, uint8_t mode)
|
||||
{
|
||||
switch (mode) {
|
||||
case MANUAL:
|
||||
cliSerial->println_P(PSTR("Manual"));
|
||||
port->print_P(PSTR("Manual"));
|
||||
break;
|
||||
case HOLD:
|
||||
cliSerial->println_P(PSTR("HOLD"));
|
||||
port->print_P(PSTR("HOLD"));
|
||||
break;
|
||||
case LEARNING:
|
||||
cliSerial->println_P(PSTR("Learning"));
|
||||
port->print_P(PSTR("Learning"));
|
||||
break;
|
||||
case STEERING:
|
||||
cliSerial->println_P(PSTR("Stearing"));
|
||||
port->print_P(PSTR("Stearing"));
|
||||
break;
|
||||
case AUTO:
|
||||
cliSerial->println_P(PSTR("AUTO"));
|
||||
port->print_P(PSTR("AUTO"));
|
||||
break;
|
||||
case RTL:
|
||||
cliSerial->println_P(PSTR("RTL"));
|
||||
port->print_P(PSTR("RTL"));
|
||||
break;
|
||||
default:
|
||||
cliSerial->println_P(PSTR("---"));
|
||||
port->printf_P(PSTR("Mode(%u)"), (unsigned)mode);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -206,13 +206,15 @@ test_failsafe(uint8_t argc, const Menu::arg *argv)
|
||||
|
||||
if (oldSwitchPosition != readSwitch()){
|
||||
cliSerial->printf_P(PSTR("CONTROL MODE CHANGED: "));
|
||||
print_mode(readSwitch());
|
||||
print_mode(cliSerial, readSwitch());
|
||||
cliSerial->println();
|
||||
fail_test++;
|
||||
}
|
||||
|
||||
if (g.fs_throttle_enabled && g.channel_throttle.get_failsafe()){
|
||||
cliSerial->printf_P(PSTR("THROTTLE FAILSAFE ACTIVATED: %d, "), g.channel_throttle.radio_in);
|
||||
print_mode(readSwitch());
|
||||
print_mode(cliSerial, readSwitch());
|
||||
cliSerial->println();
|
||||
fail_test++;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user