File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -196,11 +196,21 @@ void Scheduler::boost_end(void)
196
196
*/
197
197
void Scheduler::delay_microseconds_boost (uint16_t usec)
198
198
{
199
- if (!_priority_boosted && in_main_thread ()) {
199
+ const bool main_thread = in_main_thread ();
200
+ if (!_priority_boosted && main_thread) {
200
201
set_high_priority ();
201
202
_priority_boosted = true ;
202
203
_called_boost = true ;
203
204
}
205
+ if (main_thread && !hal.util ->get_soft_armed () && usec >= 500 ) {
206
+ const uint32_t start_us = AP_HAL::micros ();
207
+ call_delay_cb ();
208
+ const uint32_t dt_us = AP_HAL::micros () - start_us;
209
+ if (dt_us >= usec) {
210
+ return ;
211
+ }
212
+ usec -= dt_us;
213
+ }
204
214
delay_microseconds (usec); // Suspends Thread for desired microseconds
205
215
}
206
216
You can’t perform that action at this time.
0 commit comments