Commit Graph

29 Commits

Author SHA1 Message Date
Dominic Clifton 9ddbb4ed9d Allow inflight adjustment of rc_expo. 2014-10-24 21:58:30 +01:00
Dominic Clifton 81e3425326 Allow inflight adjustment of pitch/roll rate. 2014-10-24 21:52:12 +01:00
Dominic Clifton 066c814a8a Update `adjrange` command to take an 'adjustment index/slot'. Apply
adjustment ranges to adjustment slots when channel is within range.

example:

```
adjrange 0 0 0 900 1700 0 2
adjrange 1 0 0 1700 2100 1 2
```

explained:

* configure adjrange 0 to use adjustment slot 1 (0) so that when aux1
(0) in the range 900-1700 then do nothing when aux 3 (2) is in any
position.
* configure adjrange 1 to use adjustment slot 1 (0) so that when aux1
(0) in the range 1700-2100 then do use adjustment 1 (rc rate) when aux 3
(2) is in the appropriate position.

Without the entire range of aux1 being defined there is nothing that
would stop aux 3 adjusting the rc rate once aux 1 wasn't in the higher
range. 

There are 4 adjustment slots and 12 adjustment ranges.

Adjustment slots and adjustment ranges can use the same aux channel.

e.g.

`adjrange 2 1 0 900 2100 1 3`

* configure adjrange 2 to use adjustment slot 2 (1) so that when aux4
(3) in the range 900-2100 then use adjustment 1 (rc rate) when aux 4 (3)
is in the appropriate position.
2014-10-24 20:49:00 +01:00
Dominic Clifton bd39445be8 Add cli command to configure adjustment ranges.
e.g. `adjrange 0 0 1700 2100 1 2`

set adjustment range 0, which applies to aux channel 0 (aux1) when range
is between 1700 and 2100 then apply function 1 (rc rate) to aux channel
2 (aux3)
2014-10-24 19:51:40 +01:00
Dominic Clifton 18abad5dd7 Extract range definition so it can be reused. 2014-10-24 18:57:06 +01:00
Dominic Clifton b2db6b3b80 Beep when adjustments are made. (very short = adjust downwards, short =
adjust upwards).
2014-10-24 18:48:55 +01:00
Dominic Clifton a2a9443045 Seperate adjustment configuration from adjustment state. Rename 'step'
parameter to 'delta' applying the adjustment.  Configure adjustment
states based on adjustment configuration for AUX3 and AUX4.
2014-10-24 15:46:07 +01:00
Dominic Clifton 45d9678a39 Use adjustment index rather than function to track state. 2014-10-24 15:10:28 +01:00
Dominic Clifton e21f0667c5 Update adjustmentConfig to include the adjustment timeout. 2014-10-24 14:58:41 +01:00
Dominic Clifton b0b83b31db Make the adjustment controls more sensitive by using a smaller 3POS
switch deadzone.
2014-10-22 23:20:59 +01:00
Dominic Clifton 6d7035819f First cut of allowing a 3POS switch on AUX3 to change rc rate.
rcRate is decreased when low, increased when HIGH and no change when the
switch is in the middle.

The rcRate ticks up/down at 0.01 every 500ms if the switch is left on.

If using a momentary switch and if you can toggle the switch between
middle and low or middle and high more frequently than 500ms then the
rate will be increased accordingly.  Similar to how a keyboard repeat
behaves.
2014-10-22 23:10:40 +01:00
Dominic Clifton ca9f183b83 Cleanup some aux range defines and comments. 2014-10-12 21:05:34 +01:00
Dominic Clifton cfcd4792bb Determine with an aux range is used to arm. 2014-10-12 21:02:45 +01:00
Dominic Clifton b43fa247de Handle channel boundaries better.
More efficient, less code, easier to understand.
2014-10-12 18:31:59 +01:00
Dominic Clifton 2369a63df0 First cut of code that passed the unit tests for mod activations,
however it uses / operations and doesn't handle the case where the
channel value is on the boundary between two ranges.
2014-10-12 18:15:44 +01:00
Dominic Clifton c0fd0c1f33 Replace profile.activate and rcOptions with
profile.modeActivationCondition and rcModeActivationMask.

Implementation of using and setting modeActivationConditions is missing.
2014-10-12 10:40:38 +01:00
Dominic Clifton d60183d91d Normalize all the line endings 2014-09-15 23:40:17 +01:00
Andreas Tacke 275089eca1 Make disarming via AUX switch independent of throttle value configurable
Conflicts:
	src/cli.c
	src/config.c
	src/mw.c
	src/mw.h
2014-09-08 11:02:02 +01:00
Dominic Clifton 5a36db26c9 Fix bug where aux configuration for channels 5-8 were ignored.
The bug was introduced by a recent refactor which was in error.

Fixed using TDD by first creating a failing unit test and then fixing
the code.
2014-09-06 00:28:48 +01:00
Dominic Clifton 1c6ea1d397 Fix ANGLE mode and HORIZON mode resetting the errorAngle when they are
both attempted to be enabled at the same time.  Angle mode now takes
precedence over horizon mode.

Fix using aux settings that are not applicable to in-use aux channels -
prior to this it was possible to configure aux4 and then switch to
RX_SERIAL using a 7 channel system (3 aux channels) and aux4 would still
have been processed.
2014-08-26 21:28:23 +01:00
Dominic Clifton 9b4ccdc73a Only set OK-to-arm flag when arm switches are disabled.
This prevents arming after connecting a battery when the throttle is in
low; when using a switch to arm and when the switch is left in the ON
position.

The previous solution was flawed because of the way rc input is handled.

This also removes an extra test of rcOptions by re-arranging the logic
that handles arming/disarming via a switch.
2014-08-24 22:59:59 +01:00
Dominic Clifton 3f0754d295 Replace global flags with stateFlags, flightModeFlags and armingFlags.
Each flag was previously a whole byte, now all of the flags only take up
4 bytes as they are represented by bit masks.

This is cleaner because the different kind of flags are now separated.

Additionally this changes the behaviour of arming slightly.  When using
a switch to arm the aircraft will not arm unless the switch has been in
the off state once.  This prevents arming if you power the aircraft with
a low throttle and the switch in the on position.
2014-08-24 12:11:30 +01:00
treymarc 9cf90fa230 smallAngle configurable, user can arm/disarm with swith in any
orientation
Conflicts:

	src/cli.c
	src/config.c
	src/imu.c
	src/mw.c
	src/mw.h
2014-07-31 00:25:24 +01:00
Dominic Clifton 3b629d58a0 GPS can now be conditionally compiled in. 2014-07-30 23:35:33 +01:00
Dominic Clifton e867af8c4b Correct project name in GPL notices. 2014-06-05 00:47:47 +01:00
Dominic Clifton d718f5b9d6 Support configuring AUX 5 to 8.
The MSP is changed in a way that might provide some backwards
compatibility.  The first 4 channels are sent/read as before followed by
the next 4 channels.

If I client ignores extra data received it should be backwards
compatible.

Clients can looks for the new capability bit which indicates the MSP
protocol supports AUX 1-8.
2014-06-04 19:50:12 +01:00
Dominic Clifton 0bbcd6570f Updated source files to include the GPL v3 notices. Include a copy of
the GPL v3.
2014-06-04 16:48:23 +01:00
Dominic Clifton 18046013a4 Decouple sticks processing code from main mw loops.
Decouple led ring driver from non-driver code.
2014-06-01 18:36:33 +01:00
Dominic Clifton d19a5e7046 Cleanup project structure. Update unit test Makefile to place object
files in obj/test
2014-05-31 22:43:06 +01:00