|
|
|
@ -160,7 +160,8 @@ bool AP_Compass_AK8963::init()
@@ -160,7 +160,8 @@ bool AP_Compass_AK8963::init()
|
|
|
|
|
/* register the compass instance in the frontend */ |
|
|
|
|
_compass_instance = register_compass(); |
|
|
|
|
set_dev_id(_compass_instance, _bus->get_dev_id()); |
|
|
|
|
hal.scheduler->register_timer_process(FUNCTOR_BIND_MEMBER(&AP_Compass_AK8963::_update, void)); |
|
|
|
|
/* timer needs to be called every 10ms so set the freq_div to 10 */ |
|
|
|
|
_timesliced = hal.scheduler->register_timer_process(FUNCTOR_BIND_MEMBER(&AP_Compass_AK8963::_update, void), 10); |
|
|
|
|
|
|
|
|
|
_bus_sem->give(); |
|
|
|
|
hal.scheduler->resume_timer_procs(); |
|
|
|
@ -230,8 +231,8 @@ void AP_Compass_AK8963::_update()
@@ -230,8 +231,8 @@ void AP_Compass_AK8963::_update()
|
|
|
|
|
Vector3f raw_field; |
|
|
|
|
uint32_t time_us = AP_HAL::micros(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (AP_HAL::micros() - _last_update_timestamp < 10000) { |
|
|
|
|
if (!_timesliced && |
|
|
|
|
AP_HAL::micros() - _last_update_timestamp < 10000) { |
|
|
|
|
goto end; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|