gc9n / rx5808-Diversity-RealAcc-Compatible

RX5808 Diversity RealAcc Compatible
MIT License
60 stars 10 forks source link

RSSI reading improvement #2

Closed jelle737 closed 8 years ago

jelle737 commented 8 years ago

An atmel can't process an analogread pinchange this fast, adding an extra discard analogRead gives better readings in less readings.

This article goes in depth in ADC reading and delay times for reliable reading: https://www.quora.com/Why-is-a-little-delay-needed-after-analogRead-in-Arduino

You should try this out it's a simple change in your version too:

         analogRead(rssiPinA);
         rssiA += analogRead(rssiPinA);//random(RSSI_MAX_VAL-200, RSSI_MAX_VAL);//
         analogRead(rssiPinB);
         rssiB += analogRead(rssiPinB);//random(RSSI_MAX_VAL-200, RSSI_MAX_VAL);//

You will see before if you screw in one antenna (and vtx turned on on a distance) both receivers will have better rssi, after changing to this only the one antenna will have a better rssi as would make sense. The overall processing time is also lower, originally 50x2 analogRead's can be lowered to 10x4 analogRead's, and having a more reliable rssi reading will lower wrong switchovers on already degraded video when flying in harsh conditions.

gc9n commented 8 years ago

i didnt test it yet.. do you see any better results?

jelle737 commented 8 years ago

Yes I do, that is why I proposed this change.

gc9n commented 8 years ago

Thsnks for keeping it uptodate....