Add begin write and end write hints. If implemented by the serial
driver, then the driver can buffer up data sent via serialWrite() and
flush it when serialEndWrite() is called.
Implemented at the buffer level as it requires the least change to how
serial_msp and serial_cli are architected.
Also tidy up the visibility in the VCP driver.
Signed-off-by: Michael Hope <mlhx@google.com>
This bulks up the writes and lets the USB VCP driver send one 20 byte
frame instead of 20 one byte frames. This speeds up the blackbox
download and makes VCP much more reliable when running under a virtual
machine.
Signed-off-by: Michael Hope <mlhx@google.com>
Updated SPI driver (SPI3 on F3 targets)
AK8963 Mag support (part of MPU9250)
MPU9250 SPI support via MPU6500 driver
Updated LED driver for alternative LED sets
Enable gyro intterupt for AlienFlight F3 targets
Update AlienWii/AlienFlight documentation
Rename AlienWii to AlienFlight
Disallow arming if system load > 100 (waiting task count > 1)
Dont show inactive tasks in CLI
Realtime priority task and guard interval implementation
Dynamic guard interval. Bugfix for realtime scheduling hickups
Optimisations
Compile out CLI command help and CLI tasks command for CJMCU
Naming fixes // re-Add Gyro Sync // Fix port issues
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
- 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
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
efficiently). Update MSP_SERVO_CONFIGURATIONS,
MSP_SET_SERVO_CONFIGURATION value order. Add some error checking to
size of MSP_SET_SERVO_CONFIGURATION.
* 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.
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.
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
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>
...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.
* 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.
Previously it was possible to set roll/pitch rate > 1.0 using MSP, but
not using the CLI. Roll/pitch rate > 1.0 is meaningless.
TPA is also limited to 1.0.
Enhanced MSP_RC_TUNING and MSP_SET_RC_TUNING. Configurator's PID Tuning tab can be enabled to update TPA Breakpoint.
PID Tuning tab must be enhanced for this feature. Agnostic if older versions of Configurator are used.