From 4eee3b1317b954c7c1df16ba2d264e2af695b77d Mon Sep 17 00:00:00 2001 From: murata Date: Fri, 5 Aug 2016 23:16:13 +0900 Subject: [PATCH] Copter: fix underflow in scheduler If fast_loop method executed time is over MAIN_LOOP_MICROS, scheduler.run method set value is 0. --- ArduCopter/ArduCopter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ArduCopter/ArduCopter.cpp b/ArduCopter/ArduCopter.cpp index 162fbb9a23..5dadd690bc 100644 --- a/ArduCopter/ArduCopter.cpp +++ b/ArduCopter/ArduCopter.cpp @@ -238,7 +238,7 @@ void Copter::loop() // the first call to the scheduler they won't run on a later // call until scheduler.tick() is called again uint32_t time_available = (timer + MAIN_LOOP_MICROS) - micros(); - scheduler.run(time_available); + scheduler.run(time_available > MAIN_LOOP_MICROS ? 0u : time_available); }