Plane: fixed logging for new API

This commit is contained in:
Andrew Tridgell 2013-04-17 21:34:56 +10:00
parent 61c2befd4d
commit a12323c9fd

View File

@ -28,13 +28,6 @@ MENU2(log_menu, "Log", log_menu_commands, print_log_menu);
static bool
print_log_menu(void)
{
uint16_t log_start;
uint16_t log_end;
uint16_t temp;
int16_t last_log_num = DataFlash.find_last_log();
uint16_t num_logs = DataFlash.get_num_logs();
cliSerial->println_P(PSTR("logs enabled: "));
if (0 == g.log_bitmask) {
@ -60,23 +53,7 @@ print_log_menu(void)
cliSerial->println();
if (num_logs == 0) {
cliSerial->printf_P(PSTR("\nNo logs\n\n"));
}else{
cliSerial->printf_P(PSTR("\n%u logs\n"), (unsigned)num_logs);
for(int16_t i=num_logs; i>=1; i--) {
uint16_t last_log_start = log_start, last_log_end = log_end;
temp = last_log_num-i+1;
DataFlash.get_log_boundaries(temp, log_start, log_end);
cliSerial->printf_P(PSTR("Log %d, start %d, end %d\n"), (int)temp, (int)log_start, (int)log_end);
if (last_log_start == log_start && last_log_end == log_end) {
// we are printing bogus logs
break;
}
}
cliSerial->println();
}
DataFlash.ListAvailableLogs(cliSerial);
return(true);
}
@ -112,7 +89,7 @@ dump_log(uint8_t argc, const Menu::arg *argv)
(unsigned)dump_log_start,
(unsigned)dump_log_end);
Log_Read((uint8_t)dump_log, dump_log_start, dump_log_end);
Log_Read((uint16_t)dump_log, dump_log_start, dump_log_end);
cliSerial->printf_P(PSTR("Done\n"));
return 0;
}
@ -647,7 +624,7 @@ static void Log_Read_Current()
}
// Read the DataFlash.log memory : Packet Parser
static void Log_Read(uint8_t log_num, int16_t start_page, int16_t end_page)
static void Log_Read(uint16_t log_num, int16_t start_page, int16_t end_page)
{
cliSerial->printf_P(PSTR("\n" THISFIRMWARE
"\nFree RAM: %u\n"),