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

74 commits

Author SHA1 Message Date
Eike Ahmels
083b595617
M10 ValSet support, unit connection and reconnect stability (#12799)
* WIP

* start of implement m10 code

* Fetch MON-VER from unit to check for unit version

* test nav5 m10 command

* missing empty lines

* offload detect to config file

* copy from hasli and organization

* fix platform.h include

* fix cli_unittest gps include

* fix cli_unittest for gps calls

* guard ublox version in gpsData

* print human readable hw version

* add utc_standard param and transfer with nav5 set
add nav5x message for autonomous mode for m10

* fix typo

* revert order structure, remove functions and reduce flash size

* revert order structure, remove functions and reduce flash size

* fix gps init and navx5 message

* generalized nav5 message

* remove unguarded debug

* change ubx version detection, baud rate negotiation fix and save found baud

* revert indentation

* revert indentation and refactorings

* the new code works with faster baud rate changes

* remove unguarded debug statement

* fix cli commands, major space reduce finished, removed extensions for now

* ubx version checks, add valset for M10

* beta of valset, change suggestions from ledvinap and macgivergim

* valset helper function and combine set nav rate valsets

* more valset refactoring

* remove big array and replace with macro

* remove assert, as it can stop bf completely

* refactoring to offsetof

* making reconnect more resilient, reorganize rate setup, so it doesnt get missed on init

* improved lost communcation detection, dont rely on ACK/NACK anymore

* paket rate debug

* adding debug mode, fixing major flight mode bug

* revert fake flight "isConfiguratorConnected"

* fixed proto detection, fixed reconfigure on too low updaterate

* valset doesnt always send ACK, so we dont wait for it

* size optimization, debug mode rename, minor fixes

* implemented some requested changes

* changed wait delay millisecond based

* fixes from ctzsnooze and zzXyz

* timer fixes

* CamelCase new settings names

* indent

* Fix failure to enter flight model on GPS Fix

* remove old commented out debugs

* simplify timeouts

* Clarify skip_acc and remove development valset code

* accept PL's advice to remove  >> (8 * 0

* Simplify package counter, remove reconfiguration based on packet count

* fix error in package count introduced in previous commit

* Fix delay detecting Configurator, ANA disable (for another PR)

* address payload comments and fix logical error

* indentation edits

* delete old enum

* log gps and firmware nav interval times

* fix payload size, inc Rx buffer to 256, ifDef for sw_proto

* remove token parsing (Petr suggestions)

* fixes from reviews

* Basic NMEA improvements

* Address comments from karate

* only check platform version - thanks zzyzx

* Fix for too many sats problem - thanks zzyzx

* tidy up comments, ifdef some ublox definitions

* Use Nav packet intervals, NMEA and UBX, for time delta

* Resolve comments and flatten conditionals

* editorial change

* single function for gpsSol.navIntervalMs

* adam-ah suggestion for payload optimisation

* ACK/NAK & polled message timer fixes

* Revert timer fixes - unexpected side effects

* Revert adam-ah suggestion for payload optimisation"

This reverts commit 42fc8c04fdbc436c9ef196b88f0764ffcbb9239f.
Broke the display of sat info when more than 32 sats in view

* implement a number of comments

* Fast task rate on new data, don't spam at the start

thanks adam-ah

* include PDOP for M10 via NAV-PVT

* Address some of PL's recent comments

* don't recalculate millis so many times

* tidy up baudrate connect code

* Split receiving of GPS bytes from processing by adding GPS_STATE_PROCESS_DATA

* Split receiving of GPS bytes from processing by adding GPS_STATE_PROCESS_DATA

* Preserve state whilst processing packets

* Set gpsData.state directly as gpsSetState() clobbers gpsData.state_position

* Restore original read time check

* Schedule gpsUpdate() to run immediately again when a packet is received for processing

* add debugs to display scheduler valuesl

* simpler scheduler solution

* minor debug change

* FIxes: M10 connection, pDop, NMEA disable; thanks zzyxz

NB: Breaks unit's neat reconnection methods
M8 need a lot of settling time before using the serial port

* ubx parse length sanity + cleanup + dashboard conditional compiles

* Address recent comments from PL

---------

Co-authored-by: ctzsnooze <chris.thompson@sydney.edu.au>
Co-authored-by: ZzyzxTek <zzyzx@zzyzxtek.com>
Co-authored-by: Steve Evans <Steve@SCEvans.com>
2023-08-12 12:10:55 +10:00
Ivan Efimov
dfef3bfb0e
Added throttle flight statistics (#12978)
* Added throttle flight statistics

* Changed rc_stats.c/h license header to a modern one

* rc_stats.c Style fix
2023-08-06 17:32:57 +02:00
Eike Ahmels
214946bc3f
AT32F435 camera control (#12913)
* [AT32] camera control

* remove comments

* change to mcu specific implementation

* fix includes
2023-07-10 15:54:20 +10:00
Alejandro Hernández Cordero
9dc9c51d3e
Added SITL Gazebo (#12346) 2023-02-19 06:39:54 +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
Jan Post
55237248b0
Dedicated task for GPS Rescue (#11972) 2022-11-12 20:38:35 +11:00
KarateBrot
f17a2af8c3 Lock altitude task to 100Hz
+ fix baro calibration
+ baro refactoring
2022-10-22 21:45:50 +02:00
KarateBrot
ddf1d46549 Remove old style definitions 2022-10-13 03:33:54 +02:00
phobos-
f10413392b VtxDevice over msp 2022-09-07 14:41:36 +02:00
ctzsnooze
b2241b32c3 Refactor Baro to floats, filter at position rate
convert pressure to altitude early
remove median filter
PT2 filtering upsampled to altitude function in position.c - thanks KarateBrot
baro task synced to position task - thanks Steve
PT2 implementation - thanks KarateBrot
ground altitude from filtered altitude
baro cali by average of calibration samples over cal period
adjust vario and smoothing defaults
don't say haveBaroAlt until cal is complete
reduce PIDs since Baro is faster
add baro smoothing values to blackbox header

Co-Authored-By: Jan Post <post@stud.tu-darmstadt.de>
Co-Authored-By: Steve Evans <SteveCEvans@users.noreply.github.com>
2022-09-02 14:38:40 +10:00
Martin Luessi
f3464d90cc Flashfs: Add support for asynchronous complete erase 2022-07-08 06:48:56 -07:00
Štěpán Dalecký
f85ebba6a4 Refactoring of IMU and ACC 2022-06-28 18:26:10 +02:00
J Blackman
eb31068614
Merge pull request #11500 from klutvott123/crsf-baud-negotiation-improvements-2
Fix CRSF baud negotiation
2022-04-22 10:31:25 +10:00
Hans Christian Olaussen
205b8cd2ad Initialize tasks data earlier 2022-04-16 16:01:50 +02:00
Hans Christian Olaussen
97b934a436 Change speed negotiation task priority
from lowest to low. same as telemetry task. should make it run more often when in failsafe for example
2022-04-15 17:53:15 +02:00
haslinghuis
5b5df65934
Merge pull request #11439 from SteveCEvans/compass_timing
Perform compass reads in the background
2022-03-01 21:37:07 +01:00
Steve Evans
fc8640154a Interrupt/DMA driven SX1280 interaction for ELRS 2022-02-28 19:50:36 +00:00
Steve Evans
8ac81f86b2 Perform compass reads in the background 2022-02-27 14:24:55 +00:00
Steve Evans
cc67b2e87c Naming changes suggested by Hydra 2022-01-28 20:31:47 +00:00
Mark Haslinghuis
a1a383d812 Rename attr
Keep single and plurar definition
2022-01-17 03:10:16 +01:00
Steve Evans
e7b61a928f Still update duration of next anticipated state even is current execution time is ignored 2022-01-14 03:22:52 +00:00
Steve Evans
c05ad2ec9b Fix issues impacting RX_STATE_MODES state duration and add DEBUG_RX_STATE_TIME 2022-01-12 23:38:03 +00:00
haslinghuis
8d52a36150
Merge pull request #11269 from SteveCEvans/rx_timing
Ignore duration of calcActiveAdjustmentRanges() and optimize RX_TASK_DECAY_SHIFT
2022-01-11 17:28:23 +01:00
J Blackman
51f870f1e8
Merge pull request #11261 from daleckystepan/tasks
Rename task id to task attr
2022-01-11 10:37:53 +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
c71302b35f Set CAMCTL task priority to TASK_PRIORITY_LOW 2022-01-09 23:10:01 +00:00
Štěpán Dalecký
a2debf5fbf Rename task id to task attr 2022-01-09 20:46:32 +01:00
Steve Evans
f5ee6cfd08 Ignore time taken to update profile with stick commands 2022-01-06 01:18:19 +00:00
Steve Evans
573984eb2a Support dynamic priority for all tasks priorities 2022-01-06 01:18:18 +00:00
Steve Evans
9bdf9c11e9 Split initialised/non-initialised task data 2022-01-06 01:18:17 +00:00
Steve Evans
7f147479fc If GPS serial data remains, reschedule task to run again after 1ms 2021-12-20 07:48:06 +00:00
Steve Evans
29d221502e Use peak tracking as default for task duration estimation rather than a moving average 2021-12-17 22:09:52 +00:00
Steve Evans
ab1baccc66 Track state execution time for OSD, baro, rx and GPS tasks and inform scheduler of next state execution time 2021-12-17 15:40:01 +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
Steve Evans
3087d10f53 Report task rate/Hz based on execution of whole state machine, not individual states where appropriate 2021-05-20 18:27:27 +01:00
tbs-fpv
761a0d2b1f cosmetic changes & minor improvements on speed negotiation logic 2021-05-20 11:09:35 +08:00
tbs-fpv
5ec30726a9 support baud rate negotiation if telemetry is disabled 2021-05-10 13:32:16 +08:00
mikeller
82ff9fb007 Fixed RX task check. 2021-03-31 08:21:26 +13:00
Steve Evans
25fcacf4c5 Split rx processing into three states to eliminate cycle time jitter
Allow tasks with state machines to control which state determines task duration

Fix unit tests
2021-03-27 23:28:41 +00:00
Bruce Luckcuck
f7d992b2bd Improve OSD blink logic
Changes the blink logic to be OSD task loop based instead of time based.

The previous logic used a 200ms time interval for the blinking which didn't align well with the default 12hz OSD update frequency resulting in the logic periodically missing intervals resulting in an inconsistent blinking.

As the revised logic is now tied to the OSD task iterations the blinking will be consistent. However due to the timing the blink will be slightly faster - 167ms (6hz) vs. the previous 200ms (5hz) intervals. Technically the blinking was 6hz before but stuttered every 5th blink.

Since the OSD task rate can be changed from the default 60hz, the logic will fall back to the time-based implementation for non-default task rates.
2020-12-25 12:41:44 -05:00
Alexey Stankevich
6bab981ff5 Move OSD task frequency logic to tasks.c 2020-10-05 22:08:58 +03:00
Michael Keller
94cd650472
Merge pull request #9981 from mikeller/fix_max7456_delay_problems
Fixed the MAX7456 loop time problems introduced by #9948.
2020-07-26 15:31:16 +12:00
mikeller
81abf873da Fixed stack size monitoring. 2020-07-08 20:08:39 +12:00
mikeller
cfc89c98a8 Fixed the MAX7456 loop time problems introduced by #9948. 2020-07-05 22:00:13 +12:00
Michael Keller
4e7f7112d0
Merge pull request #9682 from etracer65/piniobox_task
Only enable PINIOBOX task when needed
2020-06-22 00:28:27 +12:00
mikeller
4923057eb3 Fixed rangefinder reading. 2020-06-01 15:19:44 +12: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
Bruce Luckcuck
9fa0c3bb1e Fix CMS task rate; correct cmsDeviceCount logic; coding style cleanup
The CMS task was configured to run at 60hz but there was limiting logic in place to restrict it to every 50ms (20hz). Remove the extra logic and simply run the task at 20hz.

There was incorrect logic that checked if `(cmsDeviceCount < 0)` to not run the task. Firstly `cmsDeviceCount` can never be < 0, and secondly the task should not run when it is 0 as that means there are no registered `displayPort` devices. Generally fix the logic to used `unsigned` for `cmsDeviceCount`. It can only ever be increaded (new device registered) and there is no mechanism to "unregister" a device.

Lots of coding style cleanup.
2020-04-10 10:01:51 -04:00
mikeller
b020917c4b Prevent 0 in 'vbat_display_lpf_period' to avoid division by zero. 2020-03-25 00:41:50 +13:00
ctzsnooze
d63ba914c6 motor output scale
First draft

Change method to percentage compensation

fast sag filter with fast battery updates

Renaming, moving factors to init where possible

Names changed, display update frequency reverted to 50hz as it was

50Hz ESC Voltage sampling, battery sag lowpass for PID compensation.

increment PG_PID_PROFILE, element added to end of batteryConfig_t

all HZ_TO_INTERVALs set back to 200 to match battery task frequency of 200hz.

Add a flag to control vbat comp

Flag vbat_sag_comp_enabled allows battery compensation to be enabled or
disabled from the CLI. When disabled the battery voltage task is run at
50Hz and the battery compensation code is not run. When enabled the
voltage task is run at 200Hz and the compensation code runs. Constants
for the fast and slow rates are added to tasks.h. The default value for
vbat_sag_compensation is changed to 100 as we no longer need to use it
to disable the feature.

Fixed variable task frequency setting.

Added config validation to disable sag compensation unless ADC is used as the voltage data source.

Added conditionals, fixed naming.

Fixed build.
2020-03-22 17:15:08 +13:00