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

18421 commits

Author SHA1 Message Date
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
StNekroman
413d05d6c4
Make servos great again (#13451)
* Make services great again

* Make servos great again

* Changes according comments
2024-03-14 20:50:16 +01:00
Dominic Clifton
ecef09fdd7
Include a target's config.h before common_pre.h. (#13439)
Some gating in `common_pre.h` requires the target's `#define`s to be present, such as `#if defined(USE_LED_STRIP)`...
2024-03-12 17:26:42 +01:00
Steve Evans
af51e00773
Fix OSD task timing when using MSP (#13388)
Add uartWriteBuf() to improve performance
Optimised transmit buffer space check
Tidy up group duration calculations
Add uartBeginWrite, uartEndWrite and serialWriteBufNoFlush
Remove OSD grouping and check on the fly. Implement multi-pass artificial horizon rendering.
Fix rendering of camera frame
Fix stick overlay background rendering
Fix channel rendering
Fix ESC information rendering
Make Spec Prearm Display deterministic

Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
2024-03-11 17:46:06 +00:00
Mark Haslinghuis
915caae88d
Fix code style (#13429)
Fix GPS arming flag when BOXGPSRESCUE is enabled but procedure is not set to GPS_RECUE
2024-03-11 14:34:18 +01:00
Thomas Stibor
94be8f0673
Fix openocd makefile target by using TARGET_MCU_FAMILY (#13410)
* Fix openocd makefile target by using TARGET_MCU_FAMILY

The condition before this commit in mk/openocd.mk

ifeq ($(TARGET_MCU),STM32F4)
OPENOCD_CFG := target/stm32f4x.cfg

else ifeq ($(TARGET_MCU),STM32F7)
OPENOCD_CFG := target/stm32f7x.cfg
else
endif

ifneq ($(OPENOCD_CFG),)
OPENOCD_COMMAND = $(OPENOCD) -f $(OPENOCD_IF) -f $(OPENOCD_CFG)
endif

resulted in a not defined OPENOCD_COMMAND, because TARGET_MCU does not
contain the MCU family such as STM32F4, but e.g. STM32F411xE.

Thus executing e.g (note: CONFIG=BLACKPILL411 is a custom config I created for the Blackpill Board)

$ make DEBUG=GDB CONFIG=BLACKPILL411 openocd-gdb
make: *** No rule to make target 'openocd-gdb'.  Stop.

whereas after the patch:
$ make DEBUG=GDB CONFIG=BLACKPILL411 openocd-gdb

...
...
Linking STM32F411_BLACKPILL411
Memory region         Used Size  Region Size  %age Used
           FLASH:        7680 B        16 KB     46.88%
    FLASH_CONFIG:          0 GB        16 KB      0.00%
          FLASH1:      329297 B       480 KB     67.00%
   SYSTEM_MEMORY:          0 GB        29 KB      0.00%
             RAM:       62612 B       128 KB     47.77%
       MEMORY_B1:          0 GB         0 GB
   text	   data	    bss	    dec	    hex	filename
 331757	   5220	  56980	 393957	  602e5	./obj/main/betaflight_STM32F411_BLACKPILL411.elf
openocd -f interface/stlink-v2.cfg -f target/stm32f4x.cfg & ./tools/gcc-arm-none-eabi-10.3-2021.10/bin/arm-none-eabi-gdb ./obj/main/betaflight_STM32F411_BLACKPILL411.elf -ex "target remote localhost:3333" -ex "load"
Open On-Chip Debugger 0.12.0
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
WARNING: interface/stlink-v2.cfg is deprecated, please switch to interface/stlink.cfg
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : clock speed 2000 kHz
...
...
[stm32f4x.cpu] halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08009014 msp: 0x2001fff0
Start address 0x08009014, load size 336977
Transfer rate: 37 KB/sec, 11232 bytes/write.
(gdb) c
Continuing.
^C
Program received signal SIGINT, Interrupt.
0x08021a1c in scheduler () at ./src/main/scheduler/scheduler.c:695
695	                    task->taskAgePeriods = (cmpTimeUs(currentTimeUs, task->lastExecutedAtUs) / task->attribute->desiredPeriodUs);
(gdb) quit

works as expected.

In addition add also G4 and H7 TARGET_MCU_FAMILY support. When installing openocd the config files for G4 and H7, should
be provided in directory: /usr/share/openocd/scripts/target

$ grep -r TARGET_MCU_FAMILY | awk '/ STM32/{print $3}' | sort | uniq && find /usr/share/openocd/scripts/target -type f | grep "stm32f4x.cfg\|stm32f7x.cfg\|stm32g4x.cfg\|stm32h7x.cfg"

STM32F4
STM32F7
STM32G4
STM32H7

/usr/share/openocd/scripts/target/stm32g4x.cfg
/usr/share/openocd/scripts/target/stm32h7x.cfg
/usr/share/openocd/scripts/target/stm32f4x.cfg
/usr/share/openocd/scripts/target/stm32f7x.cfg

* Remove useless else
2024-03-08 11:14:26 +01:00
Mark Haslinghuis
6d98dbb742
Fix space in status output when gps version is unknown (#13423)
* Fix space in status output when gps version is unknown

* Refactor per review
2024-03-07 12:09:42 +01:00
Yura Kriachko
a0c0e191e1
Do not go into failsafe when the correct roll/pitch/yaw/throttle are sent via MSP_OVERRIDE (#13380)
* Override failsafe when MSP_OVERRIDE active

Fixes #13374

Set `rxSignalReceived = true` If MSP_OVERRIDE is active, so that it can be checked later. Otherwise, MSP controls are not considered in failsafe checks.

* Do override only if BOXMOODEOVERRIDE box is active as well

* Update msp.h

* Update msp.c

* Make sure that failsafe works when there is no signal from MSP

* Introduce rxMspOverrideFrameStatus to make a clear separation from rxMspFrameStatus

* Update src/main/rx/msp.c

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

* add msp_override_failsafe

* Update src/main/pg/rx.h

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

* Update src/main/rx/rx.c

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

---------

Co-authored-by: Mark Haslinghuis <mark@numloq.nl>
2024-03-05 09:59:34 +01:00
Steve Evans
ddc81cb4fa
Fix timer interval for battery and RSSI LED indication (#13412) 2024-03-04 13:29:38 +01:00
Mark Haslinghuis
47f3c31f54
Limit STM32F411 to use 32 leds only. (#13249)
* Add USE_LIMITED_LED_STRIP_OUTPUTS to limit certain MCUs to use maximum 32 outputs

* Fixes per review from Steve

* Use target.h gate
2024-02-27 16:13:23 +01:00
Mark Haslinghuis
37d27ad3e3
Fix Galileo toggling (#13384)
* Fix Galileo toggling

* try something else

* cleanup

* Fix per review from ledvinap

* Prevent buffer overflow on invalid numConfigBlocks
2024-02-27 15:58:39 +01:00
Steve Evans
79d031b8b6
Ensure consistent openssl behaviour with version 3.2.x and 3.3.x (#13385)
Ensure consistent openssl behaviour with verion 3.2.x and 3.3.x
2024-02-26 23:21:20 +01:00
Steve Evans
4f1b36fb30
Log the standard deviation of gyro cycle time in SCHEDULER_DETERMINISM and TIMING_ACCURACY (#13377)
* Log the standard deviation of gyro cycle time in SCHEDULER_DETERMINISM and TIMING_ACCURACY

* Update src/main/scheduler/scheduler.c

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

* Update src/main/scheduler/scheduler.c

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

---------

Co-authored-by: Mark Haslinghuis <mark@numloq.nl>
Co-authored-by: Jan Post <Rm2k-Freak@web.de>
2024-02-26 22:29:09 +01:00
tbolin
8a506d219f
Increase ez_landing_limit default to 15 (was 5) (#13375) 2024-02-26 12:19:51 +01:00
Steve Evans
d31daca2ff
Replace tabs with spaces (#13390) 2024-02-26 12:17:26 +01:00
Mark Haslinghuis
c6250fee6e
Add autocomplete for hydrating configuration (#13378) 2024-02-22 20:50:02 +01:00
SpektrumRC
92d5460b92
Spektrum telemetry minor fix to address false Fastboot alerts on radios with latest update (#13383)
Extended description of STRU_TELE_RPM, and changed fill values from 0xFF's to 0x00 to account for new fastbootUptime variable
2024-02-22 18:13:42 +01:00
Mark Haslinghuis
0daed9f7dc
Update SERIALRX_PROVIDER default (#13371)
Add telemetry for FPORT selection
2024-02-16 19:05:05 +01:00
Mark Haslinghuis
afeb6f17c4
Bump workflow action (#13355)
* Bump workflow action

* Address artifact issue
2024-02-15 13:47:38 +01:00
Steve Evans
e3e67b2ecb
Use cpu_late_10ths_percent_limit to set limit on % of late tasks in 10th of a % (#13330)
* Use cpu_late_10ths_percent_limit to set limit on % of late tasks in 10th of a %
Set CPU load late limit to 1% based on testing

* Update src/main/cli/settings.c

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

* Update src/main/scheduler/scheduler.h

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

* Update src/main/fc/core.c

* Update src/test/unit/arming_prevention_unittest.cc

* Update src/main/scheduler/scheduler.c

---------

Co-authored-by: Mark Haslinghuis <mark@numloq.nl>
Co-authored-by: Jan Post <Rm2k-Freak@web.de>
2024-02-15 12:50:32 +01:00
ASDosjani
a190ed98dc
Naming LED Strip overlay rates (#13363)
Add names to LED Strip overlay rates
2024-02-14 13:39:18 +01:00
Steve Evans
76e225aec9
For now disable 4way-if timeout (#13364) 2024-02-14 00:14:43 +01:00
Bryan Mayland
3ef7a188d0
Use fixed LED color table in RACE / BEACON LED profiles (#13339)
Use the non-custom color table when requiring fixed colors
2024-02-14 00:01:09 +01:00
Ivan Efimov
b8d99d7542
TPA_LOW tidy up (#13337) 2024-02-13 14:30:28 +01:00
Mark Haslinghuis
435fe2750e
Add gate to HD OSD elements (#13347)
Update osd_elements.c
2024-02-11 21:09:21 +01:00
Steve Evans
69999281c4
Permit 8kHz PID loop on F405 overclocked to 216MHz (#13356)
* Permit 8kHz PID loop on F405 overclocked to 216MHz

* Update src/main/config/config.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-02-08 18:28:57 +01:00
James
3726df1b71
Allow overriding the spi clock speed for icm42688 (#13346)
There was a report of glitches on the raw gyro output of an icm42688
which were resolved by reducing the the SPI clock speed. I don't think
a single report justifies changing the default speed or even adding a
CLI command to make it configurable, but it's relatively low impact to
allow the speed to be set at compile time by passing the value via
EXTRA_FLAGS and this will make it easier to see if changing the speed
solves any future cases that might turn up. Passing the original macro
name caused the cloud builds to fail, so this PR introduces a new, shorter
macro for setting the override value; ICM426XX_CLOCK

When passing a value for a macro through EXTRA_FLAGS for a manual compile
we need to use single quotes, e.g. to set 12MHz we could use

-D'ICM426XX_CLOCK=12000000'

When using the configurator to start a cloud build the value can be placed
in the "Custom Defines" text box as

ICM426XX_CLOCK=12000000

(or whatever value is desired)
2024-02-08 15:17:25 +01:00
Eike Ahmels
744ab454b1
Voltage detection method (#13350)
change voltage detection method and is voltage stable flag to make it resilient and synced to update battery task

Co-authored-by: Eike Ahmels <ea@weslink.de>
2024-02-07 00:07:42 +01:00
Steve Evans
24e7dabed3
Ensure MSP channel data is valid (#13352) 2024-02-06 13:43:39 +01:00
Mark Haslinghuis
d84ec8da63
Do not return MSP_RESULT_ERROR when succesful (#13328) 2024-02-04 11:52:52 +01:00