1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-15 04:15:44 +03:00

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.
This commit is contained in:
Dominic Clifton 2014-10-24 20:49:00 +01:00
parent bd39445be8
commit 066c814a8a
4 changed files with 60 additions and 27 deletions

View file

@ -493,8 +493,9 @@ static void cliAdjustmentRange(char *cmdline)
// print out adjustment ranges channel settings
for (i = 0; i < MAX_ADJUSTMENT_RANGE_COUNT; i++) {
adjustmentRange_t *ar = &currentProfile->adjustmentRanges[i];
printf("adjrange %u %u %u %u %u %u\r\n",
printf("adjrange %u %u %u %u %u %u %u\r\n",
i,
ar->adjustmentIndex,
ar->auxChannelIndex,
MODE_STEP_TO_CHANNEL_VALUE(ar->range.startStep),
MODE_STEP_TO_CHANNEL_VALUE(ar->range.endStep),
@ -509,6 +510,14 @@ static void cliAdjustmentRange(char *cmdline)
adjustmentRange_t *ar = &currentProfile->adjustmentRanges[i];
uint8_t validArgumentCount = 0;
ptr = strchr(ptr, ' ');
if (ptr) {
val = atoi(++ptr);
if (val >= 0 && val < MAX_SIMULTANEOUS_ADJUSTMENT_COUNT) {
ar->adjustmentIndex = val;
validArgumentCount++;
}
}
ptr = strchr(ptr, ' ');
if (ptr) {
val = atoi(++ptr);
if (val >= 0 && val < MAX_AUX_CHANNEL_COUNT) {
@ -534,7 +543,7 @@ static void cliAdjustmentRange(char *cmdline)
}
}
if (validArgumentCount != 5) {
if (validArgumentCount != 6) {
memset(ar, 0, sizeof(adjustmentRange_t));
}
} else {