AP_Logger: fixed a bug in wrapped log count

fixes #20687
This commit is contained in:
Andrew Tridgell 2022-05-05 18:29:05 +10:00
parent a6cd7ffd20
commit 43a947f390

View File

@ -682,7 +682,6 @@ uint16_t AP_Logger_File::get_num_logs()
} }
uint16_t high = find_last_log(); uint16_t high = find_last_log();
uint16_t ret = high; uint16_t ret = high;
uint16_t smallest = high;
uint16_t smallest_above_last = 0; uint16_t smallest_above_last = 0;
EXPECT_DELAY_MS(2000); EXPECT_DELAY_MS(2000);
@ -693,8 +692,7 @@ uint16_t AP_Logger_File::get_num_logs()
// not a log filename // not a log filename
continue; continue;
} }
smallest = MIN(smallest, thisnum); if (thisnum > high && (smallest_above_last == 0 || thisnum < smallest_above_last)) {
if (thisnum > high && (smallest_above_last != 0 || thisnum < smallest_above_last)) {
smallest_above_last = thisnum; smallest_above_last = thisnum;
} }
} }