1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-15 12:25:20 +03:00
Commit graph

174 commits

Author SHA1 Message Date
ProDrone
c40db74e61 Working - except when exiting from bootloader
Fixes the `Waiting for Data` problem in configurator when:

- Clicking on `Save and Reboot` button
- Clicking on `Flash Firmware`  button

When the system reboots after programming the new firmware it still
needs a connect/disconnect cycle to work normal. This cannot be solved
since the bootloader is a fixed program in ROM.

Fix is for F1 targets and only tested on naze boards.
2015-10-27 20:09:59 +01:00
Dominic Clifton
a319394f6b Merge branch 'blackbox-serial-budget' of https://github.com/sherlockflight/cleanflight-dev into sherlockflight-blackbox-serial-budget
Conflicts:
	src/main/blackbox/blackbox.c
2015-10-12 20:14:20 +01:00
Dominic Clifton
123a4ccfc5 Merge branch 'GTune' of https://github.com/MJ666/cleanflight into
MJ666-Harakiri_PID_update

Conflicts:
	Makefile
	src/main/blackbox/blackbox_fielddefs.h
	src/main/flight/pid.c
	src/main/io/serial_msp.c
	src/main/mw.c
	src/main/target/ALIENWIIF3/target.h
	src/main/target/CC3D/target.h
	src/main/target/NAZE/target.h
	src/main/target/NAZE32PRO/target.h
	src/main/target/SPARKY/target.h
2015-10-06 20:16:37 +01:00
Dominic Clifton
d36da111b2 Delete autotune. 2015-10-06 19:38:02 +01:00
Michael Jakob
43f5792a61 G-Tune port from Harakiri
Enabled for NAZE, ALIENWWIIF1 and ALIENWIIF3 targets
Implement G-Tune for all PID controllers
The G-Tune tuning results will be save if G-Tune mode will be disabled
during copter is disarmed.
Update PID controller and G-Tune documentation
2015-10-04 18:37:18 +02:00
Nicholas Sherlock
6e504ca52a Ability to see how many Tx bytes are free in serial port buffer 2015-10-01 16:48:56 +13:00
Nicholas Sherlock
8e9669dc0c Fix RX_MSP writing to rcData was causing feedback loop with channel map
Fixes support for RX_MSP > 8 channels
2015-09-25 01:34:50 +12:00
ProDrone
f0681de53d Updates and feature additions to failsafe system.
- Added failsafe flightmode and rc control box.

To make failsafe procedure a separate flight mode and make it possible
to trigger failsafe with an AUX switch.

- Failsafe mode is activated when failsafe is active.

RC link lost is simulated with the failsafe AUX switch.
When NOT armed: failsafe switch to failsafe mode is shown in GUI (mode
tab).

- Activate failsafe mode with AUX switch.

- Prevent arming when failsafe via AUX switch is active (safety issue).

- Make failsafe disarm if motors armed and throttle was LOW (2D & 3D)
for `failsafe_throttle_low_delay` time (__JustDisarmEvent__).

Applied code changes to effectively add pull request: Make failsafe
disarm if motors armed and throttle low #717.

- Use failsafeIsMonitoring() to actually start monitoring.

- Added `failsafe_kill_switch` to code.

When set to 1 (0 is default), the failsafe switch will instantly disarm
(__KillswitchEvent__) instead of executing the landings procedure.
Arming is NOT locked after
this, so the craft could be re-armed if needed.
This is intended for racing quads where damage and danger must be
minimized in case of a pilot error.

- Added `failsafe_throttle_low_delay`, adapted documentation.

Used to adjust the time throttle level must have been LOW
to _only disarm_ instead of _full failsafe procedure_
(__JustDisarmEvent__).

- Updated the failsafe documentation.

- Re-enable arming at end of failsafe procedure.

At the end of a handled failsafe event, that means: auto-landing,
__JustDisarmEvent__ or __KillswitchEvent__, the RX link is monitored for
valid data.
Monitoring is a part of the failsafe handling, which means the craft is
still in failsafe mode while this is done.
Arming is re-enabled (allowed) when there is a valid RX link for more
then XX seconds, where XX depends on the handled event like this:
1. XX = 30 seconds after auto landing.
2. XX = 3 seconds after __JustDisarmEvent__.
3. XX = 0 seconds after __KillswitchEvent__.

NOTE: When armed via an AUX switch, you will have to switch to the
disarmed position at the very end to be able to re-arm.
The failsafe mode will not end until you do.

- __KillswitchEvent__ has now priority over __JustDisarmEvent__

- Apply rxfail values instantly when failsafe switch is ON

- Added missing cases to display.c

Show M when failsafe is monitoring for RX recovery (AND disarming when
armed with a switch).

===

Reworked the code from counter-based to time-based.

- AUX failsafe switch now has identical behavior to RX loss.

- Added RX failure and RX recovery timing.

- __KillswitchEvent__ skips RX failure detection delay (direct disarm).

===

[UNIT TESTS]

Adapted failsafe related unittests from counter-based to time-based

- Added failsafeOnValidDataFailed() to some tests

- Removed duplicate test setup from rc_controls_unittest.cc

- Removed magic numbers from rx_ranges_unittest.cc and rx_rx_unittest.cc

- Reworked all test-cases for flight_failsafe_unittest.cc
2015-09-04 16:55:40 +02:00
Nicholas Sherlock
c5a7914fe8 Fix upper bound clamping of FP PID settings upon MSP read 2015-08-20 16:10:18 +12:00
Dominic Clifton
a030d4dd9e Failsafe - Add rxfail auto mode. Allow rxfail to be used for all
channels, not just aux channel.
2015-08-20 01:37:29 +01:00
Dominic Clifton
ae0c29125d Merge pull request #1157 from cleanflight/blackbox-pause
Add pause/resume switch support to Blackbox
2015-08-03 21:26:36 +01:00
Dominic Clifton
490268d2fc Failsafe - Allow AUX channels to HOLD their last value or be SET to a
specific value when RX loss is detected.

Tested with SBus, PWM & PPM.
2015-08-03 18:16:28 +01:00
ProDrone
08b376f2a5 RPY to mid-stick and T to lowest (or mid for 3D).
On bad (out-of-range) pulses; ROLL, PITCH, YAW will go to `mid_rc` and
THROTTLE will go to `rx_min_usec` (to `mid_rc` for 3D mode). So these
channels will no longer be set by the user directly.
Fallback values for the aux switches (0 .. max) can be set with this
version. Since these switches may trigger all kind of things, the user
needs control over them in case of a RX failsafe event.

A single flight control channel failure (first 4) when using parallel
PWM is interpreted as a failure for all flight control channels (first
4), since the craft may be uncontrollable when one channel is down. (+4
squashed commit)

Squashed commit:

[dbfea9e] Apply fallback values also when serial_rx init failed and/or
RX
disconnected and/or no signal received.

[b5a2ecd] Added get/set MSP commands for RXFAIL config

Bumped API minor version up.

[c0e31ce] minor change for coding standard

[322705f] Added programmable RX channel defaults on rx lost Update #2
2015-07-31 14:35:14 +02:00
Nicholas Sherlock
53860e461c Add resume event to allow clean log decoding, add documentation 2015-07-23 19:18:08 +12:00
Alexander Fedorov
01632998a3 Blackbox: Enable logging when mode switch is active 2015-07-22 13:36:22 +12:00
Dominic Clifton
6dca303130 Cleanup servo configuration storage (align some values more
efficiently).  Update MSP_SERVO_CONFIGURATIONS,
MSP_SET_SERVO_CONFIGURATION value order.  Add some error checking to
size of MSP_SET_SERVO_CONFIGURATION.
2015-07-12 23:32:07 +01:00
Dominic Clifton
bc5f666069 Minor MSP cleanup and adding a FIXME. 2015-07-09 19:02:52 +01:00
Dominic Clifton
763c75873e Use 0 based index for motor and servo mix in CLI. Update
MSP_SERVO_MIX_RULES, MSP_SET_SERVO_MIX_RULE, MSP_SERVO_CONFIGURATIONS,
MSP_SET_SERVO_CONFIGURATION.  Delete MSP_CHANNEL_FORWARDING,
MSP_SET_CHANNEL_FORWARDING.
2015-07-08 12:54:09 +01:00
Dominic Clifton
b5e18a90a2 Cleanup CLI
* optimize for code size.
* consolidate error message handling.
* replace similar error messages with identical ones.
* shorten all strings where possible.
* made less verbose.

This was required for the CC3D OPBL build.
2015-06-29 03:30:17 +01:00
Dominic Clifton
ea6a6ccb3d First cut of custom servo mixers.
Main rule logic and MSP commands ported from baseflight.

Gimbal mixer updated to use rules.  This allows us to remove more
conditional logic.  Operation of gimbal servos is now different.
2015-06-28 23:06:56 +01:00
Dominic Clifton
c142e3dfe9 Rename minLimit/maxLimit to angleAtMin and angleAtMax. Remove unneeded
MSP_SET_SERVO_LIMIT.  Bump MSP API version.  Add basic sanity checks to
MSP_SET_SERVO_CONF, reset all servos and adhere to the msp packet's data
size.
2015-06-28 12:22:14 +01:00
Mauro Mombelli
da6ee6ffb7 first extract from Tilting for Servo pull request 2015-06-28 12:06:33 +01:00
Dominic Clifton
a9b5ad71b2 Fixing MSP_RAW_IMU. See 26e950b433. Closes #1061.
Must have been a late one.
2015-06-27 21:15:51 +01:00
Dominic Clifton
26e950b433 Remove duplicate code from MSP_RAW_IMU. Saves a ~24 bytes of flash
space and results in easier to read code due to less nesting.
2015-06-24 23:17:59 +01:00
Dominic Clifton
7db626747d Allow all models to use servo tilt.
See #1006
2015-06-10 15:31:47 +01:00
Dominic Clifton
9a8a31676b Reduce maximum servos from 10 to 8.
1) the 2 extra servos were not used for anything, yet.
2) the MSP packet to set ALL the servo configurations in one go is
larger than the MSP input buffer size.

Likely the MSP_SET_SERVO_CONF should be updated with command that takes
an index of a servo to configure, as per mode ranges/colors/leds/etc.

Fixes #1002
2015-06-10 13:31:04 +01:00
Michael Hope
5c6760fd82 various: tidy up various things found when building with a C++ compiler.
Remove duplicate consts.
Pull in the include files where functions and variables are declared.
Mark file local but duplicated variables as static.
Mark some variable declarations as extern.
Remove duplicated variable definition.

Signed-off-by: Michael Hope <mlhx@google.com>
2015-06-04 22:32:31 +02:00
Dominic Clifton
0c1a6c5c2f Merge branch 'lock_active_features' of https://github.com/ProDrone/cleanflight into ProDrone-lock_active_features
Conflicts:
	src/test/unit/rc_controls_unittest.cc
2015-05-29 20:05:25 +01:00
Dominic Clifton
41d737e29a Merge pull request #869 from SteveAmor/remove_tricopter_yaw_gyro_smoothing
Remove tricopter yaw gyro smoothing from imuUpdate
2015-05-29 15:39:02 +01:00
Dominic Clifton
55180070d6 Merge pull request #964 from nzmichaelh/more-const
various: optimise RAM and flash usage
2015-05-29 11:13:41 +01:00
Michael Hope
c9349ce83b msp: rework the different size encoders.
Tidy the encoders up.  Reduce the code size stacking the encoders for
different sizes.

Signed-off-by: Michael Hope <mlhx@google.com>
2015-05-29 05:42:22 +02:00
Michael Hope
31f933ac21 various: mark more constant data so it goes into flash instead of RAM.
Signed-off-by: Michael Hope <mlhx@google.com>
2015-05-29 05:42:08 +02:00
Dominic Clifton
a7d347689d Merge pull request #953 from enly1/Telemetry_Switch_Fix
Telemetry_Switch TELEMETRY_BOX conditional logic incorrect
2015-05-28 23:36:20 +01:00
enly1 [Simon Love]
7df9f7d0d5 Telemetry_Switch TELEMETRY_BOX conditional logic incorrect - corrected so TELEMETRY_BOX now available in GUI with telemetry_switch=1 2015-05-26 20:43:05 +01:00
Dominic Clifton
a370d60595 Support UART3 and I2C on Paris Air Hero 32 Flex port (aka Naze32_SP).
This change also allows serial ports to be removed at runtime.  e.g.
UART3 on Naze32 and SoftSerial 1 & 2 when softserial is not enabled.
2015-05-22 20:49:33 +01:00
Dominic Clifton
20a6f829d5 SPRacingF3 - Add support for airplane pwm mappings. 2015-05-21 02:02:33 +01:00
ProDrone
b75de91f35 Instead of trying to latch the desired features...
...and apply them after a soft reset (which also required an additional
write to flash), it is now such that features and settings are modified
and stored in flash as before.

After initialisation completes, the active features are latched and are
not to be modified until the next startup. This guarantees that all
saved modifications are persistent even when power is switched of
(without a reset in between).

When a soft reset is required, the active features and the currently
configured features are used to detect if the oneshot feature has
changed state, in which case motor PWM outputs are stopped and soft
reset is done after a 1.5 second delay.

During normal operation the active features will not change and all
changes to features ordered via MSP commands or the CLI are applied to
the configuration that gets saved to flash.

The required effect of modifying features without changing the actions
in the running mainloop is achieved. The user needs to be aware that
changes to features are not applied immidiatly.
2015-05-21 01:27:45 +02:00
Steveis
6448b4b3d7 Replaced gyroData with gyroADC as they both contain the same value 2015-05-17 07:14:42 +01:00
Dominic Clifton
fe40472050 Remove magic number from MSP_SERVO_CONF. 2015-05-08 18:54:20 +01:00
borisbstyle
083a534273 Bump API version to 1.10 due to RC Yaw Expo 2015-05-07 10:59:34 +02:00
Dominic Clifton
f5bfe1ce83 Fix MSP_RC_TUNING and MSP_SET_RC_TUNING to cater for rcYawExpo 2015-05-06 22:27:48 +01:00
borisbstyle
da8bb6f6fc Yaw Expo Feature 2015-05-06 22:23:40 +01:00
Dominic Clifton
526281a519 Fix data length for MSP_FAILSAFE_CONFIG.
Thanks @tricopterY
2015-05-04 18:56:51 +02:00
tricopterY
d7e668af9f Bug fix to cater for additional number of Bytes MSP_RX_CONFIG 2015-05-04 08:56:42 +01:00
Dominic Clifton
441b58c9c8 Allow failsafe config to be set via MSP. Add min/max channel values to
MSP_RX_CONFIG.
2015-04-26 18:27:12 +02:00
Dominic Clifton
c8c0c85656 First-cut of a refactored failsafe system.
* fixes issue where indicators would flash when SBus RX entered failsafe
mode.
* fixes bug where turning off a TX for an SBus RX would instantly disarm
when using a switch to arm when the channel went outside the arming
range.
* introduces failsafe phases to make the system more understandable.
* allows the system to ask if rxSignalIsBeing received for all RX
systems: PPM/PWM/SerialRX/MSP.  Also works when a serial data signal is
still being received but the data stream indicates a failsafe condition
- e.g.  SBus failsafe flags.
* failsafe settings are no-longer per-profile.

Untested: Sumd/Sumh/XBus/MSP (!)
Tested: SBus X8R, Lemon RX Sat, X8R in PWM, Spektrum PPM.
2015-04-16 01:31:12 +01:00
Dominic Clifton
f28158a5a7 Cleanup debug code. 2015-04-14 13:59:11 +01:00
Dominic Clifton
f24782b961 Fix duplicate MSP codes. 2015-03-29 14:23:12 +01:00
Dominic Clifton
60835923c4 Use MSP command IDs in the correct assigned range for MSP_LOOPTIME and
MSP_ARMING_CONFIG.  Rename MSP_ARM_CONFIG to MSP_ARMING_CONFIG.
2015-03-28 20:30:15 +00:00
Dominic Clifton
c68d95dd7a Merge pull request #641 from tricopterY/patch-1
Added new MSP codes to serial_msp.c
2015-03-28 20:24:32 +00:00