Browse Source

AP_Compass: AK8963: remove logging on fail to get semaphore

This is the only driver doing this, using the system_initializing() from
scheduler to log selectively. Remove the check together with removal of
unused wrapper methods to semaphore.
mission-4.1.18
Lucas De Marchi 9 years ago
parent
commit
b55294920b
  1. 35
      libraries/AP_Compass/AP_Compass_AK8963.cpp
  2. 3
      libraries/AP_Compass/AP_Compass_AK8963.h

35
libraries/AP_Compass/AP_Compass_AK8963.cpp

@ -236,7 +236,7 @@ void AP_Compass_AK8963::_update() @@ -236,7 +236,7 @@ void AP_Compass_AK8963::_update()
goto end;
}
if (!_sem_take_nonblocking()) {
if (!_bus_sem->take_nonblocking()) {
goto end;
}
@ -287,7 +287,7 @@ void AP_Compass_AK8963::_update() @@ -287,7 +287,7 @@ void AP_Compass_AK8963::_update()
_last_update_timestamp = AP_HAL::micros();
fail:
_sem_give();
_bus_sem->give();
end:
return;
}
@ -335,37 +335,6 @@ bool AP_Compass_AK8963::_calibrate() @@ -335,37 +335,6 @@ bool AP_Compass_AK8963::_calibrate()
return true;
}
bool AP_Compass_AK8963::_sem_take_blocking()
{
return _bus_sem->take(10);
}
bool AP_Compass_AK8963::_sem_give()
{
return _bus_sem->give();
}
bool AP_Compass_AK8963::_sem_take_nonblocking()
{
static int _sem_failure_count = 0;
if (_bus_sem->take_nonblocking()) {
_sem_failure_count = 0;
return true;
}
if (!hal.scheduler->system_initializing() ) {
_sem_failure_count++;
if (_sem_failure_count > 100) {
AP_HAL::panic("PANIC: failed to take _bus->sem "
"100 times in a row, in "
"AP_Compass_AK8963");
}
}
return false;
}
void AP_Compass_AK8963::_dump_registers()
{
#if AK8963_DEBUG

3
libraries/AP_Compass/AP_Compass_AK8963.h

@ -68,9 +68,6 @@ private: @@ -68,9 +68,6 @@ private:
void _update();
void _dump_registers();
bool _sem_take_blocking();
bool _sem_take_nonblocking();
bool _sem_give();
float _magnetometer_ASA[3] {0, 0, 0};
uint8_t _compass_instance;

Loading…
Cancel
Save