Commit Graph

9319 Commits

Author SHA1 Message Date
s0up 9d021220e9 Merge branch 'master' of github.com:betaflight/betaflight into failsafe-fix 2018-06-22 20:41:38 -07:00
jflyper 23e18069ff Fix bad range for 3d_deadband_throttle 2018-06-23 09:13:41 +09:00
Bruce Luckcuck 1982c94780 RC smoothing retraining update - adds full support for CRSF
Adds in flight monitoring of the rx frame rate and adapts the filters if the frame rate changes. Primarily to add support for Crossfire with its ability to switch from 150hz to 50hz (and back) under some circumstances. Will work with any protocol - not CRSF specific.   So if future receivers add the ability to switch frame rates dynamically the logic should support them.

If the current rx frame rate is more than +-20% from the previously detected rate, then the process will retrain for the next 50 samples as long as the rate continues to be outside the 20% tolerance. Once 50 samples are collected the new frame rate is updated and the filter cutoffs are adjusted. Only filters set with their cutoffs = 0 (auto) will be adjusted. There is a 2 second guard time after a successful update before retraining can start again to prevent rapid switching back and forth.

The logic is optimized to not perform any training if the filters are set to manual cutoffs. So there is an opportunity for advanced users to choose specific cutoffs and reduce the PID loop load slightly. However this is not recommended for Crossfire or other protocols that might change their rx frame rate.

Updated the output of the `rc_smoothing_info` cli command to match the revised logic.
2018-06-22 20:10:06 -04:00
s0up 33b752a55c oops, derp 2018-06-22 17:08:48 -07:00
s0up 8627c53c19 failsafe fix potentially 2018-06-22 17:07:45 -07:00
Diego Basch d8b440948a Merge remote-tracking branch 'upstream/master' 2018-06-22 16:57:42 -07:00
Diego Basch 1f738f5aa4 rescueYaw should be signed 2018-06-22 16:56:38 -07:00
Faduf 765274699f Bugfix board alignment YupiF7 2018-06-22 22:19:40 +02:00
Michael Keller fb5d0e6dc6
Merge pull request #6173 from jflyper/bfdev-allow-pwm-and-softserial-to-coexist
Don't let PWM reset SOFTSERIAL
2018-06-20 20:19:57 +12:00
jflyper 8f65a79789 Remove RX_PARALLEL_PWM originated feature validation based on pins 2018-06-20 11:04:02 +09:00
Michael Keller 2d8c97e82d
Merge pull request #6161 from dbasch/altitude-offset-fix
[GPS Rescue] - Wait for altitude offset to be applied before updating idleTask data
2018-06-20 13:39:00 +12:00
s0up ce1a3edc03 put altitude offset getter within same ifdef as calculate estimated altitude 2018-06-19 09:06:29 -07:00
Michael Keller 713e72321b
Merge pull request #6166 from etracer65/gps_rescue_heading_fix
Fix gps rescue heading edge case
2018-06-20 01:02:56 +12:00
Michael Keller c6a5ab9b96
Merge pull request #6096 from AirBreak69/GPS_handle_negative_altitude_and_safer_maths_macros
GPS: handle negative and high altitudes; safer macros in maths.h
2018-06-20 01:01:02 +12:00
Bruce Luckcuck e83d5a6fc7 Fix gps rescue heading edge case
The yaw heading calculation didn't handle edge cases like 180 and -180 well.  Also cleaned up coding style.
2018-06-19 08:01:44 -04:00
s0up 911c8e406c wait for altitude offset to be applied before updating idleTask data 2018-06-18 14:43:35 -07:00
AirBreak69 91ac74ca9c
Scale MSP altitude back to 1m per lsb as it was before RTH 2018-06-18 23:16:52 +02:00
jflyper c2a37262a0 F4 dma buffer should not reside in CCM 2018-06-18 02:21:13 +09:00
mikeller f412e17e89 More USB include woes. 2018-06-17 17:54:18 +12:00
mikeller 448885bfc5 Fixed USB CDC includes. 2018-06-17 16:38:16 +12:00
mikeller 9492899aeb Made it fit on SIRINFPV. 2018-06-17 13:42:30 +12:00
mikeller 40f0c87906 Increased task frequency for the main task. 2018-06-17 13:40:15 +12:00
mikeller ad9a06289f Added workaround for target independence test. 2018-06-17 13:40:15 +12:00
mikeller 1bd502e9ac Removed function declaration. 2018-06-17 13:40:15 +12:00
mikeller d2c2bc3155 Reinstated USB connection debug. 2018-06-17 13:39:39 +12:00
mikeller 8107ad254c Fixed special case for SPRACINGF3OSD, fixed tests. 2018-06-17 13:39:39 +12:00
mikeller afb6068400 Removed tasks from PID loop that don't belong there. 2018-06-17 13:39:39 +12:00
Michael Keller a7fae6b8f0
Merge pull request #6099 from mikeller/fixed_usb_hid_channel_mapping
Fixed USB HID channel mapping in Windows.
2018-06-17 13:38:03 +12:00
Michael Keller 1fdef20bfc
Merge pull request #6121 from AlienWiiBF/QMC5883L_fix
Fix wrong QMC5883L mag detection
2018-06-17 13:36:02 +12:00
Michael Keller 0dd43c92dc
Merge pull request #6132 from mikeller/fix_pid_loop_slowness
Remove GPS rescue update from PID loop.
2018-06-17 13:35:39 +12:00
Michael Keller 9c55617f05
Merge pull request #6130 from mikeller/fix_dshot_commands_2
Stop Dshot commands from running when ESCs not disarmed.
2018-06-17 12:05:20 +12:00
Michael Keller 319b85777b
Merge pull request #6113 from etracer65/turtle_mode_disarm_cleanup
Only reset motor directon on disarming when crash flip mode was active
2018-06-17 11:41:30 +12:00
Michael Keller 7215505934
Merge pull request #6127 from mikeller/jh_fix_rtc_leap_offset
[From iNav] change year base for RTC time_t to correct leap processing
2018-06-17 11:27:16 +12:00
mikeller f8c3669ba5 Allow tests to define custom include directories (for libs). 2018-06-17 10:51:13 +12:00
Michael Keller 8a597c3228
Merge pull request #6131 from DieHertz/fix-f7-ledstrip
Marked LED DMA buffer FAST_RAM
2018-06-17 09:19:33 +12:00
mikeller f067324844 Fixed extra repeat. 2018-06-17 03:07:10 +12:00
Michael Keller 609e304643
Merge pull request #6122 from dbasch/performance-fix
[GPS Rescue] - Fix the calculation of acceleration magnitude average to run at gps u…
2018-06-17 02:36:48 +12:00
mikeller f129f7913c Added injection for GPS rescue commands. 2018-06-17 02:35:53 +12:00
Andrey Mironov e70840a17a Marked LED DMA buffer FAST_RAM
Changes not staged for commit:
2018-06-16 17:32:12 +03:00
mikeller ce4a95f33d Merge branch 'gps_rescue_update_fix' of https://github.com/codecae/betaflight 2018-06-17 02:04:24 +12:00
mikeller 7f107e2d9b Added updating of scheduled command time when motors become idle. 2018-06-17 01:45:10 +12:00
mikeller d49948f1fd Stop Dshot commands from running when ESCs not disarmed. 2018-06-17 00:37:57 +12:00
AirBreak69 8709ba441d
Tidy 2018-06-16 11:05:20 +02:00
mikeller 11098fba85 Made new includes conditional to F7. 2018-06-16 15:33:13 +12:00
Michael Keller 0a949c35b3
Merge pull request #6108 from mikeller/fix_dshot_commands
Fixed Dshot command check on non-F7.
2018-06-16 15:25:58 +12:00
stronnag f298a4ad45 change year base for RTC time_t to correct leap processing
Merge pull request #3307 from iNavFlight/jh_fix_rtc_leap_offset
2018-06-16 15:02:44 +12:00
mikeller b402d85a77 Holy moly, these drivers are a mess. 2018-06-16 14:53:25 +12:00
mikeller 24bbb524f6 Fixed build for F7. 2018-06-16 14:45:09 +12:00
Michael Keller 4466c6f5e3
Merge pull request #6123 from etracer65/beacon_arming_guard_time
Reduce beacon arming guard time to 1.2 seconds
2018-06-16 13:40:02 +12:00
Michael Keller 370897eda3
Merge pull request #6124 from etracer65/osd_stats_reset_dup
Clean up duplicate OSD stat reset
2018-06-16 13:37:46 +12:00
Michael Keller 9f0ace1302
Merge pull request #6125 from wind0r/remove_double_transponder_update
remove double transponder update call
2018-06-16 12:19:28 +12:00
Steffen Windoffer b5a34603fe remove double transponder update call 2018-06-16 00:23:21 +02:00
AirBreak69 66c6b8397e
Pseudo change to trigger test build 2018-06-15 19:31:06 +02:00
Bruce Luckcuck 7d783acafa Reduce beacon arming guard time to 1.2 seconds
Based on feedback from KISS and BLHeli developers the maximum delay for a beacon command is 1020ms.  Since there is some built-in delay in sendint the DSHOT beacon command 10 times leaving a little margin for error at 1.2 seconds.
2018-06-15 10:51:12 -04:00
Miguel Angel Mulero Martinez d63eecffaa Add Iterm Relax INC modes 2018-06-15 15:08:09 +02:00
Bruce Luckcuck a93005c692 Clean up duplicate OSD stat reset 2018-06-15 00:00:19 -04:00
s0up 343049d653 fix the calculation of acceleration magnitude average to run at gps update freq vs PID looptime freq to save CPU resources 2018-06-14 14:36:31 -07:00
MJ666 df60162b02 Fix wrong QMC5883L mag detection 2018-06-14 21:12:24 +02:00
AirBreak69 482d38ade1
Tidy grab_fields() 2018-06-14 21:02:04 +02:00
AirBreak69 ff366098e5
Deleted extra 32bit altitude in msp 2018-06-14 20:58:41 +02:00
Michael Keller 9a06900c83
Merge pull request #6104 from etracer65/beacon_arm_delay_osd
Display OSD message and countdown if arming is delayed due to beacon
2018-06-14 23:08:31 +12:00
Curtis Bangert 8950eb1f68 Moved updateGPSRescueState to imuUpdateAttitude. gps_rescue.c tidy. 2018-06-14 02:21:12 -04:00
Michael Keller 4ead807edd
Revert "Moved updateGPSRescueState to imuUpdateAttitude. gps_rescue.c tidy." 2018-06-14 13:25:52 +12:00
Michael Keller 1aa78531f7 Fixes from review. 2018-06-14 12:24:30 +12:00
AirBreak69 ecc89d1ba1
Compensate 10x altitude resolution before transferring via MSP
GPS_RESCUE and subsequent changes increased gpsSol.llh.alt from 0.1m per lsb UNIT16 to 0.01m per lsb INT32.
The transfer of altitude data via MSP had to be corrected by factor 10 rescalings to be backwards compatible.
2018-06-14 01:31:24 +02:00
AirBreak69 719d50e8fb
Harmonized altitude from NMEA with ublox data to centimeters (0.01m per lsb)
Before GPS_RESCUE it was decimeter (0.1m per lsb) from ublox but meter (1m per lsb) from NMEA, stored as unit16.
Now both protocols should deliver centimeters (0.01m per lsb), stored as int32 in order to cover negative and high altitudes too.
2018-06-14 00:18:42 +02:00
AirBreak69 c1342c7197
Cleaner code for negative sign detection in grab_fields()
Following suggestions.
2018-06-14 00:08:15 +02:00
AirBreak69 66773cc1fa
Changed comment that altitude now is in 0.01m per lsb
Since introduction of GSP_RESCUE the altitude (from ublox receivers) is logged in cm (0.01m per lsb as int32). 
Before that is was scaled in decimeters (0.1m per lsb as uint16) from ublox receivers. But with NMEA protocol it was in meters per lsb.
This will be harmonized in another commit to cm (0.01m per lsb).
2018-06-13 23:57:10 +02:00
Bruce Luckcuck 3e706224c9 Only reset motor directon on disarming when crash flip mode was active
Previous logic always reset the motor direction if the crash flip mode was configured.
2018-06-13 16:41:27 -04:00
Bruce Luckcuck c15933fbd6 Change beacon arming delayed message to use the warning message
Uses the OSD_WARN element rather than a separate separate screen before arming.  The "BEACON ON" message will appear for the first 0.5 seconds and then "AM IN x.y" will countdown for the remaining delay.

Also fixed OSD_WARN element blinking related to battery warnings to only blink the warning element if the battery warnings are actually configured.
2018-06-13 12:05:10 -04:00
Curtis Bangert 953e2ad0e9 Moved updateGPSRescueState to imuUpdateAttitude. gps_rescue.c tidy. 2018-06-13 11:36:49 -04:00
mikeller 906a4bcb78 Fixed Dshot command check on non-F7. 2018-06-14 01:46:24 +12:00
mikeller 39a38fd951 Fixes from review. 2018-06-14 00:52:35 +12:00
mikeller 48ed3d0b15 Fixes from review. 2018-06-13 23:51:26 +12:00
Michael Keller 11d8171c36
Merge pull request #6082 from wysiwyng/signed_current
Make current in blackbox signed (fixes #6057)
2018-06-13 22:59:56 +12:00
Michael Keller a0b4ce799d
Merge pull request #6097 from brucesdad13/alienwhoop-target-update
Updated ALIENWHOOP defaults for Betaflight 3.4 Release
2018-06-13 22:59:21 +12:00
Steffen Windoffer 8464699977 remove unused use copy profile 2018-06-13 11:17:34 +02:00
aa07a820ba Fixed whitespace 2018-06-13 03:31:38 -04:00
989e532e0c Fixed up ALIENWHOOP target default PR as requested 2018-06-13 03:23:56 -04:00
AirBreak69 45bf0ac4ec
Handle negative values in grab_fields() 2018-06-13 02:09:54 +02:00
Bruce Luckcuck 843a25903a Display OSD message and countdown if arming is delayed due to beacon
Provides a clear indication that arming is delayed for cases where DSHOT beacon is active.

Clears the OSD and displays "DISABLING BEACON" and "ARMING IN X.Y" with an active countdown in tenths of a second while arming is delayed due to DSHOT beacon. Once delay period is over the normal "ARMING" message appears.

If the DSHOT beacon is not active then this delay screen is not displayed.
2018-06-12 20:04:06 -04:00
AirBreak69 84ee9c624c
Reverted change and added 32bit versions of gpsSol.llh.alt 2018-06-13 01:25:59 +02:00
AirBreak69 b88fba225f
Deleted unused GPS_altitude from gpSolutionData_s
No code was referecing this
2018-06-13 00:06:56 +02:00
mikeller 444e5c43a5 Fixed USB HID channel mapping in Windows. 2018-06-13 01:34:36 +12:00
e35810347d Updated ALIENWHOOP defaults for Betaflight 3.4 release 2018-06-11 22:57:00 -04:00
AirBreak69 0cabe7e70c Removed additional /* on top of block comment 2018-06-12 00:18:13 +02:00
AirBreak69 536ad399e6 GPS: handle negative and high altitudes; safer macros in maths.h
Fixes underflows at negative altitude (below MSL) and overflows at altitude higher than 655.35m
Corrected parenthesis in maths.h avoid incorrect equations if arguments contain expressions.
2018-06-12 00:02:29 +02:00
wysiwyng d35a14834c Measured current is now signed in blackbox 2018-06-10 12:53:34 +02:00
Michael Keller a5ba01666b
Merge pull request #6081 from ctzsnooze/iTerm_Reset_Debugging
iTerm_relax update debug settings and change threshold for setpoint mode
2018-06-10 14:09:21 +12:00
mikeller 5ff68d2c82 Fixed logging inconsistencies. 2018-06-10 13:26:58 +12:00
Michael Keller 4850b31eeb
Merge pull request #6080 from mikeller/add_beacon_off_flags_to_msp
Added 'dshotBeaconOffFlags' to MSP.
2018-06-10 12:50:39 +12:00
Michael Keller 21414faf1c
Merge pull request #6079 from etracer65/dshot_beacon_motor_direction
Add guard time between dshot beacon and arming/disarming
2018-06-10 12:50:15 +12:00
ctzsnooze 53476d45de bit more fine tuning 2018-06-10 10:15:19 +10:00
mikeller 5c2f598357 Added 'dshotBeaconOffFlags' to MSP. 2018-06-10 11:20:28 +12:00
Michael Keller 893d778310
Merge pull request #6076 from mikeller/fix_frsky_x_spi_dropouts
Fixed overflow FrSky X channel decoding.
2018-06-10 11:19:03 +12:00
Bruce Luckcuck 1e6e9e719f Add guard time between dshot beacon and arming/disarming
Tries to prevent DSHOT beacon commands from interfering with commands to set the motor direction.

Adds a 2 second delay after disarming before DSHOT beacon commands will be sent. This attempts to prevent the beacon commands from interfering with the motor direction reset that happens after using crash flip mode.

During arming if a DSHOT beacon command has been sent within 2 seconds the arming will be delayed until the 2 seconds have passed. This attempts to prevent interference with the motor direction commands sent at arming.
2018-06-09 18:59:59 -04:00
ctzsnooze 6d2c1a3c01 initial debug changes 2018-06-10 08:40:04 +10:00
mikeller 2f0c8d26ff Fix from review. 2018-06-10 03:21:27 +12:00
Michael Keller 504b1479fb
Merge pull request #6075 from etracer65/rc_smoothing_typo
Fix typo where assignment was used instead of equality
2018-06-10 03:13:26 +12:00
Michael Keller 27f88b263d
Merge pull request #6073 from mikeller/fix_apply_deadband
Improved 'applyDeadband()', added 'fapplyDeadband()' at @diehertz' request.
2018-06-10 02:58:47 +12:00
Bruce Luckcuck 108e387022 Fix typo where assignment was used instead of equality 2018-06-09 10:29:25 -04:00
mikeller 0c045b8ec5 Fixed overflow FrSky X channel decoding. 2018-06-10 02:24:17 +12:00
mikeller bc048bc23f Fixes from review. 2018-06-10 01:59:29 +12:00
Michael Keller ce61f3b99d
Merge pull request #6071 from codecae/reintroduce-lma
Lagged Moving Average smoothing/filter
2018-06-10 01:52:31 +12:00
Bryce Johnson 99710c85b3 fix brackets 2018-06-10 01:37:31 +12:00
Bryce Johnson a86e0bc41c frsky-spi-D16 was counting every telemetry state as a good packet. If it was garbage packet it would go straight into the rcData
Add some debugging
2018-06-10 01:37:31 +12:00
AJ Christensen 10da8313e8 Lagged Moving Average smoothing/filter
* We plan to use this for RC command filter based interpolation to satisfy CSRF
  use case, but not for gyro filtering.
2018-06-09 08:29:32 -04:00
mikeller affaf86f0d Improved 'applyDeadband()', added 'fapplyDeadband()' at @diehertz' request. 2018-06-10 00:08:31 +12:00
Michael Keller 26a4f762a1
Merge pull request #6072 from AlienWiiBF/FortiniOSD_Rev3
Adding FortiniF4 Rev3 target
2018-06-10 00:05:16 +12:00
ctzsnooze 705d3939eb Initial default suggestions for 3.4
Set default RC smoothing channels to RPYT

first attempt at enabling features by default

update filter notes
2018-06-09 22:26:00 +12:00
Michael Keller 54c3363719
Merge pull request #6065 from mikeller/joelucid_relax2
Joelucid's overworked ITerm relax.
2018-06-09 22:21:09 +12:00
Michael Keller 0210be305a
Merge pull request #6067 from etracer65/rc_smoohting_crsf_init
RC smoothing - add rx frame training delay to deal with CRSF initialization
2018-06-09 21:40:37 +12:00
MJ666 344c35f909 Adding FortiniF4 Rev3 target 2018-06-09 09:49:54 +02:00
Michael Keller d3673f11ee
Merge pull request #6059 from fujin/fix-debug-mode-names
gyro sensors/debug: standardize gyro debugging enum elements
2018-06-09 19:26:38 +12:00
mikeller 06428c1b05 More fixes. 2018-06-09 19:20:46 +12:00
Michael Keller f8a86d6392
Merge pull request #6069 from mikeller/fix_dshot_beacon_description
Fixed Dshot beacon command description in CLI.
2018-06-09 19:10:13 +12:00
AJ Christensen b1069027c3 gyro sensors: use `axis_e` enum for consistency 2018-06-09 14:25:52 +12:00
AJ Christensen 03b480a8ef gyro sensors/debug: record standard deviation for roll *only*
* visibile in the DEBUG_GYRO_RAW[3]
2018-06-09 14:18:47 +12:00
AJ Christensen f8ebdf06f1 debug: update debugModeNames
* TBC
2018-06-09 14:12:32 +12:00
mikeller d43c178488 Fixes from review. 2018-06-09 13:22:36 +12:00
mikeller 78cbd5725c Fixed Dshot beacon command description in CLI. 2018-06-09 12:06:50 +12:00
mikeller bdc2b48d36 Disabled Dshot beacon by default. 2018-06-09 12:02:15 +12:00
s0up 7621bad1f8 possibly fix failsafe when throttle low delay no exist 2018-06-08 16:54:51 -07:00
Michael Keller c54b7e7db9
Merge pull request #6064 from mikeller/add_mag_support_to_dalrcf405
Added MAG support to DALRCF405.
2018-06-09 11:35:41 +12:00
Bruce Luckcuck 95ae4943df RC smoothing - add rx frame training delay to deal with CRSF initialization
Handles cases where the flight controller and receiver are powered but the TX is not.  When the TX is powered on and CRSF establishes the link, it will initially run at 50hz for about 0.6 seconds before shifting to 150hz. This change avoids that initialization and link establishment period.
2018-06-08 15:45:25 -04:00
Michael Keller db3c0d1447 Some fixes. 2018-06-08 21:18:54 +12:00
Thorsten Laux fefedbd686 attempts to improve relax
attempts to improve relax fix

attempts to improve relax fix

bug fixes

spaces

changed settings and added isAirmodeActive()

fix rebase error
2018-06-08 21:01:46 +12:00
Michael Keller ef12eebe57
Merge pull request #6063 from dbasch/alt-fix
[GPS Rescue] - Do not run idle tasks when disarmed
2018-06-08 20:50:33 +12:00
Michael Keller 18c71cd035
Merge pull request #6062 from mikeller/fix_beeper_on_usb
Fixed 'beeper -ON_USB'.
2018-06-08 20:45:29 +12:00
Michael Keller cb3d1d6ad4
Merge pull request #6060 from jirif/npr_6056
Fixed null pointer reference
2018-06-08 20:45:04 +12:00
Michael Keller 44781bae30 Added MAG support to DALRCF405. 2018-06-08 19:54:48 +12:00
s0up b240d745d7 more reverting 2018-06-07 13:35:00 -07:00
s0up 1b1837905c revert position.c changes 2018-06-07 13:34:12 -07:00
s0up 96692af0f8 dont allow idle tasks to run when disarmed, allow altitude to be absolute on the bench vs relative when flying 2018-06-07 13:24:42 -07:00
s0up 8a9869b4fd always set offset when not armed. OSD should never show > 0 values when not armed 2018-06-07 08:53:28 -07:00
jirif 80e40a1467 Fixed null pointer reference 2018-06-07 15:09:32 +02:00
mikeller 52b8fa5316 Fixed 'beeper -ON_USB'. 2018-06-08 00:43:15 +12:00
Michael Keller 7936fb07d5
Merge pull request #6052 from mikeller/change_setpoint_weight_to_decimal_scaling
Changed 'dtermSetpointWeight' to use decimal scaling.
2018-06-07 23:38:16 +12:00
AJ Christensen f2cc9acc1f gyro sensors/debug: standardize gyro debugging enum elements
* will require coordination with BFC of course.
* rationale: previously `DEBUG_GYRO_NOTCH` debugging was used to grab the
  scaled, unfiltered gyro readings, prior to the FFT running. This has been
  updated to `DEBUG_GYRO_SCALED`.

  similarly, `DEBUG_GYRO` debugging was used to record the filtered gyro. This
  is updated to `GYRO_FILTERED`.

  interestingly, `DEBUG_GYRO` was also used for movement threshold calibration.
  This has been updated to be `DEBUG_GYRO_CALIBRATION` and also now stores
  per-axis standard deviation.

  Application of filter position moved slightly for logical grouping, has no
  effect due to LTI.
2018-06-07 17:17:26 +12:00
Michael Keller de22f87a6d
Merge pull request #6056 from mikeller/move_slowdown_to_fport
Moving sensor frame throttling from SmartPort to FPort only.
2018-06-07 16:29:54 +12:00
Michael Keller 2dd1d742bf
Merge pull request #6051 from etracer65/rc_smoothing_training
RC smoothing: improve rx frame rate detection, add rc_smoothing_info cli command
2018-06-07 16:22:48 +12:00
Bruce Luckcuck c70e999f24 More cleanup from review 2018-06-06 18:42:08 -04:00
Bruce Luckcuck dfa6be810a Updates and cleanup from review, simplify auto cutoff calculation
Renamed variables to be more representative of their content.

Simplified the auto-cutoff calculation to be 90% of the nyquist frequency of the measured rx frame rate.

Simplified the PT1 from BIQUAD calculation.

Added active cutoffs to the blackbox log header. Reduce the number of headers by combining like entries into a single line.
2018-06-06 17:30:28 -04:00
mikeller 41492e1309 Moving sensor frame throttling from SmartPort to FPort only. 2018-06-07 00:34:37 +12:00
Michael Keller 3f3fb0c01c Changed 'dtermSetpointWeight' to use decimal scaling. 2018-06-06 11:21:11 +12:00
Bruce Luckcuck e49c10b573 RC smoothing: improve rx frame rate detection, add rc_smoothing_info cli command
Improved the rx frame rate detection/training by delaying calculation to avoid loop time jitter during flight controller initialization.

For auto cutoffs calculate a value appropriate for BIQUAD or PT1 depending on the configuration.

Added a new rc_smoothing_info cli command to display internal details about its operation.
2018-06-05 18:25:13 -04:00
Michael Keller 445f9d6ad4
Merge pull request #6044 from mikeller/added_interpolation_checks
Added validation checks for interpolation settings, made throttle boost conditional.
2018-06-06 08:00:19 +12:00
Michael Keller 95f8cfd8b8
Merge pull request #6049 from jflyper/bfdev-ag3x-default-burst
AG3X Enable burst mode DMA by default
2018-06-05 22:04:06 +12:00
Michael Keller 60c6ba5ccf
Merge pull request #6035 from mikeller/fix_spracingf3_transponder_default
Added USE_TRANSPONDER to SPRACINGF3 to match the default features.
2018-06-05 21:55:22 +12:00
mikeller 391d6a4185 Fixed SPRACINGF3OSD. 2018-06-05 21:43:17 +12:00
jflyper 69f204b5fc AG3X Enable burst mode DMA by default 2018-06-05 16:32:52 +09:00
Michael Keller 388175f746
Merge pull request #6047 from McGiverGim/fix_msp_gyro_lpf_range
Add new range for gyro lpf 1 into MSP
2018-06-05 19:14:00 +12:00
mikeller f9cfa86378 Fixes from review. 2018-06-05 18:47:41 +12:00
mikeller a373204d7a Added validation checks for interpolation settings, made throttle boost conditional. 2018-06-05 18:38:57 +12:00
Michael Keller 91013da2cc
Merge pull request #6043 from mikeller/added_rc_interpolation_options
Added more options for RC interpolation channel selection.
2018-06-05 18:37:49 +12:00
Miguel Angel Mulero Martinez 9c6603fae9 Add new range for gyro lpf 1 into MSP 2018-06-05 08:19:24 +02:00
Michael Keller 93e02388c8 More fixes. 2018-06-05 16:32:59 +12:00
Michael Keller d299d8b51d Fixes from review. 2018-06-05 13:49:34 +12:00
Michael Keller 522e90ab17
Merge pull request #6031 from mikeller/fix_osd_altitude_display
Fixed OSD altitude display for negative altitude > -1.
2018-06-05 13:11:30 +12:00
mikeller 9738a1cdd2 Added more options for RC interpolation channel selection. 2018-06-04 22:41:54 +12:00
supiiik 4369605caf
Merge pull request #2 from betaflight/master
merge
2018-06-04 12:35:46 +02:00
mikeller e29fa595f5 Optimised the use of static variables in the PID loop. 2018-06-04 18:56:30 +12:00
Bruce Luckcuck 2359449b2a Add delay before training, update defaults, add fields to blackbox header
Also added support for split input and derivative defaults
2018-06-03 21:53:56 -04:00
Bruce Luckcuck e0514ce2a9 Use FAST_RAM for static variables in new smoothing code 2018-06-03 21:52:16 -04:00
Bruce Luckcuck 7e18d7c1b9 Make filter type selectable and add BIQUAD
Adds options to select the filter type for both input and derivative.
rc_smoothing_input_type = PT1 | BIQUAD (default is BIQUAD)
rc_smoothing_derivative_type = OFF | PT1 | BIQUAD (default is OFF)
2018-06-03 21:52:15 -04:00
Bruce Luckcuck 8b42c80790 Updates per review
Stylistic fixes.
Rearrange initilization code to only run when isRXDataNew.
Corrected use of FAST_CODE and FAST_CODE_NOINLINE.
2018-06-03 21:52:15 -04:00
Bruce Luckcuck 826609e703 Experimental filter-based rc channel smoothing
Adds an additional rc channel smoothing algorithm that can be used in place of the default rc interpolation. Utilizing a filter-based approach the smoothing has lower latency and is immune to loop time jitter that can introduce artifacts.  Additionally a smoothing filter is added to the setpoint derivative used to produce D-term setpoint weight resulting in a smoother effect on D.

The default setting is to use the previous interpolation logic and there are no changes unless the optional method is selected.

Configuration:

rc_smoothing_type: (INTERPOLATION | FILTER) - defaults to INTERPOLATION

rc_smoothing_input_hz: (0-255) - sets the rc channel input filter cutoff in Hz. Default value of 0 will enable auto calculation based on received RX frame rate.

rc_smoothing_derivative_hz: (0-255) - sets the setpoint weight derivative filter cutoff in Hz. Default value of 0 will enable auto calculation based on received RX frame rate.

rc_smoothing_debug_axis: (ROLL | PITCH | YAW | THROTTLE) - determines which axis is logged in the debug fields

Debug logging:

set debug_mode = RC_SMOOTHING

debug(0) = raw un-smoothed rc channel data
debug(1) = raw un-smoothed setpoint derivative
debug(2) = filtered setpoint derivative before applied to setpoint weight
debug(3) = auto-calculated filter cutoff frequency base after sampling the rx frame rate

Notes:

Currently only enabled for F4/F7 due to flash size limitations

Uses the rc_inter_ch parameter to determine which channels are smoothed (same as default interpolation logic)

The auto filter cutoff calculation will set a cutoff frequency of 30Hz for typical SBUS frames (9ms).  11ms Spektrum will calculate to approximately 25Hz. The user can manually enter the filter cutoffs to be used instead of the auto calculation.  The current default calculation was chosen as a good starting point but may be adjusted in the future.

Setting a lower cutoff frequency will result in more smoothing, but also more delay.

There currently isn't any support for receivers that change their rx frame rate dynamically.  So for CRSF users wishing to use this alternate smoothing method should change their settings to lock the rx frame rate for now. Support for auto-adjusting to new frame rates in flight will likely be added.
2018-06-03 21:52:01 -04:00
Michael Keller b21b626e12
Merge pull request #6024 from mikeller/add_filter_msp_and_defaults
Added defaults and MSP support to filter settings.
2018-06-04 11:28:29 +12:00
mikeller 15e9bb1b38 Removed TRANSPONDER support. 2018-06-04 11:25:24 +12:00
mikeller df06b9b4cb Fixed tests. 2018-06-04 00:23:45 +12:00
supiiik 1d22cf70b3 MSP for smart_feedforward and throttle boost
Added 3 new MSP values: throttle boost and smart feedforward
2018-06-03 13:53:10 +02:00
mikeller 0c60821a7d Added USE_TRANSPONDER to SPRACINGF3 to match the default features. 2018-06-03 23:27:12 +12:00
Michael Keller 6bac0cd392
Merge pull request #6034 from Smeat/gps_alt_fix
Fix altitude task when using GPS only.
2018-06-03 23:03:07 +12:00
Michael Keller 1640f6179d
Merge pull request #6032 from mikeller/add_rssi_offset
Added RSSI offset to complement RSSI scaling.
2018-06-03 22:59:55 +12:00
mikeller f32731638d Removed default changes from this pull request. 2018-06-03 22:44:42 +12:00
mikeller 75693fbd5b Added defaults and MSP support to filter settings. 2018-06-03 22:44:42 +12:00
Michael Keller 00a9feb0cd
Merge pull request #6029 from mikeller/fix_dshot_beacon
Fixed Dshot beacon activation conditions.
2018-06-03 22:43:57 +12:00
mikeller fa24697df6 Make it terminate the string properly. 2018-06-03 22:43:12 +12:00
mikeller 0aba86ccb4 Converted it to fixed width. 2018-06-03 22:40:01 +12:00
mikeller e30f1fadd9 Fixed OSD altitude display for negative altitude > -1. 2018-06-03 21:46:44 +12:00
mikeller 76a1e81d97 Removed extra parentheses. 2018-06-03 21:45:55 +12:00
mikeller a9c1f02afb Added RSSI offset to complement RSSI scaling. 2018-06-03 21:45:55 +12:00
Kevin ba0de59fc1 Fix altitude task when using GPS only. 2018-06-03 11:40:12 +02:00
mikeller a9b3911e03 Made new PID loop improvements conditional, disabled some for F3 to save flash space. 2018-06-03 17:07:10 +12:00
mikeller 834df547e6 Fixed Dshot beacon activation conditions. 2018-06-03 12:46:48 +12:00
mikeller 227c08f94e Added profile / rateprofile info to 'get'. 2018-06-02 22:27:16 +12:00
mikeller 532e8afe61 Fixed dumping of profile values in CLI. 2018-06-02 21:01:22 +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
Michael Keller f37a8184d5
Merge pull request #5891 from mikeller/add_disable_rx_loss_dshot_beacon_option
Implemented 'beacon' command in CLI.
2018-06-01 21:51:57 +12:00
Michael Keller 9f28f87c97
Merge pull request #6013 from mikeller/fix_enum_in_pg
Reordered and optimised pidProfile parameter group.
2018-06-01 14:54:12 +12:00
Michael Keller 42b2e4077f
Merge pull request #5985 from mikeller/add_board_info
Added ability to set and check board info.
2018-06-01 07:50:59 +12:00
mikeller 2ca07f7302 Fixed typo, BETAFLIGHTF3 flash overflow. 2018-06-01 00:48:21 +12:00
Michael Keller c8184a93f6
Merge pull request #5796 from jamming/kakutef7Test
Kakutef7 IMU change
2018-06-01 00:34:52 +12:00
mikeller c666fcfa17 Reordered and optimised pidProfile parameter group. 2018-05-31 23:51:31 +12:00
mikeller cedf2a1b45 Disabled on AIORACERF3 because of flash overflow. 2018-05-31 23:27:50 +12:00
mikeller f17567491f Fixes from review. 2018-05-31 23:25:03 +12:00
mikeller 467a490a53 Ensured board info is preserved through invalid EEPROM version triggered reset. 2018-05-31 23:25:03 +12:00
mikeller 432f330e60 Fixes from review. 2018-05-31 23:25:03 +12:00
mikeller b4c44d8a46 Fixed writing of empty signature. 2018-05-31 23:25:03 +12:00
mikeller 0bf4708033 Added support for signing board / serial number. 2018-05-31 23:25:03 +12:00
mikeller 6131ac1449 Fixed tests. 2018-05-31 23:25:03 +12:00
mikeller a101a58b68 Added ability to set and check board info. 2018-05-31 23:25:03 +12:00
Michael Keller 011711c0c1
Merge pull request #5998 from Cleric-K/failsafe-mode-switch
Failsafe switch choosable behavior
2018-05-31 23:15:51 +12:00
mikeller f307bf3134 Fixed build for exotic targets. 2018-05-31 19:43:46 +12:00
Michael Keller f013debb2d
Merge pull request #6008 from McGiverGim/gps_use_galileo
Add Galileo support to GPS
2018-05-31 19:33:53 +12:00
Miguel Angel Mulero Martinez f43b36ce19 Add Galileo support to GPS 2018-05-31 08:20:58 +02:00
Michael Keller ad7a847275
Updates from review. 2018-05-31 13:02:12 +12:00
Michael Keller 21f9e6b8ed
Updates from review. 2018-05-31 13:01:52 +12:00
Michael Keller 855639049c
Updates from review. 2018-05-31 13:00:58 +12:00
Michael Keller 74c824c6b3
Merge pull request #5968 from joelucid/absolute_control
Absolute control
2018-05-31 11:02:06 +12:00
Michael Keller 07dfbd7b62
Merge pull request #6001 from mikeller/make_rssi_scalable
Make all RSSI sources scalable.
2018-05-31 10:59:32 +12:00
Thorsten Laux bb71b6ec64 correct drift 2018-05-30 23:06:27 +02:00
Thorsten Laux 8fe07af613 correct stickInput 2018-05-30 23:06:27 +02:00
Thorsten Laux f1ea15029f remove pid.c.old 2018-05-30 23:05:16 +02:00
Thorsten Laux 0138200c1c initialize acErrorRate if iterm_relax is off 2018-05-30 23:05:16 +02:00
Thorsten Laux b40db51448 address style issues and set off by default 2018-05-30 23:05:15 +02:00
Thorsten Laux bd289121fc absolute control feature 2018-05-30 23:04:26 +02:00
Thorsten Laux df71817fba incorporate style feedback 2018-05-30 23:01:54 +02:00
Thorsten Laux 7c8c3b6784 address style requests 2018-05-30 23:01:54 +02:00
Thorsten Laux 85b0f6f9c2 ITerm relax feature 2018-05-30 23:01:54 +02:00
mikeller 7e8f261436 Implemented 'beacon' command in CLI. 2018-05-31 01:48:27 +12:00
Michael Keller d330ad519e
Merge pull request #6004 from mikeller/add_esc_sensor_offset
Added offset parameter to ESC sensor current calculation to compensate for non-ESC consumption.
2018-05-30 22:45:50 +12:00
mikeller 6eea0d45ca Changes from review. 2018-05-30 22:29:42 +12:00
Michael Keller 65e1b060f4
Merge pull request #6002 from AlienWiiBF/AFNG_F7_OSD
Add OSD support for AFNG F7 Horus30 board
2018-05-30 21:09:14 +12:00
MJ666 533235619d Add UART3 to configuration to be used in absense of the SDCard. 2018-05-30 07:23:14 +02:00
MJ666 2fa03df7c4 AlienFlightNG F7 OSD support (AFNG F7 Horus30) 2018-05-30 07:23:12 +02:00
Bruce Luckcuck ad067ee09a Overshoot logic updates, disable for GPS Rescue, constrain max setpoint
Updates for finalize the flight performance.

Disable if GPS Rescue is active

Constrain the max setpoint calculated by the angle correction logic. To catch border cases where the user activates the feature while inverted and has a high gain which could result in excessively high setpoint rates.

Make sure internal states are reset when feature is activated via mode switch.
2018-05-29 21:08:19 -04:00
Bruce Luckcuck 2384088855 Requested changes, cleanup and control logic updates
Also added a new parameter acro_trainer_gain to allow adjustments to the limiting strength.
2018-05-29 21:08:19 -04:00
Bruce Luckcuck 9b43839052 Acro trainer
Adds a new angle limiting mode for pilots who are learning to fly in acro mode. Primarily targeted at new LOS acro pilots, but can be used with FPV as well.

The feature is activated with a new mode named "ACRO TRAINER". When the feature is active, the craft will fly in normal acro mode but will limit roll/pitch axes so that they don't exceed the configured angle limit. New pilots can start with a small angle limit and progressively increase as their skills improve.

The accelerometer must be enabled for the feature to be configured and function.

Also the feature will only be active while in acro flight and will disable if ANGLE or HORIZON modes are selected.

For most users all they need to do is simply configure the new mode to be active as desired on the "Modes" tab in the configurator and configure the desired angle limit in the cli.

Configuration parameters:

acro_trainer_angle_limit: (range 10-80) Angle limit in degrees.

acro_trainer_lookahead_ms: (range 10-200) Time in milliseconds that the logic will "look ahead" to help minimize overshoot and bounce-back if the limit is approached at high gyro rates. The default value of 50 should be good for most users. For low powered or unresponsive craft (micros or brushed) it may be helpful to increase this setting if you're seeing substantial overshoot.

acro_trainer_debug_axis: (ROLL, PITCH) The axis that will log information if debugging is active.

To enable debugging:
set debug_mode = ACRO_TRAINER

debug(0) - Current angle
debug(1) - The internal logic state
debug(2) - Modified setpoint
debug(3) - Projected angle based gyro rate and lookahead period
2018-05-29 21:08:16 -04:00
Michael Keller 2fccb2b9b7 Fix from review. 2018-05-30 12:56:30 +12:00
Michael Keller eecb59db45
Merge pull request #5963 from joelucid/iterm_relax
ITerm relax feature
2018-05-30 09:32:21 +12:00
Cleric-K e17abc4063 Failsafe switch choosable behavior #5994
The `failsafe_kill_switch` parameter has been renamed to
`failsafe_switch_mode` and it determines what happens
when the Failsafe mode is activated with an AUX switch.
It takes one of three values:
  0 - simulates RC signal loss - thus activates Stage1 failsafe
      (former behavior when kill switch option was OFF)
  1 - disarms immediately
      (former behavior when kill switch option was ON)
  2 - activates the failsafe procedure (Stage2) immediately (new)
2018-05-29 23:28:09 +03:00
jflyper 6402ebf5b8 Increase SPI_PREINIT_IPU_COUNT 2018-05-30 01:50:54 +09:00
Thorsten Laux dc929baf75 make itermRelax into enum 2018-05-29 16:40:23 +02:00
borisbstyle 2161c68778
Merge pull request #5975 from fujin/minimize-filter-choices
gyro & d-term filters: remove filtering options except biquad/pt1
2018-05-29 15:56:53 +02:00
mikeller ab916d16b2 Added beacon config printing. 2018-05-30 01:20:33 +12:00
mikeller 2c3bf6ad2d Removed 'PREFERRED' beeper settings. 2018-05-30 00:50:55 +12:00
mikeller a0dd12db42 Added option 'disable_rx_loss_dshot_beacon' to stop RX loss Dshot beacon from working. 2018-05-30 00:50:55 +12:00
mikeller e75eaf85ce Fixed tests. 2018-05-30 00:45:45 +12:00
mikeller 670cd49bd6 Added offset parameter to ESC sensor current calculation to compensate for non-ESC consumption. 2018-05-30 00:38:33 +12:00
mikeller d401e3bbbe Fix usages, scaling. 2018-05-29 23:08:26 +12:00
Michael Keller b2f7aa3c36
Merge pull request #5999 from etracer65/osd_flash_reduction
Reduce flash usage in OSD element display logic
2018-05-29 13:02:03 +12:00
Michael Keller 9a7c863c3c Make all RSSI sources scalable. 2018-05-29 12:28:05 +12:00
Bruce Luckcuck 012058a9bc Reduce flash usage in OSD element display logic
Saves 132 bytes of flash.
2018-05-28 19:54:47 -04:00
Michael Keller e0aa43b259
Merge pull request #5991 from mikeller/reset_config_on_pg_changes
Reset the entire config when parameter groups have changed.
2018-05-29 11:12:42 +12:00
AJ Christensen a63c8b0079 gyro & d-term filters: remove filtering options except biquad/pt1
* through extensive testing prior to the beginning of the RC cycle, we have
  discovered that the simplest combination of filters appears to be up to four
  PT1 filters: two for gyro, and two for d-term.
* non-cascaded biquad filter plumbing is retained for noisy setups and the
  dynamic notch bandpass, although gyro and d-term variants of the filtering may
  eventually be removed in favor of pt1
* update all related unit tests
2018-05-29 10:54:46 +12:00
Thorsten Laux 5bdc2ead61 make itermRelax an uint8_t 2018-05-28 16:44:13 +02:00
Thorsten Laux 6239b8258a make itermrelax on yaw optional 2018-05-28 16:41:05 +02:00
Thorsten Laux 7e12e9da18 don't link debug.c to pid unit test 2018-05-28 16:40:09 +02:00