From 8dc39d1c110fc6ef6fee1893d2ac6d8410cb914d Mon Sep 17 00:00:00 2001 From: Pawel Jalocha Date: Sun, 24 Mar 2019 07:10:19 +0000 Subject: [PATCH] Adjust frequency hopping for plans 2 and 3 --- main/freqplan.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/main/freqplan.h b/main/freqplan.h index 87274aa..1791e55 100644 --- a/main/freqplan.h +++ b/main/freqplan.h @@ -36,6 +36,15 @@ class FreqPlan { if(Channels<=1) return 0; // if single channel (New Zeeland) return channel #0 if(Plan>=2) // if USA/Canada or Australia/South America { uint8_t Channel = FreqHopHash((Time<<1)+Slot) % Channels; // Flarm hopping channel + if(OGN) // OGN Tracker + { if(Slot) // for 2nd slot + { uint8_t Channel2 = FreqHopHash((Time<<1)) % Channels; // use same as Flarm in the 1st slot + if(Channel2==Channel) { Channel++; if(Channel>=Channels) Channel-=2; } // but if same then Flarm in the 2nd slot + else Channel=Channel2; + } + else { Channel++; if(Channel>=Channels) Channel-=2; } // for 1st slot choose a higher channel (unless already highest, then choose a lower one) + } +/* if(OGN) // for OGN tracker { if(Slot) { uint8_t Channel1=FreqHopHash((Time<<1)) % Channels; // for 2nd slot choose a channel close to the 1st slot Channel1++; if(Channel1>=Channels) Channel1-=2; // @@ -44,6 +53,7 @@ class FreqPlan else Channel=Channel2; } else { Channel++; if(Channel>=Channels) Channel-=2; } // for 1st slot choose a higher channel (unless already highest, then choose a lower one) } +*/ return Channel; } // return 0..Channels-1 for USA/CA or Australia. return Slot^OGN; } // if Europe/South Africa: return 0 or 1 for EU freq. plan