diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/drivers/drv_rc_input.h | 2 | ||||
-rw-r--r-- | src/modules/px4iofirmware/controls.c | 9 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/drivers/drv_rc_input.h b/src/drivers/drv_rc_input.h index d44728a71..a24d8814f 100644 --- a/src/drivers/drv_rc_input.h +++ b/src/drivers/drv_rc_input.h @@ -65,7 +65,7 @@ /** * Maximum RSSI value */ -#define RC_INPUT_RSSI_MAX 255 +#define RC_INPUT_RSSI_MAX 100 /** * @addtogroup topics diff --git a/src/modules/px4iofirmware/controls.c b/src/modules/px4iofirmware/controls.c index c9702c2ec..ac004f212 100644 --- a/src/modules/px4iofirmware/controls.c +++ b/src/modules/px4iofirmware/controls.c @@ -191,7 +191,10 @@ controls_tick() { unsigned mV = counts * 3300 / 4096; /* scale to 0..253 and lowpass */ - rssi = (rssi * 0.99f) + ((mV / 13) * 0.01f); + rssi = (rssi * 0.99f) + ((mV / (3300 / RC_INPUT_RSSI_MAX)) * 0.01f); + if (rssi > RC_INPUT_RSSI_MAX) { + rssi = RC_INPUT_RSSI_MAX; + } } } #endif @@ -223,11 +226,11 @@ controls_tick() { if (sbus_updated) { r_status_flags |= PX4IO_P_STATUS_FLAGS_RC_SBUS; - unsigned sbus_rssi = 254; + unsigned sbus_rssi = RC_INPUT_RSSI_MAX; if (sbus_frame_drop) { r_raw_rc_flags |= PX4IO_P_RAW_RC_FLAGS_FRAME_DROP; - sbus_rssi = 100; + sbus_rssi = RC_INPUT_RSSI_MAX / 2; } else { r_raw_rc_flags &= ~(PX4IO_P_RAW_RC_FLAGS_FRAME_DROP); } |