diff --git a/application/libraries/Frequency.php b/application/libraries/Frequency.php index e346d7f4..42e838be 100644 --- a/application/libraries/Frequency.php +++ b/application/libraries/Frequency.php @@ -1,6 +1,11 @@ array( 'SSB'=>"1900000", @@ -50,12 +55,10 @@ class Frequency { 'SSB'=>"144300000", 'DATA'=>"144370000", 'CW'=>"144050000"), - 'FM'=>"144500000"), '70cm'=>array( 'SSB'=>"432200000", 'DATA'=>"432088000", 'CW'=>"432050000"), - 'FM'=>"433500000"), '23cm'=>array( 'SSB'=>"1296000000", 'DATA'=>"1296138000", @@ -76,18 +79,34 @@ class Frequency { 'SSB'=>"1022500000", 'DATA'=>"1022500000", 'CW'=>"1022500000") - ); + ); + /* Class to convert band and mode into a frequnecy in a format based on the specifications of the database table */ public function convent_band($band, $mode='SSB') { - if($mode == "PSK31" || $mode == "PSK63" || $mode == "RTTY" || $mode == "JT65"){ - $mode= "DATA"; - } + // Modes for which we've set a frequency + $known_modes = array('SSB', 'DATA', 'CW'); + + // Data modes that are being treated as 'DATA' for frequency lookup + $data_modes = array('PSK31','PSK63','RTTY', + 'JT65','JT65B','JT6C','JT9-1','JT9','FT8', + 'FSK441','JTMS','ISCAT','MSK144','JTMSK', + 'QRA64','PKT','SSTV','HELL','HELL80'); + + // Use 'DATA' for any of the data modes + if(in_array($mode, $data_modes)){ + $mode= "DATA"; + } - return $this->defaultFrequencies[$band][$mode]; + // If the mode isn't listed, default to SSB frequency + if (!in_array($mode, $known_modes)){ + $mode = 'SSB'; + } -} -public function GetBand($Frequency) { + return $this->defaultFrequencies[$band][$mode]; + } + + public function GetBand($Frequency) { $Band = NULL; if ($Frequency > 1000000 && $Frequency < 2000000) { $Band = "160m"; diff --git a/application/views/qso/index.php b/application/views/qso/index.php index ebf33e0e..b08cbaf4 100644 --- a/application/views/qso/index.php +++ b/application/views/qso/index.php @@ -83,53 +83,37 @@ Mode +load->library('frequency'); + foreach(Frequency::modes as $mode){ + printf("", + $mode, + $this->session->userdata('mode')==$mode?"selected=\"selected\"":"", + $mode); + } +?> + - Band + Band