mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-16 14:23:34 +08:00
Gather RSSI data from Spektrum Telemetry receivers
On SPM4649T receivers with firmware versions at least 1.1RC9, the serial data will contain an rssi value in dbm, as outlined in the Remote Receiver Interfacing document section 8.3.1. If the value received is greater than or equal to zero, the receiver does not support rssi data, and the incoming value will be ignored. However, if the value is negative, we can use the rssi value. When we have a valid rssi, it gets mapped to a percentage from 0 to 100 as expected by mavlink. This mapping is constructed as a logarithmic function over Spektrum's published minimum and maximum rssi values, -92dBm to -42dBm as 0 to 100: 100 Log10[1 + (x - min) * (9 / (max - min))] This change updates all calls to the dsm input rountes to return the rssi value. Note that one place this doesn't work with the px4io enabled. There is a comment left in the absence of analog rssi that: "we do not actually get digital RSSI regs[PX4IO_P_RAW_RC_NRSSI]". This restriction has been left in place, as removing it exposes a problem where the frequency of the control tick is greater than that of valid dsm frames so the rssi isn't valid every cycle.
This commit is contained in:
committed by
Lorenz Meier
parent
8feac97399
commit
597372bec9
@@ -78,8 +78,9 @@ bool dsm_port_input(uint16_t *rssi, bool *dsm_updated, bool *st24_updated, bool
|
||||
uint8_t n_bytes = 0;
|
||||
uint8_t *bytes;
|
||||
bool dsm_11_bit;
|
||||
int8_t spektrum_rssi;
|
||||
*dsm_updated = dsm_input(_dsm_fd, r_raw_rc_values, &r_raw_rc_count, &dsm_11_bit, &n_bytes, &bytes,
|
||||
PX4IO_RC_INPUT_CHANNELS);
|
||||
&spektrum_rssi, PX4IO_RC_INPUT_CHANNELS);
|
||||
|
||||
if (*dsm_updated) {
|
||||
|
||||
@@ -93,6 +94,7 @@ bool dsm_port_input(uint16_t *rssi, bool *dsm_updated, bool *st24_updated, bool
|
||||
r_raw_rc_flags &= ~(PX4IO_P_RAW_RC_FLAGS_FRAME_DROP);
|
||||
r_raw_rc_flags &= ~(PX4IO_P_RAW_RC_FLAGS_FAILSAFE);
|
||||
|
||||
*rssi = spektrum_rssi;
|
||||
}
|
||||
|
||||
perf_end(c_gather_dsm);
|
||||
|
||||
Reference in New Issue
Block a user