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

86 commits

Author SHA1 Message Date
Mark Haslinghuis
f6985a8bfa
Bump clang version to 18 (#14116) 2025-01-04 00:43:33 +11:00
jpmreece
d22d8405c2
LED Dimmer (#13776)
* LED Dimmer

Build with EXTRA_FLAGS=-DUSE_LED_STRIP

Tested on SpeedyBeeF7V3

Added adjrange to update the ledstrip_brightness variable. This allows for easy changing of LEDs without having to connect to the configurator.

* Added Unit Tests, Space to Tab

Added unit tests into rx_controls_unittest.cc. The LED brightness is returned as 50 for testing purposes.

Changed tabs in ledstrip.c & .h and rc_adjustments.c to 4 spaces for coding standards.

* Update src/main/fc/rc_adjustments.h

Missed a tab in rc_adjustments.h

Co-authored-by: nerdCopter <56646290+nerdCopter@users.noreply.github.com>

* Update src/main/fc/rc_adjustments.c

Removal of empty line

Co-authored-by: nerdCopter <56646290+nerdCopter@users.noreply.github.com>

* Update rc_adjustments.c

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

* Update src/main/io/ledstrip.c

* Update src/main/io/ledstrip.h

* Update src/test/unit/rc_controls_unittest.cc

---------

Co-authored-by: nerdCopter <56646290+nerdCopter@users.noreply.github.com>
Co-authored-by: Jay Blackman <blckmn@users.noreply.github.com>
Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
Co-authored-by: Mark Haslinghuis <mark@numloq.nl>
2024-12-23 21:28:43 +01:00
ctzsnooze
776e8c7b3c
Refactor Rx code and better support 25Hz links (#13435)
* RX task update rate to 22Hz, to improve 25Hz link stability

* modified Rx code

* add LQ to debug

* use max of frameAge or FrameDelta

* Require a dropouit of 200ms, not 100ms, before RXLOSS

* remove FrameAge, use 150ms timeout 50ms checks

* fix tests and tidy up the comments

* Handle NULL input as before, log frame time

* possible solutions to review comment about names

* Remove rxFrameTimeUs

- prepare for direct use of lastRcFrameTimeUs
- refactor rx_spi callback

* remove global currentRxRateHz

* simplify updateRcRefreshRate

* re-name to recheck interval, return frame time debug

* Calculate RxRate only once

* use rxReceivingSignal for consistency

* use signalReceived not rxDataReceived for consistency

* suggestions from review PL

* move defines, thanks K

* fixes from review, thanks MH

* review changes, undo task interval change

rename bool rxIsReceivingSignal to isRxReceivingSignal
thanks Steve for resolving that tasks changes are not needed
thanks PL for your feedback also

---------

Co-authored-by: Petr Ledvina <ledvinap@hp124.ekotip.cz>
2024-10-01 09:23:24 +10:00
MikeNomatter
908f9cc32d
Remove d min confusion (#13908)
* rename dMin, remove D_MIN_GAIN_MAX

* rename vars

* fix logic

* fix logic

* Revert "fix tests"

This reverts commit c518c9c444.

* Revert "add yaw and other adjustment cases"

This reverts commit 2cacd4b360.

* Revert "fix unit test"

This reverts commit 3d88f4158a.

* Revert "fix D adjustments change dmax instead of D"

This reverts commit 7ee4e7f8af.

* Revert "Fix telemetry for Spektrum/SRXL (#13814)"

This reverts commit 04fe4b4461.

* review adjustments and test fixes

* Reapply "Fix telemetry for Spektrum/SRXL (#13814)"

This reverts commit eb7f8ee0fd.

* fix logic

* Apply suggestions from code review

Co-authored-by: Jan Post <Rm2k-Freak@web.de>
Co-authored-by: Mark Haslinghuis <mark@numloq.nl>

* fix d_max slider

---------

Co-authored-by: Jan Post <Rm2k-Freak@web.de>
Co-authored-by: Mark Haslinghuis <mark@numloq.nl>
2024-09-24 11:28:25 +02:00
MikeNomatter
a232655b42
Fix d adjustment (#13822)
* fix D adjustments change dmax instead of D

* fix unit test

* add yaw and other adjustment cases

* fix tests
2024-08-21 15:08:01 +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
haslinghuis
cbbc80ee90
Merge pull request #11779 from haslinghuis/update-pidprofile
Move TPA to PID profile
2022-10-13 21:09:49 +02:00
Mathias Rasmussen
9957ceb275 Fix function brace style 2022-10-12 16:31:55 +02:00
Mark Haslinghuis
f7547192b1 Move TPA to PID profile 2022-08-08 00:07:21 +02:00
ctzsnooze
f7c645bfcd update GPS code 2022-06-13 09:43:52 +10:00
ctzsnooze
2262dfc60e use Throttle Setpoint, not rcDATA(throttle), for TPA 2022-01-25 18:37:01 +11:00
Steve Evans
1526adfb44 Ignore duration of calcActiveAdjustmentRanges() and optimize RX_TASK_DECAY_SHIFT 2022-01-10 18:45:37 +00:00
Steve Evans
e8bf78178b No space in sizeof() as per Betaflight coding standard 2021-12-15 01:23:34 +00:00
Hans Christian Olaussen
3177cb3ec0 Update unit tests 2021-04-26 15:14:59 +02:00
Bruce Luckcuck
f688227db6 Only enable PINIOBOX task when needed
Previously the task was always enabled and there's no reason for it to be running if there are no boxID associations.

Saves a few cycles by not running. But has a bigger effect on the scheduler by minimizing the number of active tasks when possible.
2020-04-12 20:31:32 -04:00
mikeller
db4bd1f186 Cleaned up the scheduler. 2020-03-16 08:35:58 +13:00
Dominic Clifton
2fead0aedf Log disarm reason. 2020-01-16 20:16:11 +01:00
mikeller
5808bfd6f3 Improved tests. 2019-11-21 19:51:53 +13:00
mikeller
a045a9c672 Improved compass calibration. 2019-11-19 01:08:44 +13:00
mikeller
ef556c0f59 Introduced 'baroStartCalibration()' / 'baroSetGroundLevel()' to make barometer code more self contained. 2019-11-17 23:34:10 +13:00
mikeller
a21d0f5d31 Fixed potentially incorrect calculation in ACC calibration if non-default cycle number is used. 2019-11-17 10:58:28 +13:00
mikeller
4a7904695e Moved 'config.[ch]' into the 'config/' directory. 2019-10-28 11:17:25 +13:00
mikeller
0a0d3631a7 Renamed 'rxRuntimeConfig' to 'rxRuntimeState'. 2019-10-22 00:12:51 +13:00
mikeller
56f3788cff Fixed tests for adjustment ranges. 2019-06-05 00:56:41 +12:00
mikeller
75b1c0d4ce Removed 'slots' from the adjustment range configuration. 2019-06-05 00:56:37 +12:00
Krzysztof Matula
a0b410b902 unit tests update 2019-04-06 21:14:17 +02:00
mikeller
b5908f5bab Applied 'USE_ACC' consistently. 2019-02-08 09:51:48 +13:00
Bruce Luckcuck
42af168854 Optimize rc modes activation conditions processing
Analyze the rc modes activation conditions and only process configured entries. Previously the entire possible list was processed even though typically only a handful are configured.

Reduces the RX task processing time by about 25% (~44us to ~33us) with an average setup of 3 modes configured (F405, SBUS). Processing time savings will diminish as the user configures more modes. But typically far fewer than the maximum of 20 will be configured.
2019-02-05 16:05:16 -05:00
mikeller
18496fe745 Fixed unit tests using 'ledstrip.c'. 2019-01-21 01:01:05 +13:00
mikeller
1771ea687f Fixed tests. 2018-12-16 11:28:04 +13:00
mikeller
0bce8549ee Renamed 'fc/fc_' files to remove the double 'fc'. 2018-08-26 14:07:06 +12:00
mikeller
6de1c32d9d Added shadow copies for CLI and MSP. 2018-08-21 00:36:47 +12:00
mikeller
8abf138e2a Fixed tests, SPRACINGF3OSD. 2018-08-21 00:36:31 +12:00
Robert Lacroix
cb792f30d2 Delay allowing sticky modes
On bootup aux channels start out at default and allow sticky modes right away,
although they should only be allowed once they are actually not active.

_Legal disclaimer: I am making my contributions/submissions to this project solely in my personal capacity and am not conveying any rights to any intellectual property of any third parties._
2018-07-16 13:50:55 +02:00
Bruce Luckcuck
1e6e9e719f Add guard time between dshot beacon and arming/disarming
Tries to prevent DSHOT beacon commands from interfering with commands to set the motor direction.

Adds a 2 second delay after disarming before DSHOT beacon commands will be sent. This attempts to prevent the beacon commands from interfering with the motor direction reset that happens after using crash flip mode.

During arming if a DSHOT beacon command has been sent within 2 seconds the arming will be delayed until the 2 seconds have passed. This attempts to prevent interference with the motor direction commands sent at arming.
2018-06-09 18:59:59 -04:00
jflyper
041bfb22c6 Create a pg for rxConfig 2018-05-27 09:13:04 +09:00
Bruce Luckcuck
ff59c37fdb Only allow gyro_to_use = BOTH if both detected gyros are the same type
Since we currently don't have per gyro configuration, trying to use two different gyro types simultaneously may not provide good results or lead to other unforeseen situations like attempting to initialize with settings not applicable to both hardware types.

This logic looks at the detected gyro types and resets to use only the first one if the user selected "BOTH" and they're different hardware types.
2018-05-03 10:34:13 -04:00
Bruce Luckcuck
2610344266 Disable stick command processing while ARMING_DISABLED_RUNAWAY_TAKEOFF is set
Addresses the rare possibility that if runway takeoff triggers and disarms while the pilot has the sticks in some valid stick command configuration. Prevents the stick command from processing until the craft is disarmed and the ARMING_DISABLED_RUNAWAY_TAKEOFF condition is cleared.

For example, if the pilot was mid throttle and went full yaw right and runway takeoff triggered, then camera control would have be entered.
2018-02-24 09:29:19 -05:00
Bruce Luckcuck
a32b05c284 Initial implementation of Runaway Takeoff Prevention (anti-taz)
Detects runaway pidSum values on takeoff and auto-disarms to prevent the "Tasmanian Devil" caused by incorrect props, wrong motor order/direction, incorrect flight controller orientation, etc.  After a successful takeoff and normal flight is detected the feature is disabled for the remainder of the battery.
2018-01-31 07:36:16 -05:00
Martin Budden
7acebf8b34 Increased number of rate profiles to 6 2018-01-31 09:21:53 +00:00
mikeller
ee65eba88d Added selectable RaceFlight rates. 2018-01-19 00:38:14 +13:00
mikeller
b489d0ba9d Renamed 'parameter_group' to 'pg'. 2017-12-19 23:36:31 +13:00
Martin Budden
f527455d34 Blackbox header tidy 2017-11-23 18:24:09 +00:00
Martin Budden
36957d6075 When in ACRO mode use trim sticks to adjust RATE profile 2017-11-17 12:25:14 +00:00
jirif
cbefe71a73 Fast stick commands (#4208)
Implemented time-based stick command handling
2017-09-26 13:36:54 +03:00
jflyper
4a2ef89ea8 Revert left stick constraints and introduce context 2017-07-30 19:12:22 +09:00
mikeller
67acc6c7ec Added beeps to indicate the reason for arming being disabled. 2017-07-04 01:38:04 +12:00
mikeller
31df82db2d Reworked arming conditions. 2017-06-30 08:43:46 +12:00
Dominic Clifton
32fa109a64 Merge pull request #2852 from azolyoung/add-runcam-split-support
Add runcam split support
2017-06-23 08:48:07 +12:00
Michael Keller
f380c3d774 Fixed unit tests. 2017-06-19 13:33:29 +12:00