|
| 1 | +# INS_RC_ORIG |
| 2 | + |
| 3 | +Custom INS fork feature for preserving original RX channel values when `MSP RC Override` is active. |
| 4 | + |
| 5 | +This branch is intended for local INS builds and flight testing. It is not an upstream INAV feature at this stage. |
| 6 | + |
| 7 | +## Why this exists |
| 8 | + |
| 9 | +With standard `MSP RC Override`, the final RC channels seen by the flight controller are the overridden ones. That is fine for control, but it makes it hard for an external computer to also read the pilot's original stick input at the same time. |
| 10 | + |
| 11 | +`INS_RC_ORIG` solves that by mirroring selected **pre-override** RX channels into spare destination channels. |
| 12 | + |
| 13 | +Typical use case: |
| 14 | + |
| 15 | +- channels `1..4` are used for flight control and may be overridden by MSP |
| 16 | +- spare channels such as `18`, `19`, `20`, `21` carry the original RX values |
| 17 | +- an external controller can read both the overridden controls and the pilot's original inputs over MSP |
| 18 | + |
| 19 | +## What it does |
| 20 | + |
| 21 | +The feature adds four configurable copy rules. |
| 22 | + |
| 23 | +For each rule: |
| 24 | + |
| 25 | +1. INAV reads and processes normal RX input. |
| 26 | +2. A snapshot of the original processed RX channels is stored. |
| 27 | +3. `MSP RC Override` is applied normally. |
| 28 | +4. The selected original channel is copied into the selected destination channel. |
| 29 | + |
| 30 | +The destination channel therefore always contains the **original value from before MSP override**. |
| 31 | + |
| 32 | +## Requirements |
| 33 | + |
| 34 | +- firmware must be built with `USE_MSP_RC_OVERRIDE` |
| 35 | +- `MSP RC Override` must be configured in the normal way if you want channels to be overridden |
| 36 | +- destination channels should be spare channels that are not already used for important functions |
| 37 | + |
| 38 | +## CLI settings |
| 39 | + |
| 40 | +Four source/destination pairs are available: |
| 41 | + |
| 42 | +- `rc_orig_src_1` and `rc_orig_dst_1` |
| 43 | +- `rc_orig_src_2` and `rc_orig_dst_2` |
| 44 | +- `rc_orig_src_3` and `rc_orig_dst_3` |
| 45 | +- `rc_orig_src_4` and `rc_orig_dst_4` |
| 46 | + |
| 47 | +Rules are **1-based** channel numbers: |
| 48 | + |
| 49 | +- `0` disables the source or destination side of that rule |
| 50 | +- valid channel range is `1..34` |
| 51 | + |
| 52 | +## Recommended setup |
| 53 | + |
| 54 | +For the common Raspberry Pi use case: |
| 55 | + |
| 56 | +- keep MSP override on channels `1..4` |
| 57 | +- mirror original pilot input to high spare channels |
| 58 | + |
| 59 | +Example: |
| 60 | + |
| 61 | +```text |
| 62 | +set msp_override_channels = 15 |
| 63 | +set rc_orig_src_1 = 1 |
| 64 | +set rc_orig_dst_1 = 18 |
| 65 | +set rc_orig_src_2 = 2 |
| 66 | +set rc_orig_dst_2 = 19 |
| 67 | +set rc_orig_src_3 = 3 |
| 68 | +set rc_orig_dst_3 = 20 |
| 69 | +set rc_orig_src_4 = 4 |
| 70 | +set rc_orig_dst_4 = 21 |
| 71 | +save |
| 72 | +``` |
| 73 | + |
| 74 | +Meaning: |
| 75 | + |
| 76 | +- channel `1` may be overridden by MSP |
| 77 | +- channel `18` always carries the original value of channel `1` |
| 78 | +- channel `2` may be overridden by MSP |
| 79 | +- channel `19` always carries the original value of channel `2` |
| 80 | +- channel `3` may be overridden by MSP |
| 81 | +- channel `20` always carries the original value of channel `3` |
| 82 | +- channel `4` may be overridden by MSP |
| 83 | +- channel `21` always carries the original value of channel `4` |
| 84 | + |
| 85 | +## Example with only roll and pitch |
| 86 | + |
| 87 | +If you only need two original channels: |
| 88 | + |
| 89 | +```text |
| 90 | +set rc_orig_src_1 = 1 |
| 91 | +set rc_orig_dst_1 = 18 |
| 92 | +set rc_orig_src_2 = 2 |
| 93 | +set rc_orig_dst_2 = 19 |
| 94 | +set rc_orig_src_3 = 0 |
| 95 | +set rc_orig_dst_3 = 0 |
| 96 | +set rc_orig_src_4 = 0 |
| 97 | +set rc_orig_dst_4 = 0 |
| 98 | +save |
| 99 | +``` |
| 100 | + |
| 101 | +## MSP behavior |
| 102 | + |
| 103 | +`MSP_RC` is extended up to the highest configured destination channel so the mirrored channels are visible to external consumers. |
| 104 | + |
| 105 | +Example: |
| 106 | + |
| 107 | +- if your receiver normally exposes 16 channels |
| 108 | +- and you mirror to channels `18` and `19` |
| 109 | +- `MSP_RC` will return channels up to `19` |
| 110 | + |
| 111 | +This allows the external controller to read: |
| 112 | + |
| 113 | +- final overridden channels in their normal positions |
| 114 | +- original mirrored channels in the configured destination positions |
| 115 | + |
| 116 | +## Important behavior notes |
| 117 | + |
| 118 | +- Destination channels are written **after** MSP override. |
| 119 | +- Destination channels contain the original RX value, not the MSP value. |
| 120 | +- If `src == dst`, that channel is effectively restored to the original pre-override value after MSP override. |
| 121 | +- If a source channel is outside the active RX channel count, that rule is ignored. |
| 122 | +- If a destination channel is used for arming, modes, RSSI, gimbal control, or anything else important, the copied value will overwrite that destination every cycle. |
| 123 | + |
| 124 | +## Recommended safety rules |
| 125 | + |
| 126 | +- Use only spare AUX channels as destinations. |
| 127 | +- Do not map mirrored originals into channels that drive flight modes unless you explicitly want that behavior. |
| 128 | +- Bench test with props removed before first flight. |
| 129 | +- Verify channel behavior in Configurator and over MSP before airborne testing. |
| 130 | + |
| 131 | +## Quick verification checklist |
| 132 | + |
| 133 | +1. Build and flash firmware with `USE_MSP_RC_OVERRIDE`. |
| 134 | +2. Set up your normal `MSP RC Override` mode and `msp_override_channels`. |
| 135 | +3. Configure the `rc_orig_src_*` and `rc_orig_dst_*` rules. |
| 136 | +4. Move the sticks with MSP override disabled and confirm destination channels mirror the source channels. |
| 137 | +5. Enable MSP override and confirm: |
| 138 | + - source control channels follow MSP override |
| 139 | + - destination channels still follow the pilot's original RX input |
| 140 | + |
| 141 | +## Implementation summary |
| 142 | + |
| 143 | +Main changes for this feature live in: |
| 144 | + |
| 145 | +- [src/main/rx/rx.c](src/main/rx/rx.c) |
| 146 | +- [src/main/rx/rx.h](src/main/rx/rx.h) |
| 147 | +- [src/main/fc/settings.yaml](src/main/fc/settings.yaml) |
| 148 | +- [src/main/fc/fc_msp.c](src/main/fc/fc_msp.c) |
| 149 | + |
| 150 | +## Status |
| 151 | + |
| 152 | +Current intent: |
| 153 | + |
| 154 | +- custom INS branch feature |
| 155 | +- useful for local builds and Pi-assisted control experiments |
| 156 | +- kept separate from upstream until the behavior is proven in real use |
0 commit comments