From 45f2896a49b5ba737e444419fe2095f2459ac2b1 Mon Sep 17 00:00:00 2001 From: Andy Date: Fri, 14 Dec 2018 19:32:05 +0000 Subject: [PATCH] Fixed adding non 'SSB','DATA','CW' qso --- application/libraries/Frequency.php | 33 ++++++++++++++++++++++---- application/views/qso/index.php | 36 ++++++++--------------------- 2 files changed, 38 insertions(+), 31 deletions(-) diff --git a/application/libraries/Frequency.php b/application/libraries/Frequency.php index 2bd4b5e7..d19a8c64 100644 --- a/application/libraries/Frequency.php +++ b/application/libraries/Frequency.php @@ -1,6 +1,12 @@ array( 'SSB'=>"1900000", @@ -75,17 +81,34 @@ class Frequency { '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 e25f48f4..abee9921 100644 --- a/application/views/qso/index.php +++ b/application/views/qso/index.php @@ -69,31 +69,15 @@ Mode Band @@ -492,4 +476,4 @@ } - \ No newline at end of file +