| 226 | } |
| 227 | |
| 228 | void Scheduler::delay(uint16_t ms) |
| 229 | { |
| 230 | uint64_t start = AP_HAL::micros64(); |
| 231 | |
| 232 | while ((AP_HAL::micros64() - start)/1000 < ms) { |
| 233 | delay_microseconds(1000); |
| 234 | if (_min_delay_cb_ms <= ms) { |
| 235 | if (in_main_thread()) { |
| 236 | const auto old_task = hal.util->persistent_data.scheduler_task; |
| 237 | hal.util->persistent_data.scheduler_task = -4; |
| 238 | call_delay_cb(); |
| 239 | hal.util->persistent_data.scheduler_task = old_task; |
| 240 | } |
| 241 | } |
| 242 | } |
| 243 | } |
| 244 | |
| 245 | void Scheduler::register_timer_process(AP_HAL::MemberProc proc) |
| 246 | { |