Commit Graph

19 Commits

Author SHA1 Message Date
Lucas De Marchi 8d54276263 AP_Compass: BMM150: use common method to accumulate samples 2018-10-15 14:41:09 -07:00
Lucas De Marchi 4039b51810 AP_Compass: stop passing frontend pointer
Let AP_Compass_Backend call AP::compass() *once* instead of passing
the frontend pointer over and over.
2018-09-06 08:23:02 +10:00
Michael du Breuil fb77d0739e AP_Compass: Remove unused time calls, stash the time in the read loop 2017-09-07 19:53:14 +01:00
Andrew Tridgell f3d995a716 AP_Compass: improved robustness of BMM150 detection code
cope with bus errors on startup
2017-06-21 16:25:37 +10:00
Andrew Tridgell 68460144df AP_Compass: added retries on init in BMM150 2017-06-21 16:25:37 +10:00
Andrew Tridgell 9b093c4a33 AP_Compass: fixed a numerical issue in BMM150 driver
we were getting the following:

  ret=-32768 z=5 rhall=6267 z1=23743 z2=712 z3=-1035 z4=0 xyz1=6264 dividend=163840 dividend2=-1073577207 divisor=5253

the signed/unsigned casts for rhall and xyz1 did not produce the
desired result
2017-06-21 16:25:37 +10:00
Andrew Tridgell 0623db98d6 AP_Compass: cope with bus errors in BMM150
if we have bus errors the BMM150 can get confused, giving rubbish
output. This uses the checked register code to reset, and a full soft
reset after 250ms of no samples.
2017-06-21 16:25:37 +10:00
Andrew Tridgell fa3d40af8a AP_Compass: fixed shift typo
this doesn't affect LE MCUs like STM32
2017-06-21 16:25:37 +10:00
Lucas De Marchi dd98fc75a9 AP_Compass: BMM150: fix sampling time
We configure the sensor with an ODR of 30 Hz. There's no need to keep
calling the update function at 100Hz.
2017-02-11 01:37:49 -08:00
Lucas De Marchi 5472bc4de1 Global: change Device::PeriodicCb signature
Remove bool return as it's never being used and not supported on PX4.
2017-01-14 10:03:54 +11:00
Andrew Tridgell bd8867be38 AP_Compass: cope with NULL dev pointer in driver probe functions 2016-11-09 17:08:11 +11:00
Andrew Tridgell 147b253e65 AP_Compass: make device IDs match PX4 drivers
match in-tree drivers to PX4Firmware drivers
2016-11-09 17:08:06 +11:00
Andrew Tridgell de7913e8e9 AP_Compass: implement device IDs for compass drivers 2016-11-09 17:08:04 +11:00
Andrew Tridgell 1c631ea037 AP_Compass: cleanup use of backend semaphores
fixed drivers that didn't protect accumulation counters
2016-11-09 17:08:01 +11:00
Mathieu OTHACEHE 152edf7189 Global: remove mode line from headers
Using a global .dir-locals.el file is a better alternative than
reincluding the same emacs header in every file of the project.
2016-10-24 09:42:01 -02:00
Gustavo Jose de Sousa b259356703 AP_Compass: BMM150: convert it to use Device periodic callback 2016-09-03 01:03:07 -03:00
Lucas De Marchi 667fca60f5 AP_Compass: BMM150: reduce lock region
Use a semaphore to update the accumulated values instead of using the
timer semaphore.
2016-09-03 01:03:07 -03:00
Lucas De Marchi 3ba27df405 AP_Compass: BMM150: minor refactors
- Correctly sort includes and add missing AP_Math.h
  - Use anonymous struct for trim_registers in _load_trim_values,
    renaming its members so they don't start with underscore
  - Don't change _dig* values when we failed to read from sensor
  - Add some blank lines
  - Make _dig_* members be inside a _dig struct
  - Use constrain_int32 instead of if/else chain
  - s/time_us/time_usec/
  - Construct raw_field with a single constructor in _update()
  - Add missing copyright notice
  - Group methods together in declaration
2016-07-06 10:04:05 -03:00
José Roberto de Souza 6e53854122 AP_Compass: Add BMM150 backend 2016-07-06 10:03:30 -03:00