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

18500 commits

Author SHA1 Message Date
Mark Haslinghuis
c155f5830d
Update EEPROM version for 4.5 (#13498) 2024-04-28 11:51:47 +10:00
Steve Evans
565de1b68b
Use the cached value of useDshotTelemetry to ensure consistent runtime use if dshot_bidir is changed (#13589) 2024-04-28 09:31:50 +10:00
Mark Haslinghuis
54377940e0
Fix W25N01G lockup when using QUAD/OCTO SPI (#13584)
* Fix W25N01G lockup when using QUAD/OCTO SPI

* Move clock speed setting to configure
2024-04-25 23:41:54 +02:00
BloodSakura3774
5dae5f85b3
Sync usbd_product_string behavior (#13529)
* Update target.h
2024-04-24 08:06:38 +10:00
Mark Haslinghuis
92287b870d
Fix smartport over softserial using override (#13540)
* Fix smartport over softserial

* Constrain baudrateIndex does not work

* Reapply 57600 for SmartPort

* Use custom define for baudrate override

* Return when baudrate requested is above set limit of softserial

* Thanks ledvinap

* Fix macro name

* Cloud Build API does not allow define size > 32
2024-04-23 21:04:52 +02:00
Dominic Clifton
8d1d8872d6
Remove functionality to enter flash bootloader by sending 'F' on a UART configued for MSP. (#13572)
Remove functionality to enter flash bootloader by sending 'F' on a UART
configured for MSP.

* The proper way to reboot to the boot loader is by sending an
MSP_REBOOT command.
2024-04-23 11:53:53 +02:00
Petr Ledvina
7bf3928f91
RX - minor optimizations/minor cleanup (#13493)
* RX - minor optimizations/minor cleanup

- reuse millis() in rxInit
- rcData[] is float
- cleanup some float math
- fix GET_FRAME_ERR_LPF_FREQUENCY macro argument

* Update src/main/pg/rx.h

Co-authored-by: Jan Post <Rm2k-Freak@web.de>

---------

Co-authored-by: Petr Ledvina <ledvinap@hp124.ekotip.cz>
Co-authored-by: Jan Post <Rm2k-Freak@web.de>
2024-04-23 11:17:34 +02:00
Dominic Clifton
790fabcfbc
Fix inability to use the CLI resource command to configure LPUART_RX. (#13568)
* See https://github.com/betaflight/betaflight/issues/13567#issuecomment-2068693404
* See https://github.com/betaflight/betaflight/pull/13306#discussion_r1502901863
2024-04-23 02:04:03 +02:00
Mark Haslinghuis
e756c92f87
Use clang 15 as default (#13561) 2024-04-23 08:28:04 +10:00
Steve Evans
407ca40cbc
Fix pointer alignment to 8 bytes for MacOS unit tests (#13564) 2024-04-23 08:26:59 +10:00
Steve Evans
e0c0b64a4b
Nonblocking w25n01g code tidy up (#13562)
* In case of BUS_ABORT still process and linked segments

* Tidy up segments

* Set SPI clock speed for w25n01g
2024-04-22 23:14:20 +02:00
Petr Ledvina
d447d795f4
Improve unittest build system (#13554)
* unittest - fix duplicate symbols in unittests

Some symbols were declared again
With clang -fcommon, this resulted in allocatin in common segment and
prevented error.
(tentative definitions in C standard).
-fno-common (now default in clang https://reviews.llvm.org/D75056)
causes compilation errors.

Declarations are now marked extern.

* unittest - fix scheduler array size for unittest

Unittest needs extra space for canary

* unittest - fix missing include (needed for clang-16)

* unittest - remove unused varibles

-Werror in clang 15+

* unittest - increase max supported version to clang-16

* unittest - conditionaly disable useless output in unittests

* unittest - C++11 version of STATIC_ASSERT

* unittest - fix initializers for g++

- Change order of initializers to match order in struct
- make valueTable initializion consistent (necessary for C++)
- adapt controlRateConfig

* unittest - adapt scheduler_unitest for g++

scheduler_stubs.c is necessary to initialize task_attributes

* unittest - fix ledstrip unittest

only part of config was zeroed

* unittest - fix g++ warnings

- memcpy when length is known and \0 is not copied
- isError is local stub, no extern
- serialReadStub - don't memcpy into object, use initializer

* cli - cleanup cliGetSettingIndex

- compare only passed bytes (old version may read data after
name)
- input string is const

* unittest - fix ld warning from PG sections

move pg data sections after .rodata. Sections were marked as writable
due to relocation (!?). That marked .text output section
(containing .pg_data) as writable too and linker correctly complained
that executable section is writable.

* unittest - cleanup

* unittest - adapt after code cleanup, add gcc

- remove clang flags that are not necessary now (tested on clang-11
and clang-16)
- add support for gcc ( make test CC=gcc CXX=g++ )
- add suport for different optimization level (detects some code
problems) : make test OPTIMIZE=-O2
- fallback to clang on Linux too

* fixup! unittest - conditionaly disable useless output in unittests
2024-04-22 22:43:24 +02:00
Mark Haslinghuis
d20d42dd48
Fix index and ability to configure LPUART_RX due to typo (#13565)
* Fix typo

* Fixes per review
2024-04-22 21:04:31 +02:00
Jan Post
951ba1d42f
Fix debug mode DEBUG_ATTITUDE (#13570)
Fix channel 0
2024-04-22 18:53:11 +02:00
Steve Evans
f4d6a2ce43
Make w25n01g FLASH driver non-blocking for SPI (#13555) 2024-04-21 09:42:33 -05:00
Mark Haslinghuis
30415a35aa
Fix setting pid denom (#13535)
* Fix setting pid denom

* Thanks ledvinap
2024-04-21 11:58:49 +02:00
Petr Ledvina
4ae1a672b4
Fix clang unitests (#13551) 2024-04-21 16:51:23 +10:00
Petr Ledvina
1da9515427
STM32H725 - fix USE_SOFTSERIAL (#13546) 2024-04-21 16:50:16 +10:00
Petr Ledvina
9a7c225643
hmc5883l - fix wrong register value (#13537) 2024-04-21 16:49:14 +10:00
Eike Ahmels
6e62cdf067
set default of spec prearm screen to false if race pro not defined (#13547)
* set default of spec prearm screen to false if race pro not defined

* Simple variant - thanks Ledvinap

---------

Co-authored-by: Eike Ahmels <ea@weslink.de>
Co-authored-by: Mark Haslinghuis <mark@numloq.nl>
2024-04-20 23:19:45 +02:00
Petr Ledvina
76178a232f
I2C - unify i2cUnstick implementation, improve unstick a bit (#13541)
* I2C - unify i2cUnstick implemntation, improve unstick a bit

Three copies were spread in I2C implementations.

- i2cUnstick is a bit more carefull about clock stretching
- bus status is returned (return true when bus in idle state)

* fixup! I2C - unify i2cUnstick implemntation, improve unstick a bit

* fixup! I2C - unify i2cUnstick implemntation, improve unstick a bit

---------

Co-authored-by: Petr Ledvina <ledvinap@hp124.ekotip.cz>
2024-04-20 17:07:53 +02:00
David Pinho
723cfe0da7
make mpuIntExtiHandler() static (#13520) (#13549)
Function was made public in e126f1 for SPI case but seems unused outside the
module. Make it static for all preprocessor cases and remove declaration.
2024-04-20 15:22:30 +02:00
Eike Ahmels
2821cdab3a
new flash added: py25q128ha (#13516) 2024-04-19 06:38:51 +10:00
Petr Ledvina
71776a852b
Barometer - remove unnecessary static variables (#13496)
Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
2024-04-17 15:36:58 +02:00
J Blackman
7c8a55258d
Fix for ITCM overflow for F722 (#13521)
* Fix for ITCM overflow for F722

* Better comments in target.h
2024-04-11 20:43:27 +02:00
Steve Evans
7073b0e351
Baro and Mag driver check for I2C bus being busy (#13509)
* Baro and Mag driver check for I2C bus being busy

* Update src/main/drivers/bus_i2c_busdev.c

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

---------

Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
2024-04-10 01:53:33 +02:00
Petr Ledvina
5f2adf6e6f
Blackbox - use llog2 instead of LOG2 (#13495)
LOG2 is for compile-time evaluated expressions only.

Co-authored-by: Petr Ledvina <ledvinap@hp124.ekotip.cz>
2024-04-10 01:49:12 +02:00
Mark Haslinghuis
3bb3cdc7fc
Update softprops/action-gh-release (#13397)
Fix nightly builds
2024-04-10 09:47:50 +10:00
RoboSchmied
39c4603ac4
Fix typo in [tools.mk] (#13398)
fix typo in [tools.mk]

fix a small typo
tookchain -> toolchain
2024-04-10 09:37:36 +10:00
Petr Ledvina
aa9c4ad6c0
Fix config write (#13503)
* Config - add error checking into config_streamer.c,

CONFIG_STREAMER_BUFFER_SIZE does not match actually writen data in
some cases

* Config - fix buffer read ovefrflow

CONFIG_IN_RAM and CONFIG_IN_SDCARD used 4 byte byffer, but 32 bytes
got actually copied
CONFIG_IN_MEMORY_MAPPED_FLASH used 8byte buffer, but  but 32 bytes
got actually copied

* Config - add write functions into header

---------

Co-authored-by: Petr Ledvina <ledvinap@hp124.ekotip.cz>
2024-04-09 21:12:34 +02:00
ctzsnooze
5457032838
Use PDOP consistently, since it replaces HDOP (#13477) 2024-04-04 09:08:40 +11:00
tbolin
fb14365e66
Add ez_landing_speed parameter (#13411)
* Add ez_landing_speed parameter

The parameter is the speed at which ez_landing will be effectively disabled in tenths of meters per second.
Default value 50 (5 m/s).
EZLANDING bug field 5 is the contribution from this parameter to the ezlanding throttle cap.

* Correct ez_landing_speed logic and scaling

* ez_landing_speed should now raise the limit when the speed is above ez_landing_speed (previously only raised the limit if the speed was bellow, and had no effect above the limit)
* ez_landing_speed should now be scaled so that EzLanding is effectively disabled when speed >= ez_landing_speed (previously EzLanding would be disabeld when speed was at half of ez_landing_speed)

* Add stick input upper limit as EZLANDING debug 4

* Check for gps 3D fix before using gps speed for EzLanding

* Prevent division by 0 if ez_landing_threshold is set to 0

* Scale EzLanding speed to m/s from cm/s

* Update src/main/flight/mixer.c

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

---------

Co-authored-by: Mark Haslinghuis <mark@numloq.nl>
Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
2024-04-03 22:59:29 +02:00
ctzsnooze
ac846f7537
mag cal improvements (#13487)
* mag cal improvements

reduced threshold to start updating the previous cal
LED0 goes 'solid' only when the calibration start threshold is met
Don't zero previous Cal values until the update threshold is met
Mag_calib debug shows cal values at zero unltil they start being updated.

* beep ready, acc_calibration, and gyro_calibrated, for audio feedback

s

* improvements, thanks to feedback from PL

* change magCalEndTimeUs to magCalProcessEndTimeUs

* make process names more obvious

* use static boolean for initation and termination

* magCalProcessEndTimeUs to magCalEndTime

* LED ON, not toggle
2024-04-03 15:19:33 +02:00
ctzsnooze
cd8b6aa521
Improve IMU responsiveness, refactor (#13373)
* ensure that division is a float

* change logging, improve logic for recalibration

* Increase sensitivity, smooth center, higher max cogYawGain, renaming

* use non thrust vector maths, revise and add comments

* three factors to reduce ez_ef - speed, thrust vector, stick movement

re-naming and comments

* fix unittest, update comment

* normalize heading magnitude, add pitch and roll suppression factors

* ignore pitch factor on wings

because they 'normally' have forward velocity while flat
and their path while rolled usually does not change abruptly

* fix unit test

* fix dumb mistake blocking pitch suppression for non-wings

* fixes from review thanks PL

* refactor vector2normalize - thanks to karate

* Use X and Y for 0 and 1 in rMat

* Revert debugs, update comments from review

* lrintf for floats in debugs

* vector.h - implement some vector2* code as vector*

* Refactor IMU code

Move compass and Cog code into separate functions, separate gain
heuristics

- imuCalcGroundspeedGain
- imuCalcCourseErr
- imuCalcMagErr

Temporary refactor od imuDebug_GPS_RESCUE_HEADING, to be removed of optimized

* Simplify simulator build conditional compilation

* Adapt unittests to IMU after refactoring

* Maybe fix the test?

=

* Update src/main/flight/imu.c

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

* Update src/main/flight/imu.c

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

* Update src/main/flight/imu.c

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

* Update src/main/flight/imu.c

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

* Update src/main/flight/imu.c

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

---------

Co-authored-by: Petr Ledvina <ledvinap@hp124.ekotip.cz>
Co-authored-by: Mark Haslinghuis <mark@numloq.nl>
Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
2024-04-01 21:42:06 +02:00
Mark Haslinghuis
90841282b0
Add resource for LPUART (#13306)
* Add resource for LPUART

* Fix per review

* Fix per review 2
2024-03-27 09:57:02 +01:00
Mark Haslinghuis
52af623bcb
Add support for SPL07_003 barometer - based on DPS310 (#13427)
* Add support for GoerTek SPA006_003 barometer - based on DPS310

* Fix missing coefficients

* Fix tabs

* Fix per review Ledvinap

* Add missing coefs for pressure calculation

* Use chunk size of 9 bytes

* Fix MIN

* Update comment

* Be more explicit

* Update src/main/drivers/barometer/barometer_dps310.c

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

---------

Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
2024-03-27 00:07:14 +01:00
Károly Kiripolszky
9f36b400c9
Fix MSP version comment (#13471) 2024-03-26 23:18:49 +01:00
nerdCopter
7e0759076f
[github actions] release assets upload fix (#13462) 2024-03-21 23:57:55 +01:00
Petr Ledvina
2a6ae06e84
Fix qmc5883l lockup (#13467)
Data registers are locked until last/unlock register is read. New data
are not stored when locked and DRDY is not set.
On bus error, read may finish early (not reading unlock register) and thus
cause driver lockup.

Co-authored-by: Petr Ledvina <ledvinap@hp124.ekotip.cz>
2024-03-21 22:45:55 +01:00
Steve Evans
e359c36879
Use intptr_t for casting void * to an integer (#13463)
* Use intptr_t for casting void * to an integer

* Update src/main/cms/cms.c

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

---------

Co-authored-by: Mark Haslinghuis <mark@numloq.nl>
Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
2024-03-21 19:43:55 +01:00
Steve Evans
dc00d34bfd
Render spec screen over normal OSD (#13460) 2024-03-21 18:59:18 +01:00
Károly Kiripolszky
9dfa09a07e
Extend build info with defined flags (#13333)
* Extend build info with defined flags

* Fix CI

* Formatting

* Update license header

* Build options (WIP)

* Review fixes

* Add MSP build info generator

* Review fixes

* Add input hash

* Fix for PascalCase

* Add comment about MSP version
2024-03-21 18:29:22 +01:00
tbolin
b9b4b77e3b
Fix #13452 Write gps altitude to blackbox as signed value (was unsigned) (#13453)
Write gps altitude to blackbox as signed value (was unsigned)
2024-03-20 00:10:28 +01:00
Mark Haslinghuis
d3a4ea6d9a
Fix spektrum define (#13459)
* Fix spektrum define

* Fixes per review - thanks ledvinap
2024-03-19 11:14:53 +01:00
Petr Ledvina
0f109c8d0b
Fix bmp388 spi (and add BMP390) (#13458)
* Fix BMP388-SPI

SPI read returns dummy byte first when reading. Discard this byte on
SPI reads

* BMP388 - add supprot for BMP390

* fixup! Fix BMP388-SPI

---------

Co-authored-by: Petr Ledvina <ledvinap@hp124.ekotip.cz>
2024-03-19 11:11:53 +01:00
ctzsnooze
84d54051f1
In GPS Rescue current altitude mode, ensure that return height is not less than climb height (#13276)
* ensure that return altitude is not negative with current height mode

* Update src/main/flight/gps_rescue.c

* Update src/main/flight/gps_rescue.c

* Update src/main/flight/gps_rescue.c

---------

Co-authored-by: Mark Haslinghuis <mark@numloq.nl>
2024-03-18 21:00:47 +01:00
Petr Ledvina
3aabaf365d
Fix rx spi processing required (#13454)
* fix RX_SPI_PROCESSING_REQUIRED

- fix typo
- remove unreachable 'return false;' in rxSpiProcessFrame

* Simplify auxiliaryProcessingRequired

rxRuntimeState.rcProcessFrameFn never returns false

* fixup! fix RX_SPI_PROCESSING_REQUIRED

---------

Co-authored-by: Petr Ledvina <ledvinap@hp124.ekotip.cz>
2024-03-15 21:48:15 +01:00
Mark Haslinghuis
d22ea47736
Fix gating and mk cleanup (#13440)
Fix gating and cleanup
2024-03-15 21:45:27 +01:00
Mark Haslinghuis
55a607d46d
Fix typo (#13400)
Update target.h
2024-03-15 21:42:44 +01:00
Mark Haslinghuis
5bf45a2fae
Fix missing gyro defines for USE_SPI_GYRO (#13449) 2024-03-14 23:26:55 +01:00