Skip to content

Commit

Permalink
Update frequency plan
Browse files Browse the repository at this point in the history
  • Loading branch information
nbonniere committed Apr 27, 2021
1 parent 6f68358 commit ff2e86b
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 22 deletions.
42 changes: 25 additions & 17 deletions libraries/OGN/freqplan.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@
enum
{
RF_BAND_AUTO = 0,
RF_BAND_EU = 1, /* 868.4 MHz band */
RF_BAND_US = 2, /* 915 MHz band */
RF_BAND_AU = 3, /* 921 MHz band */
RF_BAND_NZ = 4, /* 869.250 MHz band */
RF_BAND_RU = 5, /* 868.8 MHz band */
RF_BAND_CN = 6, /* 470 MHz band */
RF_BAND_UK = 7, /* 869.52 MHz band */
RF_BAND_IN = 8 /* 866.0 MHz band */
RF_BAND_EU = 1, /* 868.2 MHz band */
RF_BAND_US = 2, /* 915 MHz band */
RF_BAND_AU = 3, /* 921 MHz band */
RF_BAND_NZ = 4, /* 869.250 MHz band */
RF_BAND_RU = 5, /* 868.8 MHz band */
RF_BAND_CN = 6, /* 470 MHz band */
RF_BAND_UK = 7, /* 869.52 MHz band */
RF_BAND_IN = 8, /* 866.0 MHz band */
RF_BAND_IL = 9, /* 916.2 MHz band */
RF_BAND_KR = 10 /* 920.9 MHz band */
};

class FreqPlan
Expand Down Expand Up @@ -58,6 +60,12 @@ class FreqPlan
case RF_BAND_IN:
{ BaseFreq=866000000; ChanSepar=200000; Channels= 1; MaxTxPower = 30; } // India
break;
case RF_BAND_IL:
{ BaseFreq=916200000; ChanSepar=200000; Channels= 1; MaxTxPower = 30; } // Israel
break;
case RF_BAND_KR:
{ BaseFreq=920900000; ChanSepar=200000; Channels= 1; MaxTxPower = 23; } // South Korea
break;
case RF_BAND_EU:
default:
{ BaseFreq=868200000; ChanSepar=200000; Channels= 2; MaxTxPower = 14; } // Europe
Expand All @@ -71,23 +79,23 @@ class FreqPlan
const char *getPlanName(void) { return getPlanName(Plan); }

static const char *getPlanName(uint8_t Plan)
{ static const char *Name[9] = { "Default", "Europe/Africa",
{ static const char *Name[11] = { "Default", "Europe/Africa",
"USA/Canada", "Australia/South America", "New Zealand",
"Russia", "China", "PilotAware (UK)", "India" } ;
if(Plan>RF_BAND_IN) return 0;
"Russia", "China", "PilotAware (UK)", "India", "Israel", "South Korea" } ;
if(Plan>RF_BAND_KR) return 0;
return Name[Plan]; }

uint8_t getChannel (uint32_t Time, uint8_t Slot=0, uint8_t OGN=1) const // OGN-tracker or legacy, UTC time, slot: 0 or 1
{ if(Channels<=1) return 0; // if single channel (New Zealand) return channel #0
if(Plan>=2) // if USA/Canada or Australia/South America
{ uint8_t Channel = FreqHopHash((Time<<1)+Slot) % Channels; // legacy hopping channel
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; //
uint8_t Channel2=Channel1+1; if(Channel2>=Channels) Channel2-=2;
if(Channel2==Channel) Channel=Channel1; // avoid being on same chanel as legacy
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(Slot)
{ uint8_t Channel2 = FreqHopHash((Time<<1)) % Channels; // use same as legacy in the 1st slot
if(Channel2==Channel) { Channel++; if(Channel>=Channels) Channel-=2; } // but if same then legacy 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)
}
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
Expand Down
2 changes: 2 additions & 0 deletions ognbase/Web.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@ void Web_setup(ufo_t* this_aircraft)
(ogn_band == RF_BAND_UK ? "selected" : ""), RF_BAND_UK,
(ogn_band == RF_BAND_AU ? "selected" : ""), RF_BAND_AU,
(ogn_band == RF_BAND_IN ? "selected" : ""), RF_BAND_IN,
(ogn_band == RF_BAND_IL ? "selected" : ""), RF_BAND_IL,
(ogn_band == RF_BAND_KR ? "selected" : ""), RF_BAND_KR,
(ogn_protocol_1 == RF_PROTOCOL_LEGACY ? "selected" : ""),
RF_PROTOCOL_LEGACY, legacy_proto_desc.name,
(ogn_protocol_1 == RF_PROTOCOL_OGNTP ? "selected" : ""),
Expand Down
12 changes: 7 additions & 5 deletions ognbase/data/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ <h3>Version %s</h3>
<p id = "largest_range">connecting</p>
</div>
<div class="circle__lower-text">
Largest RX
Longest Range
</div>
</div>
</td>
Expand All @@ -96,7 +96,7 @@ <h3>Version %s</h3>
<tr>
<td>OGN Callsign</td>
<td><input id=callsign type="text" name="callsign" value="%s" size="8"></td>
<td>Lat:</td>
<td>Lat</td>
<td><input id=lat type="number" name="ogn_lat" step="0.000001" value="%s" size="8"></td>
</tr>
<tr>
Expand All @@ -106,7 +106,7 @@ <h3>Version %s</h3>
<td><input id=alt type="number" name="ogn_alt" value="%s" size="8"></td>
</tr>
<tr>
<td>GeoID</td>
<td>Geoid [m]</td>
<td><input id=geoid type="number" name="ogn_geoid" value="%s" size="8"></td>
<td>Range [km]</td>
<td><input id=range type="number" name="ogn_range" value="%s" size="8"></td>
Expand All @@ -123,6 +123,8 @@ <h3>Version %s</h3>
<option %s value='%d'>UK (869.52 MHz)</option>
<option %s value='%d'>AU (921 MHz)</option>
<option %s value='%d'>IN (866 MHz)</option>
<option %s value='%d'>IL (916.2 MHz)</option>
<option %s value='%d'>KR (920.9 MHz)</option>
</select>
</td>
</tr>
Expand Down Expand Up @@ -194,10 +196,10 @@ <h3>Version %s</h3>
</td>
</tr>
<tr>
<td>RESET:</td>
<td>RESET</td>
<td><INPUT type="checkbox" name="ogn_reset_all"></td>
</tr>
<td><p><button class="button_save">SAVE</button></a></p></td>
<td><p><button class="button_save">Save</button></a></p></td>
<td><a href="reboot" class="button_reboot" >Reboot</a></td>
<td><a href="upload" class="upload" >Upload Files</a></td>
<td><a href="update" class="update" >Update Firmware</a></td>
Expand Down

0 comments on commit ff2e86b

Please sign in to comment.