From e5fd0de1b9bea94c92b02259bc4862e9e3bb4c0a Mon Sep 17 00:00:00 2001 From: "DESKTOP-TG61LAS\\Olli" Date: Thu, 10 Oct 2024 04:01:30 +0200 Subject: [PATCH] dronecan 1140.RCInput: add flags to represent LQ, RSSi dbm and SNR link statistics --- dronecan/sensors/rc/1140.RCInput.uavcan | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/dronecan/sensors/rc/1140.RCInput.uavcan b/dronecan/sensors/rc/1140.RCInput.uavcan index 479d203..a7d2bbe 100644 --- a/dronecan/sensors/rc/1140.RCInput.uavcan +++ b/dronecan/sensors/rc/1140.RCInput.uavcan @@ -1,9 +1,27 @@ -uint8 STATUS_QUALITY_VALID = 1 # quality field is valid +# +# RC channels +# +# The quality field can carry different information on the quality of a radio link, as determined by the flags in the status bitmask: +# - STATUS_QUALITY_VALID: The quality field is valid and represents RSSI in scaled units, 0 is no signal, 255 is "full" signal. The +# mapping of a link's internal RSSI representation onto the scaled units is device dependent. A common mapping can be +# RSSI >= -50 dB: 255 +# RSSI > -120 dB and RSSI < -50 dBm: 255 / 70 * (RSSI + 120) but not smaller than 1 +# RSSI <= -120 dB: 1 +# - STATUS_QUALITY_LQ: The quality field is valid and represents LQ in percent, 0 is no signal, 100 is 100% link quality +# - STATUS_QUALITY_RSSI_DBM: The quality field is valid and represents RSSI in inverted dBm, 0 is no signal, 1 = -1 dBm, 255 = -255 dBm +# - STATUS_QUALITY_SNR: The quality field is valid and represents SNR in device dependent units, value is shifted by 128 to allow +# representing positive and negative values: 128 = 0, 255 = +127, 1 = -127, 0 is no signal +# Only one of these flags can be set at any time. + +uint8 STATUS_QUALITY_VALID = 1 # quality field is valid and represents RSSI in scaled uints, 0 is no signal, 255 is "full" signal uint8 STATUS_FAILSAFE = 2 # receiver has lost contact with transmitter +uint8 STATUS_QUALITY_LQ = 4 # quality field is valid and represents LQ in percent, 0 is no signal, 100 is 100% link quality +uint8 STATUS_QUALITY_RSSI_DBM = 8 # rssi in inverted dBm, 0 is no signal, 1 = -1 dBm, 255 = -255 dBm +uint8 STATUS_QUALITY_SNR = 16 # quality field is valid and represents SNR in device dependent units, shifted by 128 uint16 status # bitmask of status bits, enumerated above with STATUS_* -uint8 quality # scaled, 0 is no signal, 255 is "full" signal +uint8 quality # see descriptions for status bits STATUS_QUALITY_VALID, STATUS_QUALITY_LQ, STATUS_QUALITY_SNR uint4 id # ID of this RC input device -uint12[<=32] rcin # RC channel values between 0 and 4095 +uint12[<=32] rcin # RC channel values between 0 and 4095, 2048 represents the mid position