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

25 commits

Author SHA1 Message Date
Michael Keller
834ce7c5eb Cleaned up debug code in Dshot. 2020-12-16 00:37:31 +01:00
Michael Keller
98b634adcd Removed deprecated Dshot commands to enable / disable bidirectional Dshot. 2020-12-12 21:35:29 +01:00
Sam Lane
4c99ad743d Rename FAST_RAM to FAST_DATA 2020-08-23 08:49:26 +01:00
Mimoja
43a7f93723
Fix build for statistics-disabled DSHOT telemetry
The USE_DSHOT_TELEMETRY_STATS define was is gating a closing bracket '}',
so that the scopes are breaking in case telemetry stats are not enabled.

This commit fixes this behaviour by moving the closing bracket out of the
ifdef.


Signed-off-by: Mimoja <git@mimoja.de>
2020-07-19 00:18:28 +02:00
Bruce Luckcuck
62adae7374 Fix ARMING_DISABLED_RPMFILTER when DSHOT bitbang is enabled
The function that checks for each motor having valid telemetry broke with the implementation of bitbang. Effectively the motor count was zero and this caused the logic to fall through with a false-positive. The check relied on a local motor count that was set when the PWM dshot was initialized. When bitbang is active this initialization no longer runs and the motor count was defaulting to zero. This was missed in the bitbang implementation.

Fixed to get the motor count from a common source initialized by both timer and bitbang dshot.

Also changed the logic to prevent a false-positive fallthrough if the motor count is zero (shouldn't happen).
2020-04-23 19:50:35 -04:00
jflyper
ff16686893 White space tidy 2020-02-17 23:54:57 +13:00
jflyper
adf6fd1764 DMA bit banging Dshot, first cut
F405 working (OMNIBUSF4SD target)
F411 not tested
F722 working, needs testing (OMNINXT7 target)
F74x not working

NOX target (temporary)

bb_dshot with telemetry on f4
bbshot f7 targets and fix crash due to missing debug pins

remove empty line

add empty lines

remove OMNIBUSF4 specific debug pins

add missing comma

add missing comma

Use separate bbTimerHardware array to fix unified targets

eliminate now unneeded timerGetByUsage

don't duplicate timer1 def

Add auto mode, rename dshot_bbshot to dshot_bitbang

remove newline

renamve various files

various changes to address feedback

address feedback

address feedback

add pacer timers to timer show

don't disable telemetry if dshot_bitbang is on or auto

Address feedback, add faster decode implementation based on bit banding, modify dma parameters to reduce required memory bandwidth on half

remove debug output

remove NOINLINE

Protect gpio direction change with critical sections

FIXWS_SAVE_INDEX

add static back in

no forward typedef

address review feedback

disallow proshot1000 with dshot bitbang

Extracted and plumbed up 'dbgPin'.
2019-09-04 16:06:48 +12: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
jflyper
bb8e0686c1 Rename overlooked Dshot command function name 2019-08-13 16:27:34 +09:00
mikeller
224342a321 Fixed 'NOINLINE' attribute. 2019-08-04 15:01:23 +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
a103de784e DMA Stream/Channel unification on LL-DShot 2019-07-31 11:59:02 +09:00
jflyper
b724ca6c3a Let LL Dshot to build without USE_DSHOT_TELEMETRY option 2019-07-30 02:45:43 +09: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
Bruce Luckcuck
0b420d5a49 Revise data structures for DSHOT telemetry stats to avoid high CPU load
Having the stats data structures incorporated into the `dmaMotors[]` array structure was causing excessive CPU load on F4. The actual cause is unknown, but likely some kind of negative cache interaction. Moving the stats to a standalone array separate from `dmaMotors[]` solves the problem.
2019-05-04 17:37:50 -04:00
Thorsten Laux
f1e9c9f19a invert csum in telemetry 2019-05-02 14:18:19 +02:00
Thorsten Laux
4a7be33c25 invert dshot 2019-05-02 14:18:19 +02:00
Bruce Luckcuck
644d5713df Add DSHOT telemetry motor level packet stats
Captures packet quality statistics per motor to provide a platform for troubleshooting and in-flight alarms or warnings.

Continuously monitors and captures packet stats over the past second to be used to determine DSHOT telemetry link quality.

Update the CLI to move the DSHOT telemetry data/stats out of the `status` command and into a dedicated `dshot_telemetry_info` command. Reformatted the motor data to include the invalid packet percentages. Will aid in debugging by identifying ESC's that may be misconfigured (not supplying data), or those with problems generating high invalid packet percentages.

Data can later be used to generate OSD and beeper-based warnings if invalid packet percentages exceed thresholds.

Included a blackbox logging debug mode (`set debug_mode = DSHOT_RPM_ERRORS`) to record the per-motor invalid packet percentages in hundredths of a percent (so 123 is 1.23%).
2019-04-16 08:47:50 -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
Bruce Luckcuck
81c226e769 Periodically try to activate DSHOT telemetry if enabled but not working
If DSHOT telemetry is enabled but one or more ESC's are not supplying valid telemetry packets, then send the DSHOT command to enable telemetry once a second while disarmed until all ESC's are supplying telemetry.

Addresses the issue of the flight controller booting without the ESC's powered. In this case the initial command at boot to enable bidirectional telemetry will be missed by the ESC since they're not powered. If the battery is subsequently plugged in the ESC's will default to bidirectional telemetry disabled.

This change will detect that ESC's are not supplying telemetry and attempt to preiodically enable them.
2019-03-17 17:45:08 -04:00
Bruce Luckcuck
89ceb70b3c Add arming disabled check if RPM filter enabled but DSHOT telemetry not working
If the RPM filter is enabled, requires all motors to have received a valid DSHOT telemetry frame before arming is allowed. Otherwise sets the arming disabled reason `ARMING_DISABLED_RPMFILTER`.
2019-03-17 10:36:21 -04:00
Thorsten Laux
01e8d99937 fix ifdefs 2019-03-03 12:59:24 +01:00
Thorsten Laux
13c009da64 add shared.c 2019-03-03 11:34:32 +01:00