Skip to content

Commit

Permalink
simplified
Browse files Browse the repository at this point in the history
  • Loading branch information
StonedDawg committed Jan 16, 2021
1 parent 4e20dc8 commit 8976e11
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/src/rx_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,19 +321,15 @@ void ICACHE_RAM_ATTR HWtimerCallbackTock()
int32_t rssi = (antenna == 0) ? LPF_UplinkRSSI0.SmoothDataINT : LPF_UplinkRSSI1.SmoothDataINT;

// if rssi drop 5 from strongest rssi
if ((rssi < (prevRSSI - 5) ) && antennaSwitched2 >= 30){
if ((rssi < (prevRSSI - 5) ) && antennaSwitched2 >= DIVERSITY_ANTENNA_INTERVAL){
otherRSSI = rssi;
switchAntenna();
antennaSwitched = 1;
antennaSwitched2 = 0;
} else if(antennaSwitched2 < 30){
prevRSSI = rssi;
antennaSwitched2++;
} else { //overwrite prev rssi with stronger rssi val
if(rssi > prevRSSI){
} else if(rssi > prevRSSI || antennaSwitched2 < DIVERSITY_ANTENNA_INTERVAL){
prevRSSI = rssi;
antennaSwitched2++;
}
}
//if there is a packet drop
if (((!LQCALC.packetReceivedForPreviousFrame()) && antennaSwitched == 0)) {
otherRSSI = rssi;
Expand Down

0 comments on commit 8976e11

Please sign in to comment.