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

193 commits

Author SHA1 Message Date
Dmytro
7b39d3d296
Rename make folder to get rid of build error. (#12880)
When trying to build firmware with current directory in PATH environment
it scans for make command and generates "Permission denied" error in
case if current directory in PATH precedes /usr/bin/ directory.In my
case it was caused by incorrect pyenv init script.

Rename make folder to avoid errors like this.
2023-06-14 21:48:55 +02:00
SpencerGraffunder
aad197f791
Add GPS Lap Timer (#11856)
* Add gps lap timer

* change timing to GPS time instead of local time

* rebase and minor changes

* implement KarateBrot's suggestions

* follow ledvinap's suggestions, some OSD symbol changes

* move platform.h include to the top

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

* fix osd elements not showing, remove useless block

* cleanup, move pg stuff to pg folder

* cleanup from review

* minor mods to gps lap timer update, add number of laps tracked

* rename time variable

* add const to timeMs

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

* Update licenses, add is_sys_element macro

* update licenses

* round to nearest centisecond

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

---------

Co-authored-by: Jan Post <Rm2k-Freak@web.de>
2023-05-25 02:31:22 +02:00
J Blackman
6e05967840
Config handling updated to using repository for hydration (#12714)
* Modification to allow src/config to be a repo within a repo.

* Moving config files to own repository, and including using make.

* Removing all old config files.

* Correct CI errors.

* Playing with pulling the configuration files from the API

* Attempt to get past github actions issue

* Adding additional assistance when configs not hydrated

* Move the workflow to support hydration before outputing target list.

* Correction for revision targets

* Requires additional config hydration

* Better messaging on what to do:

- when you have a local config.h for a new target, ignore hydration of target list if you are building the target config in question.
- when you are doing any activity that does not require hydration, e.g. printing out help or installing arm_sdk etc.

* Anything suffixed with clean should be allowed through

* Adjusting to simply use a copy of the repository. Noting we will need to decide whether or not to include MFTR name in the config directory or not.
2023-05-10 11:12:07 +02:00
ctzsnooze
34057bfbc2
Refactor Feedforward Angle and RC Smoothing - mashup of 12578 and 12594 (#12605)
* Refactor Feedforward Angle and RC Smoothing

* update rc_smoothing at regular intervals

* add Earth Ref to OSD, update pid and rate PG

* Initialise filters correctly

* refactoring to improve performance

* Save 24 cycles in Horizon calculations, other optimisations

At a cost of 40 bytes

* save 25 cycles and 330 bytes in rc_smoothing

* feedforward max rate improvements

* typo fix

* Karatebrot's review suggestions  part one

* Karatebrot's excellent suggestions part 2

* more efficient if we calculate inverse at init time

Co-Authored-By: Jan Post <post@stud.tu-darmstadt.de>

* Horizon delay, to ease it in when returning sticks to centre

* fix unit tests after horizon changes

Co-Authored-By: 4712 <4712@users.noreply.github.com>

* horizon_delay_ms, default 500

* fix unit test for feedforward from setpointDelta

* Final optimisations - thanks @Karatebrot for your advice

* increase horizon level strength default to 75 now we have the delay

* restore Makefile value which allowed local make test on mac

---------

Co-authored-by: Jan Post <post@stud.tu-darmstadt.de>
Co-authored-by: 4712 <4712@users.noreply.github.com>
2023-04-23 22:03:18 +02:00
Jan Post
2792d518d1
Implement Stopwatch (#12623)
* Implement stopwatch to measure time periods

* Add float version of stopwatchGetMicros()
2023-04-07 10:16:43 +10:00
J Blackman
c224c075f8
Cleanup of USB drivers for AT32F4 (#12441)
* Cleanup of USB drivers for AT32F4
* F4 has different directories
2023-03-09 18:14:16 +11:00
J Blackman
80e9cfb998
Removing Brushed ESC auto detect (#12479)
- minimise pin "activation" on init.
2023-03-08 20:46:04 +01:00
J Blackman
4fff1b3c42
FIX: Legacy drivers required for STM32F411DISCOVERY target (#12411) 2023-02-25 21:19:45 +01:00
J Blackman
82566eb89a
REFACTOR: moving timer definitions to MCU locations. (#12397)
* REFACTOR: moving timer definitions to MCU locations.

* Now that the MCU directory needs to be included in the search path for includes, no need for target.h entry if filenaming is consistent.

* SITL needs the empty include.
2023-02-22 22:55:57 +01:00
J Blackman
693f55dcff
Simplified Local Build using Permanent Config (#12341) 2023-02-11 14:02:18 +11:00
J Blackman
72ab5b1275
Re-arranging VCP/IO/EXTI files in preparation for AT32 (#12289)
* Re-arranging VCP files in preparation for AT32

* Tab size 4

* Adding ADC driver for AT32F43x

* RCC code here is STM32 specific.

* Adding rcc.c for AT32

* pwm_output.c has very specific MCU coupling - to be re factored.

* Separating exti.c

* Split up io.c int stm32/io_stm32.c and at32/io_at32.c

* Adding in VCP files for AT32 and move timer

- note will require more cleanup

* Solving for sanity checks

* Inadvertent inclusion of timer.c for HAL

* rcc.c, timer.c and moving other spevific files out of the driver directory

* Adding I2C drivers

* Formatting

* ws2811 driver and usb_msc driver skeleton
2023-02-06 05:15:56 +01:00
Dominic Clifton
b3053be4dd
OctoSPI and Memory Mapped Flash support (#11825)
* STM32H730/STM32H750 - Fix use of USE_LP_UART1 instead of USE_LPUART1.

* STM32H723 - Prepare for being able to build for using non-internal-flash
config storage.

* STM32H723 - Prepare for using non-default strings.

* STM32H723 - Disable 'use custom defaults' when using USE_EXST.

* STM32H723 - Disable CUSTOM_DEFAULTS_EXTENDED when EXST is used.

* OCTOSPI - Add initialisation code.

* Add support for RAM_CODE.

* STM32H730 - Add support for RAM_CODE via the .ram_code attribute.

* OCTOSPI - Proof-of-concept for disabling/enabling memory mapped mode on
a running system.

NOTE: The HAL libs are compiled into a memory mapped region, and this cannot be used for OctoSPI access when memory mapped mode is disabled.

* OCTOSPI - Drop HAL support after determining that it's not suitable for
the memory mapped flash use-case.

* OCTOSPI - Sometimes, when disabling memory map mode, the abort fails.
Handle this by disabling the OSPI peripheral first and re-enabling it
afterwards.

* SD/FLASH - Update comments regarding possible solutions to the catch-22
issue with SD/SPI/QUADSPI/OCTOSPI pin configurations.

* OCTOSPI - Use device instance directly.

* OCTOSPI - Prepare W25Q flash driver for octospi support.

* OCTOSPI - Add octospi flash detection.

Note: The method to detect flash chips is similar to the method used for
QUADSPI and as such the code was used as a base. However the initial
OCTOSPI implementation doesn't support the non-memory-mapped use-case so
the un-tested code is gated with `USE_OCTOSPI_EXPERIMENTAL`.

The key differences are:
* uses octospi api not quadspi api.
* flash chip clock speeds should not be changed for memory-mapped flash
chips, bootloader already set it correctly.
* only certain flash chips are capable of memory mapped support.

* W25Q - Ensure w25q128fv_readRegister returns 0 if the receive fails.

* OCTOSPI - Implement octoSpiTransmit1LINE, octoSpiReceive1LINE and
octoSpiReceive4LINES.

* OCTOSPI - Specify device from init.

* OCTOSPI - More fixes and work on init.

Current status is that memory mapped mode is disabled and flash chip is
detected, but w25q128fv_detect should not be calling w25q128fv_reset.

* FLASH - Add comment regarding wasted flash space on targets that only
use one bus type for the flash chip.

* FLASH - Split `detect` into `identify` and `configure`.

* OCTOSPI - Extract flashMemoryMappedModeEnable/Disable to separate
methods.

* FLASH - Reduce size of targets that don't support the use of multiple
flash interfaces.

* Single-flash-chip targets usually only support one type of io
interface.
* Without this, compiler warnings are generated in `flashSpiInit` for
targets that only use flash chip drivers that support quadspi or octospi
that don't even use SPI for flash.

* FLASH - Use MMFLASH_CODE/DATA to conditionally move code/data to RAM.

Only targets compiled to support memory mapped flash chips need the some
specific code in RAM.  Otherwise the code/data should be in the normal
linker section.

* FLASH - W25Q Prepare for memory mapped flash usage.

* Wait/Delay functions must work with interrupts disabled.
* Code used for reading/writing must run from RAM.

* OCTOSPI - Implement remaining required methods.

* OCTOSPI - Fixes for earlier code (not last commit).

* FLASH - W25Q update timeout values from Datasheet Rev L.

* FLASH - Prepare flash driver for use when memory mapped flash is
disabled.

* System - Prepare microsISR for use when memory mapped flash is disabled.

* FLASH - Add support for CONFIG_IN_MEMORY_MAPPED_FLASH.

* Flash - Fix incorrect gating on cli flash commands.

When compiling with USE_FLASH_CHIP and without USE_FLASHFS there were
compiler warnings.

* MMFLASH - Fix release-mode build.

* FLASH - Allow SPI pins to be reconfigured when using CONFIG_IN_MEMORY_MAPPED_FLASH.

MMFLASH only works via QuadSPI/OctoSPI peripherals.

* EXST - Disable the 2GB workaround which is now causing a different
error.

The error we get with 'remove-section' enabled is:

"error in private header data: sorry, cannot handle this file".  The
cause of this new error in the objcopy codebase is an out of memory
condition, somehow the 2GB files and this error are related but the root
cause of both is still unknown.

* OCTOSPI - Add support for STM32H723.

* STM32H723 - Add linker scripts for EXST usage.

* NucleoH723ZG - Add build script to demonstrate OCTOSPI and Memory Mapped
flash support.

* FLASH - WUse the size in bits to set the size of the buffer.

* FLASH - Fix typo in W25N driver defines.

Was using W28N instead of W25N

* OCTOSPI - Fix missing semilcolon when compiling without
USE_FLASH_MEMORY_MAPPED.

* OCTPSPI - Fix missing call to 'memoryMappedModeInit'.

* SPRacingH7RF - Add example build script to allow for testing prior to
unified target / cloud-build support.
2023-02-04 06:24:01 +11:00
J Blackman
ecdbba2ce2
Cleanup make (#12179)
* Cleanup Makefiles

Given the targets are now simply the MCU, there is now a significant amount of duplication.

TODO:
- will possibly add STM32.mk for inclusion from STM32F4 etc to remove further duplication.

Noting it is now imperative that the gating is right.

* Removed the remnants of "features"

* Further clean up in preparation of new MCUs

* Typo for STM32F722xx

* Fix F411

* Last remnants of the _TARGETS lists.
2023-01-29 01:51:06 +01:00
Martin Luessi
f7b5df0ee8
Add support for Omron 2SMBP-02B barometer (#11173) 2022-12-27 22:17:27 +01:00
blckmn
b6b76d1b88 Adding board scratch space.
- Including ability to define custom defaults as char[] that is baked into the build
- removed unnecessary size of custom defaults header parsing (defines provided by build process or in board.h for devs).
2022-10-30 17:43:43 +11:00
phobos-
4ca3b9428f Review comment fixes 2022-09-07 14:41:36 +02:00
phobos-
f10413392b VtxDevice over msp 2022-09-07 14:41:36 +02:00
Steve Evans
701b0ae55c Remove F1 and F3 support 2022-06-14 19:10:13 +01:00
Steve Evans
ee740d1381 Add support for ICM42605 and ICM42688P for unified targets except STM32F411 (for space reasons) 2022-01-16 12:25:19 +00:00
Michael Keller
80be08f050 Added resource allocation for DMA. 2021-09-28 02:44:07 +13:00
KarateBrot
8649f1003f Dynamic notch refactoring
+ added new parameter group for Dyn Notch
2021-09-01 12:39:21 +12:00
Michael Keller
b414be320f
Merge pull request #10727 from ctzsnooze/PT2-PT3-options-for-filters 2021-05-25 01:53:53 +12:00
Michael Keller
e37619e559
Merge pull request #10653 from klutvott123/i2c-configurable-clockspeed 2021-05-21 02:06:31 +12:00
Hans Christian Olaussen
5c7ff1ff94 I2C configurable clockspeed 2021-05-17 13:57:44 +02:00
ctzsnooze
636d563abe major rc changes ctzsnooze 2021 2021-05-07 14:40:43 +10:00
Dominic Clifton
c8e741bd18 Add W25Q128FV driver (QSPI only)
* Enable QSPI flash chip drivers on NUCLEOH743 for some CI visibility.
* Rework QSPI flash detection.
* Supports chips that are in QSPI mode by default (factory).
* Supports chips that are in QSPI mode due to configuration (e.g. Quad
Enable in Non-Volatile on W25Q128FV)
* Supports chips that need 8 dummy bytes (e.g. W25Q128JV) and ones that
don't (e.g. W25N01G)
2021-04-28 05:30:08 +02:00
Bruce Luckcuck
37dbbd0755 Add GPS coordinates OSD elements display variants; add support for Open Location Code display
Adds variations in GPS coordinate OSD element display:
1. Fractional degrees with 7 digits (default) - 000.0000000
2. Fractional degrees with 4 digits - 000.0000
3. Degrees, minutes, seconds - 000^00'00.0"E
4. Open Location Code (sometimed called Google Plus Code) - 23ABC4R8+M37

Uses Open Location Code library from:
https://github.com/google/open-location-code

Added support for `STATE(GPS_FIX_EVER)` to differentiate from having a fix now (`STATE(GPS_FIX)`) vs. ever having a fix.

Logic change to only display coordinates from the GPS module once a fix has been initially established. This prevents displaying interim coordinates supplied by the GPS while the fix is still being establised as these coordinates can be inaccurate by hundreds of miles. Once a fix is established initially then the coordinates will continue to be displayed even if the fix is lost or degrades in quality.

Add logic to "blink" the coordinates if the 3D fix is lost after initially being established. Alerts the user that the coordinate display may be inaccurate or no longer being updated. We want to keep the coordinates displayed to aid recovery if the user loses the fix (like crashing upside down).

Replace GPS defines `LAT` and `LON` used throughout the code with the enumeration:
```
typedef enum {
    GPS_LATITUDE,
    GPS_LONGITUDE
} gpsCoordinateType_e;
```

The Open Location Code option is bounded with `USE_GPS_PLUS_CODE` to allow it to be excluded if needed for targets with limited flash space. It currently fits for F411 but we may have to remove it in the future.
2021-04-26 23:43:11 +12:00
KarateBrot
d02af7334c Added tracking of multiple dynamic notches per axis and replaced FFT with SDFT 2021-03-24 17:09:28 +01:00
Bruce Luckcuck
84b6730cdd Separate OSD warnings from OSD task and make available via MSP
Provides a properly implemented way for MSP query type OSD implementations (like DJI) to display OSD warnings. Separates the warnings generation from the OSD task and shares common code to make the text available for the OSD and/or via MSP. Eliminates the need to implement hacks and workarounds like using the `CRAFT_NAME` field to display warnings. Since the warnings logic is now separate, the OSD task does not need to be running unlike other hacks.

Adds the `MSP2_GET_OSD_WARNINGS` message formatted as follows:
```
byte  description
0     Display attributes including blink (see displayPortAttr_e in drivers/display.h)
1     Length of warning text
2-n   Warning text characters
```
2021-02-13 14:11:38 -05:00
Michael Keller
7fc3c7cea6 Renamed 'tuning sliders' to 'simplified tuning'. 2020-12-26 14:26:56 +01:00
IvoFPV
cff19dc113 Implement tuning sliders, add to CMS, MSP 2020-12-26 14:26:50 +01:00
limonspb
54d1c3051a Added persistent stats to CMS 2020-10-29 22:04:54 -05:00
Bruce Luckcuck
358fe5ce1c Split acceleration code into init and runtime to save flash space 2020-10-15 15:58:47 -04:00
Unknown
5bf4f71a6d Initial install of GHST driver
First pass at GHST driver including low-latency control, and basic telemetry.

Fix Ghost channel scaling

Use ghstChannelData instead of rxRuntimeState->channelData

Integrate PR feedback

Primarily de-tab and a few cosmetic changes.

Keep Travis CI happy

Removed unused function

Rework ghost driver to reduce time in ISR, move processing

As requested in PR review.
Fixed issue in telemetry driver, mAh consumed is transmitted as units of 10mAh, not 1mAh.

Resolve Packet Collision Issue with GHST

Send telemetry packets only within a well defined time slot after an incoming Rx packet.

Remove unnecessary comment

rxRefreshRate doesn't need to be dynamic.

Ghost - Remove special case from scheduler

No need to reschedule telemetry for the Ghost protocol.
2020-10-14 21:52:33 +13:00
mikeller
9e6b65680e Split mixer code into initialisation and runtime to reduce flash space usage. 2020-10-11 23:54:26 +13:00
Birk Tjelmeland
aa5066e443 Add MSP override mode
The MSP override mode allows for use of MSP togehter with
another RX feature like SBUS. When enabling the MSP override
mode all channels from the `msp_override_channels` bitmask
will be overwritten by data comming from MSP instead of the
main RX.
2020-07-27 13:01:38 +02:00
Bruce Luckcuck
99a9543968 Add support for LSM6DSO gyro/acc
Also supports the LSM6DSOX variant which has the additional machine learning core (not used by Betaflight).
2020-06-21 16:22:29 -04:00
Michael Keller
a8085bef8b
Merge pull request #9759 from etracer65/pid_init_separate
Split initialization from pid.c for flash savings
2020-06-22 00:35:42 +12:00
Michael Keller
b2e99c6651
Merge pull request #9771 from shellixyz/fix/frsky_crc 2020-05-07 23:39:01 +12:00
Michel Pastor
347483250b Fix CRC algo for FrSky S.Port and F.Port 2020-05-07 01:25:51 +02:00
Bruce Luckcuck
f3c1e4e07f Change gyro driver initialize-only files to size-optimized
The following driver files only contain initialization and configuration fuctions and were erroneously set up for speed-optimization. Moving them to size-optimization saves significant space. They all share common runtime functions contained in `drivers/accgyro/accgyro_mpu.c` which is correctly speed-optimized.

```
drivers/accgyro/accgyro_mpu6050.c
drivers/accgyro/accgyro_mpu6500.c
drivers/accgyro/accgyro_spi_mpu6000.c
drivers/accgyro/accgyro_spi_mpu6500.c
drivers/accgyro/accgyro_spi_mpu9250.c
drivers/accgyro/accgyro_spi_icm20689.c
```

Also added explicit `#ifdef USE_` around the code of some of the drivers missing it. Doesn't result in any space savings as the compiler optimizes out the unused functions. But better in the long-term as it will flag any cases where the code might be called without proper bounding.

Saves 10704 bytes on STM32F7X2.
2020-05-04 16:43:47 -04:00
Bruce Luckcuck
c06106e2d1 Split initialization from pid.c for flash savings
Move low performance requirements initialization code into pid_init.c and optimize that for size.

Saves 2688 bytes for target STM32F7X2.
2020-05-03 13:58:55 -04:00
Michael Keller
94005fda6c
Merge pull request #9584 from etracer65/bmi270_compile_optimization
Change BMI270 driver compilation to speed-optimized
2020-03-16 08:54:08 +13:00
Michael Keller
b729c3cc99
Merge pull request #9582 from etracer65/gyro_init_separate
Split initialization from gyro.c for flash savings
2020-03-15 10:16:30 +13:00
Bruce Luckcuck
cb14206b96 Change BMI270 driver compilation to speed-optimized
Also move the "fake" gyro driver from speed to size-optimized.
2020-03-14 11:29:53 -04: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
mikeller
ad4cc3d74f Cleaned up the inclusion of the microcode for BMI270. 2020-03-11 20:47:43 +13:00
jflyper
ec2aac314d [I2C] Introduce computational I2C waveform configuration for HAL based MCUs
Tested with
Nucleo-F722ZE I2C1 on PB8,PB9
Nucleo-H743ZI I2C1 on PB8,PB9 and I2C4 on PF14,PF15
2020-03-10 12:11:50 +09:00
Bruce Luckcuck
447cbac988 Add support for Bosch BMI270 gyro/accelerometer sensor 2020-03-08 18:56:50 -04:00
mikeller
39b62cb6c1 Added command to bind RX to MSP. 2020-02-06 13:36:27 +13:00