Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions docs/INS RC ORIG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# INS RC ORIG

`INS RC ORIG` adds configurable pre-override RC channel copies.

The goal is to preserve original RX values even when `MSP RC Override` is active. The firmware stores a snapshot of the processed RX channels before MSP override is applied, then copies selected original channels into selected destination channels.

## How it works

- Source channels are read from the normal RX path before `MSP RC Override`.
- `MSP RC Override` is applied as usual to the configured override mask.
- After that, the configured copy rules write the original pre-override values into the destination channels.
- Destination channels therefore always contain the original RX value, not the overridden MSP value.

This is intended for routing original stick data into spare AUX channels such as `18`, `19`, `20`, `21` so an external controller can read both:

- overridden flight channels `1..4`
- original RX channels mirrored into spare channels

## CLI settings

Four copy rules are available:

- `rc_orig_src_1` / `rc_orig_dst_1`
- `rc_orig_src_2` / `rc_orig_dst_2`
- `rc_orig_src_3` / `rc_orig_dst_3`
- `rc_orig_src_4` / `rc_orig_dst_4`

Rules use 1-based RC channel numbers.

- Set either side to `0` to disable that rule.
- Valid channel range is `1..34`.

## Example

Mirror original roll and pitch into channels `18` and `19`:

```text
set rc_orig_src_1 = 1
set rc_orig_dst_1 = 18
set rc_orig_src_2 = 2
set rc_orig_dst_2 = 19
save
```

With `MSP RC Override` active:

- channel `1` can still be overridden by MSP
- channel `2` can still be overridden by MSP
- channel `18` contains the original value of channel `1`
- channel `19` contains the original value of channel `2`

## Notes

- Destination channels should normally be unused spare channels.
- If a destination channel is also used for flight control, mode switching, or MSP override, the copy rule will overwrite that destination with the original RX value.
- If `src == dst`, that channel is effectively restored to its original pre-override value after MSP override.
- If the source channel is outside the active RX channel count, that rule is ignored.
- `MSP_RC` output is extended up to the highest configured destination channel so channels like `18` and `19` are visible to external consumers.

## Typical workflow

1. Build firmware with `USE_MSP_RC_OVERRIDE`.
2. Configure `MSP RC Override` mode and `msp_override_channels` as usual.
3. Choose spare destination channels for the mirrored originals.
4. Configure the `rc_orig_src_*` and `rc_orig_dst_*` rules.
5. Read the mirrored original values from the destination channels over MSP.
4 changes: 4 additions & 0 deletions src/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ main_sources(COMMON_SRC
drivers/osd.h
drivers/persistent.c
drivers/persistent.h
drivers/dshot_bidir.c
drivers/dshot_bidir.h
drivers/pitotmeter/pitotmeter_adc.c
drivers/pitotmeter/pitotmeter_adc.h
drivers/pitotmeter/pitotmeter_ms4525.c
Expand Down Expand Up @@ -462,6 +464,8 @@ main_sources(COMMON_SRC
sensors/esc_sensor.h
sensors/irlock.c
sensors/irlock.h
sensors/rpm_source.c
sensors/rpm_source.h
sensors/sensors.c
sensors/temperature.c
sensors/temperature.h
Expand Down
12 changes: 9 additions & 3 deletions src/main/blackbox/blackbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
#include "sensors/rangefinder.h"
#include "sensors/sensors.h"
#include "sensors/esc_sensor.h"
#include "sensors/rpm_source.h"
#include "flight/wind_estimator.h"
#include "sensors/temperature.h"

Expand Down Expand Up @@ -1428,9 +1429,14 @@ static void loadSlowState(blackboxSlowState_t *slow)
#endif

#ifdef USE_ESC_SENSOR
escSensorData_t * escSensor = escSensorGetData();
slow->escRPM = escSensor->rpm;
slow->escTemperature = escSensor->temperature;
uint32_t escRpm = 0;
slow->escRPM = rpmSourceGetAverageRpm(&escRpm) ? escRpm : 0;
slow->escTemperature = TEMPERATURE_INVALID_VALUE / 10;

escSensorData_t *escSensor = escSensorGetData();
if (escSensor && escSensor->dataAge <= ESC_DATA_MAX_AGE) {
slow->escTemperature = escSensor->temperature;
}
#endif
}

Expand Down
1 change: 1 addition & 0 deletions src/main/build/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ typedef enum {
DEBUG_GPS,
DEBUG_LULU,
DEBUG_SBUS2,
DEBUG_DSHOT_BIDIR,
DEBUG_COUNT // also update debugModeNames in cli.c
} debugType_e;

Expand Down
Loading
Loading