Commit 97d9118c authored by Don Gagne's avatar Don Gagne

Merge pull request #1696 from dogmaphobic/lowpassRSSI

Low pass filter on RC RSSI
parents 3c8f0abb b0e764ad
......@@ -52,6 +52,7 @@ MainToolBar::MainToolBar(QWidget* parent)
, _showBattery(true)
, _progressBarValue(0.0f)
, _remoteRSSI(0)
, _remoteRSSIstore(100.0)
, _telemetryRRSSI(0)
, _telemetryLRSSI(0)
, _rollDownMessages(0)
......@@ -328,10 +329,16 @@ void MainToolBar::_telemetryChanged(LinkInterface*, unsigned, unsigned, unsigned
void MainToolBar::_remoteControlRSSIChanged(uint8_t rssi)
{
// We only care if we haveone single connection
// We only care if we have one single connection
if(_connectionCount == 1) {
if(_remoteRSSI != rssi) {
_remoteRSSI = rssi;
// Low pass to git rid of jitter
_remoteRSSIstore = (_remoteRSSIstore * 0.9f) + ((float)rssi * 0.1);
uint8_t filteredRSSI = (uint8_t)ceil(_remoteRSSIstore);
if(_remoteRSSIstore < 0.1) {
filteredRSSI = 0;
}
if(_remoteRSSI != filteredRSSI) {
_remoteRSSI = filteredRSSI;
emit remoteRSSIChanged(_remoteRSSI);
}
}
......
......@@ -134,6 +134,7 @@ private:
bool _showBattery;
float _progressBarValue;
int _remoteRSSI;
double _remoteRSSIstore;
int _telemetryRRSSI;
int _telemetryLRSSI;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment