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

63 commits

Author SHA1 Message Date
Michael Keller
60e035be07 Fixed burst Dshot. 2021-11-02 08:46:15 +13:00
Michael Keller
80be08f050 Added resource allocation for DMA. 2021-09-28 02:44:07 +13:00
limonspb
464919c416 Motor output reordering for CLI and MSP
Fixed some code formatting

+fixReorderingArray() for EEPROM load/save and renamings

fix brace new line

moving MOTOR_OUTPUT_REORDERING to MSP2 betaflight specific

validateAndfixConfig now resets reordering motor array to default in case it is invalid
2020-07-27 20:10:37 -05:00
Dominic Clifton
105093211d Use CCM_CODE for pwmDshotSetDirectionInput andmotor_DMA_IRQHandler on
F3.

This reduces the cycles from 396 to 378 which results in 0% invalid
DSHOT telemetry packets!
2019-09-02 18:40:13 +02:00
Dominic Clifton
376d4c5294 Use FAST_CODE for motor_DMA_IRQHandler 2019-09-02 18:40:13 +02:00
Dominic Clifton
d016aa2fc4 DSHOT - Use cycle counting instead of recording timestamp in dshot motor_DMA_IRQHandler.
It turns out that two calls to micros() and the calculation of
directionChangeDurationUs took 581 cycles, vs 396 cycles without the
calls to micros() and deferred calculation of the duration which is only
needed in the CLI.

This brings the time down from around 7 microseconds to 5.5 microseconds
on an F3 at 72Mhz.

This makes the difference between 100% invalid telemetry and 4% invalid
telemetry on the first motor on the F3.

Squashed commits:
* Remove the forward declaration for `pwmDshotSetDirectionInput` and make
it static.
* Remove unneeded forward declaration of `motor_DMA_IRQHandler`.
* Remove duplication in DMA IRQ Handler.
  Doesn't affect resulting code but improves readability.
* Use an inline function to read DWT->CYCCNT.
* Remove unneeded forward declarations from cli.c now that the correct
header is included.
* Update DWT unlock method.
2019-08-29 20:01:20 +02:00
Dominic Clifton
a8262722d5 Refactor pwmDshotSetDirectionOutput.
Refactoring steps were as follows:
* Duplicate pwmDshotSetDirectionOutput to pwmDshotSetDirectionInput and
remove `output` variable in preparation for removing the `output` variable from each method.
* Delete all trace of `output` flag from `pwmDshotSetDirectionInput`
* Delete all trace of `output` flag from `pwmDshotSetDirectionOutput`
* Cleanup now that pwmDshotSetDirectionInput is only called when USE_DSHOT_TELEMETRY is
enabled.
* Remove redundant code paths.
* Move #ifdef outside the method.
* Removed parameters that are never needed.
* Delete unneeded forward declarations.
2019-08-28 08:57:04 +02:00
mikeller
a77f658b22 Fix board wedging if motor DMA is undefined for Dshot. 2019-08-11 21:16:16 +12:00
Thorsten Laux
835a5cac0e rebase
Reduce code by supporting only GCR, fix serial_4way, fix f7 dshot bidir

fix ws and eliminate superfluous buffer

use GCR constant instead of 32

decode optimization

bump 4way prot version mumber

bump if version
2019-08-02 13:49:48 +02:00
jflyper
7ddfd7dea6 Unify DMA stream and channel handling 2019-07-27 21:20:34 +09:00
jflyper
542146c702 Motor code refactor (Phase 1) 2019-07-17 01:33:39 +09:00
Thorsten Laux
f736561701 avoid double esc startup sounds on f7 2019-05-07 18:24:53 +02:00
Thorsten Laux
51ae8d99d2 Avoid high dshot lines with telemetry during startup 2019-05-02 15:26:00 +02:00
Thorsten Laux
4a7be33c25 invert dshot 2019-05-02 14:18:19 +02:00
Michael Keller
b4286c6ac9
Merge pull request #7935 from etracer65/dshot_command_packet_sequence
Refactor dshot command output scheduling logic
2019-04-14 23:25:33 +12:00
Michael Keller
ef94b5f077
Merge pull request #7843 from stawiski/warnings-fix
Fixed warnings.
2019-04-14 21:45:37 +12:00
Bruce Luckcuck
e2b5fc24bd Refactor dshot command output scheduling logic
Change to a state machine that tracks the progress of each dshot command in the queue as it moves through the various phases. Simplifies the code to make it easier to understand and maintain.

Transition to timing based on motor output cycle counts calculated from desired delays instead of using direct time comparisons. Since the output timing is always based on the motor update schedule, there were cases where if the time between motor updates was a significant percentage of the desired dshot command timing, then the output could get irregular and skip cycles (for example trying to use 2K pid loop with 500us timing conflicting with 1ms timing between dshot command outputs).
2019-04-08 08:19:38 -04:00
Thorsten Laux
5a759c56ef avoid dshot telemetry collisions
actually use calculated deadtime

fix whitespace and return value

fix ws

Address review feedback

fix ws
2019-03-26 21:51:25 +13:00
Mikolaj Stawiski
93d2566287 Fixed warnings. 2019-03-20 19:47:18 +11:00
mikeller
8cbdaa6267 Fixed burst Dshot for pins that have no DMA available. 2019-03-10 23:03:03 +13:00
Thorsten Laux
cec679ac60 incorporte review feedback 2019-03-03 11:33:14 +01:00
Thorsten Laux
d2147d4ece dshot bidir support for f7 2019-03-01 09:50:22 +01:00
mikeller
f8103b8c86 Added DMA mapping (readonly for now), and enabled timer management for all F4 boards.
Converting the universal target as well.

Simplified timer management some.

Added F722 support for good measuer.

Fixed SITL, tests.

Cleanup after rebase.

Added support for all timer consumers and F7.

Fixed 'USE_DMA_SPEC' for F3, some cleanups.
2019-02-28 00:25:43 +13:00
Thorsten Laux
e6a5dece85 ensure all timer channels are initialized when using dshot burst 2019-02-14 11:35:45 +01:00
mikeller
118e92c8b2 Aligned debug mode names with debug enum value names for more fun when debugging. 2019-01-27 12:04:38 +13:00
Thorsten Laux
7859e6d540 Add dshot command queue and limit max notch filter frequency 2019-01-12 12:25:30 +01:00
Michael Keller
297eebca74
Merge pull request #7349 from joelucid/fix_7347
fix Burst Dshot not working on F3 #7347
2019-01-09 16:21:24 +13:00
Thorsten Laux
5e37165645 fix Burst Dshot not working on F3 #7347 2019-01-08 21:27:00 +01:00
Thorsten Laux
8d4ed72e13 rpm telemetry based notch filter 2019-01-07 13:36:01 +01:00
Thorsten Laux
816da6cbf5 Dshot erpm telemetry on the signal line 2019-01-03 14:42:52 +01:00
mikeller
d49948f1fd Stop Dshot commands from running when ESCs not disarmed. 2018-06-17 00:37:57 +12:00
mikeller
906a4bcb78 Fixed Dshot command check on non-F7. 2018-06-14 01:46:24 +12:00
mikeller
51763a40f9 Made Dshot commands work in a non-blocking way. 2018-06-01 21:56:11 +12:00
Bryce Johnson
0045b36320 Added blocked dshot commands, Added post command delay
Moved the dshotcommand to happen in pwm_output_dshot.
Simplified the timing and repeats to happen on a group basis instead works better for dshotburst
2018-06-01 21:56:11 +12:00
blckmn
a9f74cd6df Removed excess trailing spaces before new lines on licenses. 2018-04-25 20:58:00 +10:00
blckmn
2be282e2d7 Some stragglers 2018-04-22 09:42:09 +10:00
Michael Keller
1840d645f2
Merge pull request #5098 from jflyper/bfdev-configurable-burst-dshot
DShot Make burst and non-burst runtime configurable
2018-02-12 12:48:34 +13:00
jflyper
9475988218 Make burst and non-burst runtime configurable 2018-02-11 23:24:07 +09:00
jflyper
825bc7aaba Add comment about duplicate initialization of timers and DMAs 2018-01-31 19:53:24 +09:00
Martin Budden
683c531f89 Removed useless timer header files 2018-01-20 11:22:55 +00:00
DieHertz
a89409a26a Added TIM_UP + burst DMA -based DSHOT to F3 2017-12-28 16:26:24 +03:00
jflyper
9f04705130 Use striding loadDmaBuffer to avoid buffer copy 2017-12-26 18:17:32 +09:00
jflyper
759e03c47e F4 Dshot-DMAR initial working version 2017-12-26 10:18:52 +09:00
jflyper
446606d9e6 Consolidate IOInit calls 2017-12-23 18:24:40 +09:00
Michael Keller
7ddf1e856d
Merge pull request #3996 from jflyper/bfdev-fix-motor-nchannel
Fix Motor N-Channel handling (Non-F7)
2017-11-07 07:58:37 +13:00
jflyper
70ba36ca0e Fix N-Channel handling for motors (non-F7) 2017-11-06 15:38:17 +09:00
DieHertz
9321c18e0a Apply rounding rules to dshot prescaler to minimize error 2017-10-15 02:45:07 +03:00
mikeller
05a8141139 Enable only DMA for channels that are used. 2017-08-25 16:12:52 +12:00
Martin Budden
87ae1616d6 Further better use of pwmAreMotorsEnabled 2017-07-06 08:55:26 +01:00
Martin Budden
3d4f0bb137 Whitespace tidy 2017-07-05 06:36:22 +01:00