1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-23 08:15:30 +03:00
Commit graph

27 commits

Author SHA1 Message Date
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
mikeller
db4bd1f186 Cleaned up the scheduler. 2020-03-16 08:35:58 +13:00
mikeller
d13e83b91b Cleaned up the RX handler some. 2020-03-10 00:55:52 +13:00
mikeller
ec5816eae0 Switched FPort to use RX frame deltas for refresh rate calculate. 2020-03-06 09:35:00 +13:00
mikeller
dc5671f34c Added protocol level RX frame rate measurement for FrSky FPort. 2020-03-06 09:35:00 +13:00
mikeller
53318e5e4d Renamed the existing RC smoothing related functionality. 2020-03-06 09:35:00 +13:00
jflyper
ff16686893 White space tidy 2020-02-17 23:54:57 +13:00
Bruce Luckcuck
f584780944 Gyro native rate sampling, filtering, and scheduler restructuring 2020-02-04 18:19:35 -05:00
Bruce Luckcuck
79dd6b6bcc Move the receiver inter-frame measurements down into the protocol layer
Adds accuracy to the frame rate measurements used to configure RC smoothing. Prevents looptime delays and jitter from affecting the calculations. Significantly improves the accuracy of the measurement in cases where CPU load is high.

Implemented so that each protocol can individually provide the functionality if appropriate. If a protocol doesn't support the more granular measurement then the system will fallback to the original measurement calculated in the RX task.
2019-11-19 14:45:07 -05:00
mikeller
4a7904695e Moved 'config.[ch]' into the 'config/' directory. 2019-10-28 11:17:25 +13:00
Michael Keller
e853636080
Cleaned up 'taskUpdateRxMain'. (#9073)
Cleaned up 'taskUpdateRxMain'.
2019-10-22 11:27:51 +13:00
Michael Keller
9e44cd3ca5
Renamed 'rxRuntimeConfig' to 'rxRuntimeState'. (#9072)
Renamed 'rxRuntimeConfig' to 'rxRuntimeState'.
2019-10-22 11:27:36 +13:00
mikeller
0a0d3631a7 Renamed 'rxRuntimeConfig' to 'rxRuntimeState'. 2019-10-22 00:12:51 +13:00
mikeller
6f124d0807 Cleaned up 'taskUpdateRxMain'. 2019-10-20 23:35:57 +13:00
mikeller
0565d1df1a Renamed 'fcTasksInit' to 'tasksInit'. 2019-10-20 23:18:17 +13:00
mikeller
4e8249e23a Fixed hanging on 'defaults nosave' when RX_SERIAL is enabled. 2019-09-25 10:01:56 +12:00
jflyper
0e63596abd Move motorConfig_s, motorDevConfig_s and associated PG handling into pg/motor.[ch] 2019-06-29 20:03:54 +09:00
Dominic Clifton
8039a7f42f Fix duplicate transponder task enable attempt.
Kept the second one since there is no rush to enable a transponder upon
boot.
2019-03-19 20:36:52 +01:00
Bruce Luckcuck
30672a37c5 Refactor OSD element display code
Remove the giant `select` block that contained all the code to generate the elements and transition them to individual functions called only when the element is active. Simplifies the code and results in a performance improvement as it's not necessary to fall through the large `select` statement for every element that will be drawn. The individual functions and the element to function mapping are moved to a new `osd_elements.c` file.

Moved the OSD related code files to a new `osd/` directory.

Also pre-analyze the active elements and only process those that are active. This also saves processing as it's not necessary to loop through all 50 or so elements when only a couple are active.

Various other cleanup and removal of stale or unnecessary code.

In the default configuration the element drawing phase of the OSD task is reduced from ~51us to ~35us - resulting in about a 30% decrease in processing time.
2019-02-21 14:03:25 -05:00
mikeller
b5908f5bab Applied 'USE_ACC' consistently. 2019-02-08 09:51:48 +13:00
jflyper
cc0e689bb5 Add USE_ACC conditionals 2019-02-04 20:37:43 +09:00
mikeller
38e1ce04df Reorganised interfaces, putting them where they are used. 2019-01-27 13:38:22 +13:00
mikeller
da52d827d4 Omit task names if task statistics are not collected. 2018-11-11 00:12:24 +13:00
jflyper
f788f062ea Reinstate rangefinder task 2018-10-30 12:43:42 +09:00
mikeller
0bce8549ee Renamed 'fc/fc_' files to remove the double 'fc'. 2018-08-26 14:07:06 +12:00
Renamed from src/main/fc/fc_tasks.c (Browse further)