Commit Graph

232 Commits

Author SHA1 Message Date
Nicholas Sherlock 3ddea2a849 Fix blackbox baudrate upper bound on CLI
Closes #960
2015-05-28 14:27:49 +12: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
Dominic Clifton 7a01bab50f Constrain invalid values by using rx_min_usec and rc_max_usec. Provide
sensible/fix min/max settings for those settings.

This fixes erratic flight behaviour before failsafe kicks in on SBus
receivers.

An X8R SBus RX in failsafe mode outputs 880 on all channels.

See #918 and #919
2015-05-20 00:28:52 +01:00
Dominic Clifton d0a9d14b87 Allow CLI to be compiled out.
First cut, as proof-of-concept.  This allows CJMCU target to be built
without CLI and with Blackbox.
2015-05-19 23:42:41 +01:00
Michael Jakob 42218f1ea5 The yaw_p_limit minimum is now set to 100 to prevent misconfigurations.
Maximum value of 500 is now removing the limit (same as for
yaw_jump_prevention_limit)
Moving defines for PID controllers to headerfiles.
Some general code cleanup.
Documentation update
2015-05-19 17:42:03 +02:00
Dominic Clifton e57c814e2a CJMCU - Disable cli playsound to save flash space. 2015-05-17 22:21:01 +01:00
Dominic Clifton 19be109189 Merge pull request #890 from ProDrone/cli_processing_mod_1
Some mods to CLI command interpretation and output
2015-05-14 20:10:49 +01:00
ProDrone 6d9394d783 Optimized comment stripper code (again) 2015-05-14 19:59:36 +02:00
ProDrone 0ee67a521b Optimized comment stripper code 2015-05-14 19:59:35 +02:00
ProDrone 1df9097e32 Added # to versionstring and strip comments
Prepended the version string with a # to avoid the CLI from interpreting
the version string as a command when pasting a dump file back (restore
in CLI).

Strip comments starting with `# comment` from lines. This is to allow
adding comments to CLI dumped backup files. For this i have an automated
addition of comments and/or manual comments by the user in mind.
2015-05-14 19:59:34 +02:00
DaTwo ade7887f7a Update serial_cli.c 2015-05-07 04:20:33 -07:00
borisbstyle da8bb6f6fc Yaw Expo Feature 2015-05-06 22:23:40 +01:00
Dominic Clifton d2ef645fbe Merge pull request #823 from ethomas997/addPlaySoundCommand
Add 'play_sound' CLI command
2015-05-04 09:22:04 +01:00
BorisB c3522882f2 yaw_fix default values
Pull request #802 has by default disabled yaw jump. That is fine on the
most of the configurations, but one of my multirotors had an angled
motor due to crash and this was causing weird behaviour.
It is also possible to configure very low values, which can even cause a
craft to not be able to stop after yaw and I am talking about the values
below 100 like 1.

Anyway this fix provides only valid configurable values what can't cause
any danger. Also default parameter is not unlimited anymore and is
configured to 200, which is a safe value to anybody who does the
upgrade.
cli.md is also edited
2015-05-01 13:45:22 +02:00
E Thomas 96de824f61 Add 'play_sound' CLI command
Added 'play_sound' CLI command; improved ACC_CALIBRATION_FAIL sound (to
make it less like ACC_CALIBRATION sound).
2015-04-27 03:46:57 -04:00
Michael Jakob ca9b307850 Adjust variable data type for new CLI parameter 2015-04-23 17:30:21 +02:00
Michael Jakob 2fd79a7aa2 This fix is for avoiding yaw overshoot and bounce back for some
configurations
The hardcoded limit in the mixer and PID controllers 3-5 would be
removed
by default and will be configurable by CLI variables:

yaw_jump_prevention_limit, global setting (original fixed value was 100)
yaw_p_limit, per profile setting (fixed value was 300)
2015-04-23 17:30:20 +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
Nicholas Sherlock 645f4a4d3b Fix CLI: mixer settings should be master values, not profile values 2015-04-14 11:49:20 +12:00
Dominic Clifton 7d9fc2699a Merge branch 'PA_update1' of git://github.com/Pierre-A/cleanflight into Pierre-A-PA_update1
Conflicts:
	src/main/config/config.c
	src/main/io/serial_cli.c
	src/main/telemetry/hott.c
	src/main/telemetry/telemetry.h
2015-04-07 20:33:03 +01:00
Dominic Clifton b0b1eaf9c7 Add first unit test for some code in serial.c. Fix compiler warnings in
other tests.
2015-04-01 14:12:24 +01:00
Nicholas Sherlock 1b5571e268 Ignore trailing spaces on CLI commands 2015-03-24 01:13:26 +13:00
Nicholas Sherlock 828ec550cd Apply the same maximum control rates (1.0) in CLI and MSP
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.
2015-03-22 20:38:15 +13:00
Dominic Clifton 4cf6fe6571 Rename 'frsky_hiprec_vfas' to 'frsky_vfas_precision' and introduce enum
for FRSKY_VFAS_PRECISION_LOW and FRSKY_VFAS_PRECISION_HIGH.

Improves naming for humans.  'hiprec' was meaningless and
untranslatable. See
https://cleancoders.com/episode/clean-code-episode-2/show
2015-03-13 23:49:24 +01:00
Dominic Clifton d82fc6b9be Merge pull request #477 from projectkk2glider/projectkk2glider/issue_316_frsky_voltages
Fixes #316: better arithmetics for FrSky CELL voltages, VFAS battery vol...
2015-03-13 23:40:24 +01:00
Dominic Clifton 4a12d00d1e Moving mixer config out of the profile. It doesn't really make sense. 2015-03-09 23:00:44 +00:00
Dominic Clifton ed434fe47b Use a positive named setting and variable instead of a negative one to
simplify the logic and aid understanding.
2015-03-09 22:50:27 +00:00
Dominic Clifton 5e3734946e # This is a combination of 2 commits.
# The first commit's message is:

Previously, at minimum throttle, the quad would do absolutely no self-leveling
and simply run the motors at constant minthrottle.  This allowed the chance
for the quad to lose control during flight if the throttle was set to minimum,
say, to drop from a high altitude to a lower one.

With this edit, the quad will still self-level at minimum throttle when armed,
allowing for safe decents from altitude.  To prevent motors spinning when
arming/disarming, the yaw input is ignored if the throttle is at minimum and
we're using the sticks to arm/disarm.

Conflicts:
	src/main/flight/mixer.c

# This is the 2nd commit message:

added cli command disable_pid_at_min_throttle
2015-03-09 23:36:54 +01:00
Dominic Clifton bce6c6722c Merge branch 'port-changes' of https://github.com/ledvinap/cleanflight into ledvinap-port-changes
Conflicts:
	src/main/blackbox/blackbox.c
	src/main/io/serial.c
2015-03-09 22:23:04 +01:00
Damjan Adamic 517d38c94f Re #316: Battery voltage calculation converted to integer arithmetic, unit tests updated to account for proper rounding of voltage
Added frsky_hiprec_vfas configuration option that selects how VFAS is sent
Better arithmetics for FrSky CELL voltages, VFAS battery voltage send with other ID that allows 0.1V resolution
2015-03-09 20:43:04 +01:00
Dominic Clifton b595b49ca8 Decouple roll and pitch rates. MSP clients take note of updated
MSP_RC_TUNING/MSP_SET_RC_TUNING commands.
2015-03-07 15:11:20 +00:00
Nicholas Sherlock 8a541a9fa2 Fix upper limit on mag_hardware and acc_hardware CLI variables 2015-03-07 01:18:05 +13:00
Pierre-A af2cd4087a new version including corrections 2015-03-04 15:53:09 +01:00
Dominic Clifton 1a8500c768 Transition to new per-port & per-function baud rate configuration. 2015-02-27 01:05:37 +00:00
Dominic Clifton b6509dd1eb Merge branch 'master' into serial-cleanup
Conflicts:
	src/main/blackbox/blackbox_io.c
	src/main/config/config.c
2015-02-26 22:43:29 +00:00
Dominic Clifton ed434dd169 Cleanup ACC hardware enum so that 'None' is always '1' and doesn't
change every time a new sensor is added.  All the sensor enum values are
now aligned.
2015-02-26 22:31:38 +00:00
Dominic Clifton b9e1283809 Ensure motors are stopped before a reboot. Ensure hard fault handler
doesn't use potentially unitialised data to update the motors.  Pause
for 50ms before rebooting after updating disabling the motors to ensure
the timer hardware and ESCs havea chance to react.

This commit might help with #123
2015-02-23 14:02:47 +00:00
Petr Ledvina 1ecbdf3dae Minor code cleanup 2015-02-23 09:17:06 +01:00
Dominic Clifton 2f09b7d1d9 Merge branch 'blackbox-flash' of https://github.com/sherlockflight/cleanflight-dev into sherlockflight-blackbox-flash 2015-02-22 17:24:39 +00:00
Dominic Clifton 9057d70410 Allow excluding of servo code at compilation time.
This is in preparation for backbox on CJMCU/64k.

Flight tested on CJMCU.
2015-02-22 16:21:03 +00:00
Dominic Clifton a1b01807cf Merge branch 'lowpass' of https://github.com/fusterjj/cleanflight into fusterjj-lowpass
Conflicts:
	src/main/flight/mixer.c
2015-02-22 14:55:04 +00:00
Pierre-A 83aa49a812 battery alarm sound for Hott telemetry binary mode 2015-02-22 09:47:22 +01:00
Nicholas Sherlock f6c9f7cc4a Merge remote-tracking branch 'upstream/master' into blackbox-flash 2015-02-21 12:52:26 +13:00
Dominic Clifton 523980fc7b Merge remote-tracking branch 'cleanflight/master' into serial-cleanup 2015-02-20 20:15:09 +00:00
Dominic Clifton f6408cd355 CJMCU disable cli servos command to save flash space.
At some point in the future it might be an idea to use a define for
USE_SERVOS so that more code could be excluded. (Servo tilt, etc).
2015-02-20 18:51:50 +00:00
Nicholas Sherlock 6c30f879be Merge remote-tracking branch 'upstream/master' into servo-cli 2015-02-20 13:37:01 +13:00
Nicholas Sherlock e636d8b945 Merge remote-tracking branch 'upstream/master' into blackbox-flash 2015-02-20 13:34:59 +13:00
Dominic Clifton 021496b244 Merge branch 'master' into serial-cleanup 2015-02-19 21:57:54 +00:00
Dominic Clifton 1de72b11ce Update the cli `status` command to show all detected sensors (Except on
CJMCU).

Further cleanup of sensor initialisation.
2015-02-19 21:08:30 +00:00
Nicholas Sherlock 155a369491 Reduce code size of serial_cli by 104 bytes with some small tweaks:
Avoid calling strlen() just to check if a string is empty
Shorter error messages and reuse messages for cliServo
Use cliPrint rather than printf when not using placeholders
2015-02-18 13:07:26 +13:00
Nicholas Sherlock 716ee9f5c4 Add "servo" CLI command to get/set servo conf, and include in dump 2015-02-17 23:33:12 +13:00
Nicholas Sherlock 892f1698d9 Rename flash_ident command to flash_info 2015-02-16 18:07:58 +13:00
Nicholas Sherlock d6911e8b86 Avoid synchronous flushes to flash during Blackbox shutdown 2015-02-15 23:23:53 +13:00
Nicholas Sherlock acd4745a4e Merge remote-tracking branch 'upstream/master' into blackbox-flash 2015-02-15 01:54:50 +13:00
Nicholas Sherlock 6423ac7db1 Rename FLASHFS to USE_FLASHFS 2015-02-14 09:45:56 +13:00
Nicholas Sherlock 80ea5e4419 Add flash ready state to MSP response, add flash async block write 2015-02-13 20:28:19 +13:00
Dominic Clifton 5163bef0b2 Refactor serial port configuration, stage 1.
Tested and working:
* multiple MSP ports at different baud rates.
* cli on any MSP port.
* GPS
* gps passthough on currently active cli port.

Example config used for testing:

feature SOFTSERIAL
feature GPS
feature RX_PPM
serial_port_1_functions = 1
serial_port_1_baudrate = 115200
serial_port_2_functions = 128
serial_port_2_baudrate = 115200
serial_port_3_functions = 1
serial_port_3_baudrate = 19200
serial_port_4_functions = 0
serial_port_4_baudrate = 0

Known broken:
* Telemetry and shared serial ports
* Telemetry when unarmed.

Probably broken:
* Blackbox on shared port.

Untested.
* Serial RX.
* Blackbox.
2015-02-12 01:28:53 +00:00
Nicholas Sherlock 5651e65a0b Add support for discovering beginning of free space on flash chip 2015-02-10 13:44:18 +13:00
Dominic Clifton 6de42dd0de Display version on the OLED display. 2015-02-02 22:30:59 +00:00
Dominic Clifton 395a1bb9a3 Update cli version command to show the version number now that there is
one available.
2015-02-02 22:05:30 +00:00
Dominic Clifton 55cac2bdeb Finally rename flight.c/.h to pid.c/.h. Cleanup some dependencies.
Relocate more code.
2015-02-01 00:39:38 +01:00
Dominic Clifton 53406a7ac7 Relocate some structures and code to the right places.
This cleans up the include file order somewhat and fixes a couple of
dependencies.

The goal of this is to rename flight.c/flight.h to pid.c/pid.h.
2015-01-31 23:47:51 +01:00
Joel Fuster 4f0af41e79 Merge remote-tracking branch 'upstream/master' into lowpass 2015-01-31 10:47:39 -05:00
Dominic Clifton fa18940087 Minor cleanups to allow CJMCU to build again. 2015-01-30 21:25:18 +01:00
Dominic Clifton f77a762b48 Allow inflight adjustments for floating-point based PID controllers. 2015-01-30 20:54:34 +01:00
Nicholas Sherlock ebff1bdcd7 Merge remote-tracking branch 'upstream/master' into blackbox-flash 2015-01-30 13:48:49 +13:00
Nicholas Sherlock 3c74ac2c91 Make more bulk writes asynchronous where possible, begin MSP impl. 2015-01-30 13:45:05 +13:00
Michael Jakob b4803697d2 Initial port of Harakiri PID controller
some of the settings are hardcoded
2015-01-28 13:26:51 +01:00
Nicholas Sherlock 5a57dda665 Adding blackbox device setting and basic flashfs support for it 2015-01-28 22:14:49 +13:00
Nicholas Sherlock f9e22a0461 Merge remote-tracking branch 'upstream/master' into blackbox-flash 2015-01-28 20:48:17 +13:00
Nicholas Sherlock 2e14faeef6 Comment updates, allow CLI flash read to read more in one operation 2015-01-28 20:48:06 +13:00
Nicholas Sherlock 3eb28f16ea Basic read/write/erase flash functionality works from the CLI
Very little code coverage tested yet, only writes of small sizes
2015-01-28 17:45:36 +13:00
Dominic Clifton a2b232e805 Detach midrc (input) from servo center (output).
This fixes incorrect servo center position when midrc was not 1500.
Most likely only experienced by futaba plane or servo/tilt users.
2015-01-27 23:04:41 +01:00
Dominic Clifton 153f6483e2 Merge pull request #429 from MJ666/MultiWii_PID_32
MultiWi 2.3 PID controller port
2015-01-26 18:14:16 +01:00
Dominic Clifton 9ffe8779d7 Merge branch 'virtualcurrent' of https://github.com/tracernz/cleanflight into tracernz-virtualcurrent 2015-01-26 15:21:42 +01:00
Michael Jakob dda5c2ccb7 Cleanup code and implement Hybrid MultiWii PID controller
Roll and pitch is using 2.2 algorithm
Yaw is using 2.3 algorithm
2015-01-26 07:55:37 +01:00
Michael Jakob 48161a31ca MultiWii 2.3 PID controller
will be activated with set pid_controller = 3
2015-01-26 07:55:37 +01:00
Marc Egli bf86deed4c Add support for current sensors with a negative scale 2015-01-23 11:51:05 +01:00
tracernz a37c6ee9ee Merge https://github.com/cleanflight/cleanflight into virtualcurrent 2015-01-16 22:03:53 +13:00
tracernz 999f0ce002 Add virtual current sensor support
Virtual current sensor calculates an estimate of current based on
throttle position, current_meter_scale, and current_meter_offset.
Documentation to follow later.
2015-01-16 22:00:45 +13:00
Dominic Clifton b7462c0b3d Merge pull request #351 from nebbian/baseflight-pid-horizon-mode-tuneup_a
Baseflight pid (pid_controller=2) horizon mode tuneup
2015-01-16 00:50:12 +00:00
Joel Fuster 09862aed78 Merge with upstream 2015-01-10 14:31:34 -05:00
Ben Hitchcock 69d94c81e1 Second draft of the tuneup.
This uses ints for the sensitivity instead of mapping floats back and forth.
 Also the stick position is read directly, without the RC_Rate affecting this value.
2015-01-07 21:54:13 +08:00
Dominic Clifton fcbda7ec63 Merge pull request #227 from sherlockflight/master
Add blackbox flight data recorder feature
2015-01-06 21:56:49 +00:00
Ben Hitchcock 6b7c9facd3 First draft of better horizon mode 2015-01-06 21:53:23 +08:00
Pierre-A 92ca14a419 Correction of bug issue#312 2015-01-05 10:40:25 +01:00
Joel Fuster 06ce23951b Rename freq parameter; remove UT warnings 2015-01-04 22:15:09 -05:00
Joel Fuster 4bcedab3e9 Clean up lowpass patch 2015-01-02 17:16:55 -05:00
Joel Fuster 3eee9eb079 Lowpass testing 2015-01-01 19:24:35 -05:00
Joel Fuster cf40e3231a Add configuration of notch filter
More fine-grained filter freqs
2015-01-01 15:03:40 -05:00
Nicholas Sherlock 321fc717ab Merge remote-tracking branch 'upstream/master' 2014-12-27 20:00:45 +13:00
Dominic Clifton 84b197d5f8 Merge branch 'feature-autodisarm' of https://github.com/ledvinap/cleanflight into ledvinap-feature-autodisarm 2014-12-26 19:01:24 +00:00
Nicholas Sherlock dfd8e5b2b0 Merge branch 'master' of https://github.com/cleanflight/cleanflight 2014-12-26 11:56:00 +13:00
Dominic Clifton 36c0b6f106 Cleanup MPU9150 support. 2014-12-24 23:53:17 +00:00
Dominic Clifton ee19c1f071 Rename multiType to mixerMode. Rename MULTITYPE_* to MIXER_*.
'Type' is a noise word.

'Multi' is a mis-nomer - there is nothing 'multi' about a gimbal or
fixed wing.
2014-12-24 11:58:57 +00:00
Dominic Clifton b123b4ef03 Cleanup disabling of mixers for CJMCU, this might be usefulfor the
AlienWii32 target too.

Deleted old out of date comments.  Various other minor cleanups.
2014-12-24 11:33:14 +00:00
Petr Ledvina eea8f90595 auto-disarm implementation, slight rewrite of HFMan commit 931478054e70cd6a51916ea9430f041f61b7f7ba
Added automatic disarm after 5 seconds when feature MOTOR_STOP is enabled (has no effect on
FIXED_WING configurations.)  Users that don't have a buzzer to warn when
board is armed and use feature MOTOR_STOP can forget to disarm the
board. For example after landing they pick up copter and then
accidentally move throttle up when trying to remove flight battery.

Configurable via CLI using 'set auto_disarm_board=x' where x is 0-60
seconds.  If zero, does not auto_disarm.
2014-12-22 14:39:50 +01:00
Nicholas Sherlock 1b1a285b4a Syncing with Cleanflight upstream 2014-12-22 23:23:26 +13:00
Dominic Clifton 183c5f8e16 Add MPU9150 mag support and mag autodetection. Add AK8975 mag driver.
Note: not working on the sparky, MPU9150 needs passthough enabling but
when enabled the mag and gyro won't ack on the default addresses.  Needs
further investigation.
2014-12-21 23:40:48 +00:00
Dominic Clifton 13305dd2e4 Disable mixer configuration on CJMCU to save flash size. 2014-12-21 23:40:48 +00:00