Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AP_Stats: added semaphore to flttime update #12949

Merged
merged 1 commit into from Dec 3, 2019
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -76,6 +76,7 @@ void AP_Stats::flush()
void AP_Stats::update_flighttime()
{
if (_flying_ms) {
WITH_SEMAPHORE(sem);
const uint32_t now = AP_HAL::millis();
const uint32_t delta = (now - _flying_ms)/1000;
flttime += delta;
@@ -93,6 +94,7 @@ void AP_Stats::update_runtime()

void AP_Stats::update()
{
WITH_SEMAPHORE(sem);
const uint32_t now_ms = AP_HAL::millis();
if (now_ms - last_flush_ms > flush_interval_ms) {
update_flighttime();
@@ -67,7 +67,7 @@ class AP_Stats

void update_flighttime();
void update_runtime();

HAL_Semaphore_Recursive sem;
};

namespace AP {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.