diff --git a/application/controllers/Qso.php b/application/controllers/Qso.php index d4cf3a345..548094313 100644 --- a/application/controllers/Qso.php +++ b/application/controllers/Qso.php @@ -13,6 +13,7 @@ class QSO extends CI_Controller { public function index() { $this->load->model('cat'); + $this->load->library('qra'); $this->load->model('stations'); $this->load->model('logbook_model'); $this->load->model('user_model'); @@ -41,6 +42,7 @@ class QSO extends CI_Controller { $data['iota'] = $this->logbook_model->fetchIota(); $data['modes'] = $this->modes->active(); $data['bands'] = $this->bands->get_user_bands_for_qso_entry(); + [$data['lat'], $data['lng']] = $this->qra->qra2latlong($this->stations->gridsquare_from_station($this->stations->find_active())); $data['user_default_band'] = $this->session->userdata('user_default_band'); $data['sat_active'] = array_search("SAT", $this->bands->get_user_bands(), true); @@ -607,8 +609,10 @@ class QSO extends CI_Controller { public function get_station_power() { $this->load->model('stations'); + $this->load->library('qra'); $stationProfile = $this->input->post('stationProfile', TRUE); $data = array('station_power' => $this->stations->get_station_power($stationProfile)); + [$data['lat'], $data['lng']] = $this->qra->qra2latlong($this->stations->gridsquare_from_station($stationProfile)); header('Content-Type: application/json'); echo json_encode($data); diff --git a/application/views/qso/index.php b/application/views/qso/index.php index ce2700421..1bab76550 100644 --- a/application/views/qso/index.php +++ b/application/views/qso/index.php @@ -8,6 +8,7 @@ var lang_dxccsummary_for = ""; var lang_lotw_upload_day_ago = ""; var lang_lotw_upload_days_ago = ""; // due to the way the string is built (PHP to JS), %x is replaced with the number of days + var latlng=[];
diff --git a/application/views/qso/log_qso.php b/application/views/qso/log_qso.php index 43779f727..90387e0c1 100644 --- a/application/views/qso/log_qso.php +++ b/application/views/qso/log_qso.php @@ -75,4 +75,4 @@ $('#redirect_message').html(''); window.close(); } - \ No newline at end of file + diff --git a/assets/js/sections/qso.js b/assets/js/sections/qso.js index 16e5b9458..3e1d08ba2 100644 --- a/assets/js/sections/qso.js +++ b/assets/js/sections/qso.js @@ -39,6 +39,7 @@ $('#stationProfile').on('change', function () { data: { 'stationProfile': stationProfile }, success: function (res) { $('#transmit_power').val(res.station_power); + latlng=[res.lat,res.lng]; }, error: function () { $('#transmit_power').val(''); @@ -354,8 +355,8 @@ function start_az_ele_ticker(tle) { // Define the observer's location in radians var observerGd = { - longitude: satellite.degreesToRadians(0), - latitude: satellite.degreesToRadians(0), + longitude: satellite.degreesToRadians(latlng[0]), + latitude: satellite.degreesToRadians(latlng[1]), height: 0.370 };