|
|
@ -60,8 +60,8 @@ void AP_Stats::init() |
|
|
|
|
|
|
|
|
|
|
|
void AP_Stats::flush() |
|
|
|
void AP_Stats::flush() |
|
|
|
{ |
|
|
|
{ |
|
|
|
params.flttime.set_and_save(flttime); |
|
|
|
params.flttime.set_and_save_ifchanged(flttime); |
|
|
|
params.runtime.set_and_save(runtime); |
|
|
|
params.runtime.set_and_save_ifchanged(runtime); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void AP_Stats::update_flighttime() |
|
|
|
void AP_Stats::update_flighttime() |
|
|
@ -91,12 +91,11 @@ void AP_Stats::update() |
|
|
|
flush(); |
|
|
|
flush(); |
|
|
|
last_flush_ms = now_ms; |
|
|
|
last_flush_ms = now_ms; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const uint32_t params_reset = params.reset; |
|
|
|
const uint32_t params_reset = params.reset; |
|
|
|
if (params_reset != reset || params_reset == 0) { |
|
|
|
if (params_reset != reset || params_reset == 0) { |
|
|
|
params.bootcount.set_and_save(params_reset == 0 ? 1 : 0); |
|
|
|
params.bootcount.set_and_save_ifchanged(params_reset == 0 ? 1 : 0); |
|
|
|
params.flttime.set_and_save(0); |
|
|
|
params.flttime.set_and_save_ifchanged(0); |
|
|
|
params.runtime.set_and_save(0); |
|
|
|
params.runtime.set_and_save_ifchanged(0); |
|
|
|
uint32_t system_clock = 0; // in seconds
|
|
|
|
uint32_t system_clock = 0; // in seconds
|
|
|
|
uint64_t rtc_clock_us; |
|
|
|
uint64_t rtc_clock_us; |
|
|
|
if (AP::rtc().get_utc_usec(rtc_clock_us)) { |
|
|
|
if (AP::rtc().get_utc_usec(rtc_clock_us)) { |
|
|
@ -105,7 +104,7 @@ void AP_Stats::update() |
|
|
|
// time base to Jan 1st 2016:
|
|
|
|
// time base to Jan 1st 2016:
|
|
|
|
system_clock -= 1451606400; |
|
|
|
system_clock -= 1451606400; |
|
|
|
} |
|
|
|
} |
|
|
|
params.reset.set_and_save(system_clock); |
|
|
|
params.reset.set_and_save_ifchanged(system_clock); |
|
|
|
copy_variables_from_parameters(); |
|
|
|
copy_variables_from_parameters(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|