mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-05 23:43:58 -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
|
// prototypes
|
||||||
static void update_events(void);
|
static void update_events(void);
|
||||||
void gcs_send_text_fmt(const prog_char_t *fmt, ...);
|
void gcs_send_text_fmt(const prog_char_t *fmt, ...);
|
||||||
|
static void print_mode(AP_HAL::BetterStream *port, uint8_t mode);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// DataFlash
|
// 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,
|
DataFlash.LogReadProcess(log_num, start_page, end_page,
|
||||||
sizeof(log_structure)/sizeof(log_structure[0]),
|
sizeof(log_structure)/sizeof(log_structure[0]),
|
||||||
log_structure, cliSerial);
|
log_structure,
|
||||||
|
print_mode,
|
||||||
|
cliSerial);
|
||||||
}
|
}
|
||||||
|
|
||||||
// start a new log
|
// start a new log
|
||||||
|
@ -634,7 +634,8 @@ static void
|
|||||||
print_switch(uint8_t p, uint8_t m)
|
print_switch(uint8_t p, uint8_t m)
|
||||||
{
|
{
|
||||||
cliSerial->printf_P(PSTR("Pos %d: "),p);
|
cliSerial->printf_P(PSTR("Pos %d: "),p);
|
||||||
print_mode(m);
|
print_mode(cliSerial, m);
|
||||||
|
cliSerial->println();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -511,29 +511,29 @@ uint16_t board_voltage(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_mode(uint8_t mode)
|
print_mode(AP_HAL::BetterStream *port, uint8_t mode)
|
||||||
{
|
{
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case MANUAL:
|
case MANUAL:
|
||||||
cliSerial->println_P(PSTR("Manual"));
|
port->print_P(PSTR("Manual"));
|
||||||
break;
|
break;
|
||||||
case HOLD:
|
case HOLD:
|
||||||
cliSerial->println_P(PSTR("HOLD"));
|
port->print_P(PSTR("HOLD"));
|
||||||
break;
|
break;
|
||||||
case LEARNING:
|
case LEARNING:
|
||||||
cliSerial->println_P(PSTR("Learning"));
|
port->print_P(PSTR("Learning"));
|
||||||
break;
|
break;
|
||||||
case STEERING:
|
case STEERING:
|
||||||
cliSerial->println_P(PSTR("Stearing"));
|
port->print_P(PSTR("Stearing"));
|
||||||
break;
|
break;
|
||||||
case AUTO:
|
case AUTO:
|
||||||
cliSerial->println_P(PSTR("AUTO"));
|
port->print_P(PSTR("AUTO"));
|
||||||
break;
|
break;
|
||||||
case RTL:
|
case RTL:
|
||||||
cliSerial->println_P(PSTR("RTL"));
|
port->print_P(PSTR("RTL"));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
cliSerial->println_P(PSTR("---"));
|
port->printf_P(PSTR("Mode(%u)"), (unsigned)mode);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -206,13 +206,15 @@ test_failsafe(uint8_t argc, const Menu::arg *argv)
|
|||||||
|
|
||||||
if (oldSwitchPosition != readSwitch()){
|
if (oldSwitchPosition != readSwitch()){
|
||||||
cliSerial->printf_P(PSTR("CONTROL MODE CHANGED: "));
|
cliSerial->printf_P(PSTR("CONTROL MODE CHANGED: "));
|
||||||
print_mode(readSwitch());
|
print_mode(cliSerial, readSwitch());
|
||||||
|
cliSerial->println();
|
||||||
fail_test++;
|
fail_test++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g.fs_throttle_enabled && g.channel_throttle.get_failsafe()){
|
if (g.fs_throttle_enabled && g.channel_throttle.get_failsafe()){
|
||||||
cliSerial->printf_P(PSTR("THROTTLE FAILSAFE ACTIVATED: %d, "), g.channel_throttle.radio_in);
|
cliSerial->printf_P(PSTR("THROTTLE FAILSAFE ACTIVATED: %d, "), g.channel_throttle.radio_in);
|
||||||
print_mode(readSwitch());
|
print_mode(cliSerial, readSwitch());
|
||||||
|
cliSerial->println();
|
||||||
fail_test++;
|
fail_test++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user