Browse Source

Merge pull request #1696 from dogmaphobic/lowpassRSSI

Low pass filter on RC RSSI
QGC4.4
Don Gagne 10 years ago
parent
commit
97d9118c33
  1. 13
      src/ui/toolbar/MainToolBar.cc
  2. 1
      src/ui/toolbar/MainToolBar.h

13
src/ui/toolbar/MainToolBar.cc

@ -52,6 +52,7 @@ MainToolBar::MainToolBar(QWidget* parent)
, _showBattery(true) , _showBattery(true)
, _progressBarValue(0.0f) , _progressBarValue(0.0f)
, _remoteRSSI(0) , _remoteRSSI(0)
, _remoteRSSIstore(100.0)
, _telemetryRRSSI(0) , _telemetryRRSSI(0)
, _telemetryLRSSI(0) , _telemetryLRSSI(0)
, _rollDownMessages(0) , _rollDownMessages(0)
@ -328,10 +329,16 @@ void MainToolBar::_telemetryChanged(LinkInterface*, unsigned, unsigned, unsigned
void MainToolBar::_remoteControlRSSIChanged(uint8_t rssi) 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(_connectionCount == 1) {
if(_remoteRSSI != rssi) { // Low pass to git rid of jitter
_remoteRSSI = rssi; _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); emit remoteRSSIChanged(_remoteRSSI);
} }
} }

1
src/ui/toolbar/MainToolBar.h

@ -134,6 +134,7 @@ private:
bool _showBattery; bool _showBattery;
float _progressBarValue; float _progressBarValue;
int _remoteRSSI; int _remoteRSSI;
double _remoteRSSIstore;
int _telemetryRRSSI; int _telemetryRRSSI;
int _telemetryLRSSI; int _telemetryLRSSI;

Loading…
Cancel
Save