1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-25 17:25:20 +03:00
Commit graph

75 commits

Author SHA1 Message Date
ctzsnooze
a8834ad14b
Mag scheduling improvements (#13166)
* Improved QMC driver, scheduled silent interval

* add ODR to drivers and use it to set the quiet period

* add MAG_TASK_RATE debug for testing

* don't do a read if the bus is busy - thanks, Petr

* refactoring and simplification, thanks to Steve

---------

Co-authored-by: Steve Evans <SteveCEvans@users.noreply.github.com>
2023-11-28 00:55:01 +00:00
pichim
84a04db8b9
Improved Magnetometer / Compass Bias Estimator (#12998)
* Rebased on master and clean-up (untested), this is still the initial method

* Included math.h in compass.c, so checks don't fail

* Change comments, compass is still only running at 167 Hz, not worth investing more

* Alternative method, using only mag data

* Removed unnecessary scaling and fine tuning

* Corrected comment

* Removed no longer needed debug DEBUG_MAG_TASK_RATE, comments and corrected some typos

* Improved readability and update of comment

* Rebased on master and resolved conflicts

* Included math.h and maths.h so checks don't fail

* Update src/main/sensors/compass.c

Co-authored-by: Mark Haslinghuis <mark@numloq.nl>

* Update src/main/sensors/compass.h

Co-authored-by: Mark Haslinghuis <mark@numloq.nl>

* Update src/main/sensors/compass.c

Co-authored-by: Petr Ledvina <ledvinap@gmail.com>

* Changes according to PR comments

---------

Co-authored-by: Mark Haslinghuis <mark@numloq.nl>
Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
2023-11-15 16:12:36 +01:00
Steve Evans
96e6b79430
Fix compass loop time (#13125) 2023-11-07 16:37:27 +11:00
pichim
9ada5638a3
Add magnetic heading as debug and magnetic declination for the Mahony filter (#13073)
* Add mag heading to GPS Rescue heading debug

* Roll and pitch compensated magnetic yaw

* Changes according to PR comments

* Encapsulate yawMag calculations

* Corrected naming

* Changes according to PR comments

* Changes so that Checks don't fail

* Added PARAM_NAME list

* Changes so that Checks don't fail

* Changes according to PR comments

* Update src/main/fc/parameter_names.h

Co-authored-by: Mark Haslinghuis <mark@numloq.nl>

* Changes according to PR comments

* 200Hz compass task

* fix wait status flag

* increase default ODR of HMC5883L to 75Hz

* fix spikes in MagYaw debug by re-calc only on new data

---------

Co-authored-by: ctzsnooze <chris.thompson@sydney.edu.au>
Co-authored-by: Mark Haslinghuis <mark@numloq.nl>
2023-09-27 01:01:22 +02:00
Mark Haslinghuis
949181e084
Add support for IST8310 compass (#12917)
* Add support for IST8310 compass

* fix read

* Using states

* Fixes after review
2023-07-10 15:47:12 +02:00
Mark Haslinghuis
af97415da2
CONFIG: Fix TODO MAG & I2C (#12545)
Fix mag
2023-04-10 08:38:00 +10:00
Homer
515e55ef0a
Rename FAKE to VIRTUAL (#12493)
* use_fake_xyz to use_virtual_xyz

* xyz_fake to xyz_virtual

* other fake to virtual

* all files fake to vrtual

* last touch on fake to virtual
2023-03-14 12:35:39 +01:00
Steve Evans
8ac81f86b2 Perform compass reads in the background 2022-02-27 14:24:55 +00:00
Steve Evans
d5f62be013 Trigger gyro SPI DMA reads in EXTI handler if supported and lock gyroTask loop to gyro to eliminate missed updates and jitter 2021-09-28 01:38:18 +13:00
Michael Keller
f4d840f5f8 Changed naming of SPI DMA resources to reflect the SPI bus number. 2021-07-28 00:55:55 +12:00
Steve Evans
87c8847c13 New SPI API supporting DMA
Call targetConfiguration() once before config is loaded and again afterwards in case the config needs to be changed to load from SD card etc

Drop SPI clock during binding

Remove debug

Add per device SPI DMA enable

Fix sdioPinConfigure() declaration warning

Reduce clock speed during SPI RX initialisation
2021-07-25 12:40:25 +12:00
krygacz
58ae3fdfd5 Support MPU925x internal magnetometer over I2C 2020-09-14 23:41:45 +02:00
mikeller
b7ee04127d Removed the unused setting 'mag_declination'. 2020-05-02 23:30:01 +12:00
Bruce Luckcuck
ad0e7154a7 Split initialization from gyro.c for flash savings
Move low performance requirements initialization code into gyro_init.c and optimize that for size.
2020-03-13 10:08:11 -04:00
jflyper
ff16686893 White space tidy 2020-02-17 23:54:57 +13:00
mikeller
cedcf2d7e2 Added calibration menu to CMS. 2019-11-19 13:59:52 +13:00
mikeller
a045a9c672 Improved compass calibration. 2019-11-19 01:08:44 +13:00
mikeller
4a7904695e Moved 'config.[ch]' into the 'config/' directory. 2019-10-28 11:17:25 +13:00
Bruce Luckcuck
365c6cb1f6 Move calibrationCompleted flag to a 4th element in the accZero structure
Allows the flag indicating that calibration was completed to be output in the values for `acc_calibration`.
2019-10-21 11:49:11 -04:00
Dominic Clifton
980df1536f Refactored arbitrary gyro and mag alignment.
The original implementation:

* removed the old 'alignment' variable
* did not require 'ALIGN_CUSTOM'
* always used rotation matrix
* had no additional per-pid-loop conditional logic.

Extract currently unused code into tests.
In preparation for either deleting or re-using in validateAndFixConfig.

Fix code style of some old boardalignment code.

De-duplicate vector rotation code.

Now that rotation code is exacted from `alignBoard` and now  doesn't use
`boardRotation` some if it was similar to the code in `rotateV` in
maths.c

Use DECIDEGREES for mag and gyro/acc custom alignments.

Use unnamed structure instead of `values`.

Redefine what 'custom' orientation means.

Move alignment test-only code into the tests.

Ensure gyro/mag custom alignment settings follow the enum variations.

This can't be applied to ALIGN_DEFAULT because, in the case of the MAG,
the default isn't actually known until the gyro is detected, see
`compassDetect`.

OMNIBUSF4/F7 - Don't use ALIGN_DEFAULT in target.h,
common_defaults_post.h does this now.

Comment cleanup.

Delete unused alignment code left from various tests/refactoring
efforts.

* Please do not squash this commit.

Fix SITL build by avoiding structure assignment with anonymous inner
struct.

The error from the build server was as follows:

```./src/main/common/sensor_alignment.c:49:5: error: missing initializer
for field ‘yaw’ of ‘struct <anonymous>’
[-Werror=missing-field-initializers]
     *sensorAlignment = CUSTOM_ALIGN_CW0_DEG;
     ^
In file included from ./src/main/common/sensor_alignment.c:27:0:
./src/main/common/sensor_alignment.h:80:17: note: ‘yaw’ declared here
         int16_t yaw;
                 ^
```

Cleanup sensor_alignment API.
2019-07-13 11:51:20 +12:00
MJ666
1a9c2891e7 Fix indentation 2019-01-07 23:42:49 +01:00
MJ666
240915f552 Move QMC5883 sensor detection to the end to avoid wrong detection as
much
as posible
2019-01-07 15:52:43 +01:00
MJ666
0b1c8441f4 Update Mag driver for generic target 2018-12-15 19:16:03 +01:00
jflyper
9ea1428d11 Introduce per device pin pre-init 2018-12-13 11:15:26 +09:00
jflyper
9c45eee0e6 Protect mag and baro against NULL instance 2018-11-23 16:02:35 +09:00
Blaine
eb5af3a161 Add support for the ST LIS3MDL 3-Axis Magnetometer per #6437 2018-09-16 19:56:13 -07:00
mikeller
ede204aa81 Removed some target dependencies, and added makefile target 'check-target-independence' to find dependencies. 2018-05-14 19:13:37 +12:00
blckmn
a9f74cd6df Removed excess trailing spaces before new lines on licenses. 2018-04-25 20:58:00 +10:00
blckmn
46fe22b4bd Direct license replacement 2018-04-22 09:22:46 +10:00
Míguel Ángel Mulero Martínez
73eb5d396e Add compass QMC5883L driver (#5309) 2018-03-04 11:45:54 +13:00
Míguel Ángel Mulero Martínez
37fa25606f Simplify HMC5883 Compass (#5289)
Remove the mag gain calculation. After some tests the maximun difference
is 6 degrees, so is not important.
2018-03-04 11:43:24 +13:00
Martin Budden
3116ef4008 Moved compass health check into compass.c 2018-01-21 14:51:59 +00:00
Martin Budden
78cc4f65a1 Avoided compass task wrapper function 2018-01-20 13:35:22 +00:00
Martin Budden
671382234a Enabled switch fallthrough checking by compiler 2017-12-23 19:46:40 +00:00
mikeller
b489d0ba9d Renamed 'parameter_group' to 'pg'. 2017-12-19 23:36:31 +13:00
mikeller
a8d34dabb0 Changed defines for GYRO/ACC/MAG/BARO/GPS/SONAR/OSD/BLACKBOX/CMS to conform to the USE_ convention. 2017-11-05 10:15:24 +13:00
Michael Jakob
ae8256f142 Updates according to ledvinap's recomendations 2017-10-17 23:28:18 +02:00
Michael Jakob
60b8e0f05e Configurable compass drivers based on jflyper's PR #3613
Eliminate static variables in mag drivers
AK8975 and HMC5883l driver cleanup
replace magic numbers with definitions
Switched AK8963/Ak8975 to 16 bit mode
Update Mag gain calculations to use integer varables (ledvinap
recomendation)
Update interrupt handling for HMC5883L
Reschedule compass task only if slave mode is realy active
Change bustye definitions to an enumeration set
Fix dispatch functions and remove redundant dispatch functions from Baro
and Mag drivers 
Fix unittest
2017-10-17 22:22:11 +02:00
Martin Budden
3d4f0bb137 Whitespace tidy 2017-07-05 06:36:22 +01:00
Martin Budden
2493c214b0 Created subdirectories in drivers directory 2017-04-12 08:06:22 +01:00
Martin Budden
60c2b812d1 Added runtime setting of gyro SPI pin 2017-03-26 07:43:51 +01:00
Martin Budden
faf1ecf0e2 Moved free standing items out of masterConfig into separate configs 2017-02-22 18:44:40 +00:00
Martin Budden
0bca49d8c4 Added PG config definitions 1 2017-02-22 09:43:05 +00:00
blckmn
8e9be424ce Removed more target specific conditionals from the main codebase 2017-02-19 17:28:29 +11:00
Martin Budden
f2b423525d Split gyro device out of gyro sensor struct 2017-02-06 00:00:32 +00:00
Martin Budden
5851b21e4a Removed a number of static config pointers 2017-02-01 12:58:29 +00:00
Martin Budden
79d4b2146d Preparation for conversion to parameter groups 2017-02-01 08:46:19 +00:00
Martin Budden
a47c073874 Used device pointer in detect functions 2016-12-07 09:16:42 +00:00
Martin Budden
4bb6820c42 Moved sensor detection into respective sensor modules 2016-12-05 15:26:14 +00:00
Martin Budden
60e2227396 Moved alignment from sensor into device 2016-12-05 06:49:14 +00:00