From cce52c126c3f48f0821d39aaae477a0e41b848eb Mon Sep 17 00:00:00 2001 From: int2001 Date: Mon, 13 Nov 2023 09:18:56 +0000 Subject: [PATCH] Enable QRG-Only-Update (should fix #2611) --- application/controllers/Radio.php | 29 ++++++++++--------- application/models/Cat.php | 6 +++- application/views/interface_assets/footer.php | 8 +++-- 3 files changed, 27 insertions(+), 16 deletions(-) diff --git a/application/controllers/Radio.php b/application/controllers/Radio.php index b9ead5983..04df37c69 100755 --- a/application/controllers/Radio.php +++ b/application/controllers/Radio.php @@ -113,9 +113,13 @@ function json($id) { $prop_mode = $row->prop_mode; // Check Mode - $mode = strtoupper($row->mode); - if ($mode == "FMN") { - $mode = "FM"; + if (isset($row->mode) && ($row->mode != null)) { + $mode = strtoupper($row->mode); + if ($mode == "FMN") { + $mode = "FM"; + } + } else { + $mode=null; } if ($row->prop_mode == "SAT") { @@ -156,16 +160,15 @@ function json($id) { $updated_at = $minutes; // Return Json data - echo json_encode(array( - "frequency" => $frequency, - "frequency_rx" => $frequency_rx, - "mode" => $mode, - "satmode" => $sat_mode, - "satname" => $sat_name, - "power" => $power, - "prop_mode" => $prop_mode, - "updated_minutes_ago" => $updated_at, - ), JSON_PRETTY_PRINT); + $a_ret['frequency']=$frequency; + if (isset($frequency_rx) && ($frequency_rx != null)) { $a_ret['frequency_rx']=$frequency_rx; } + if (isset($mode) && ($mode != null)) { $a_ret['mode']=$mode; } + if (isset($sat_mode) && ($sat_mode != null)) { $a_ret['satmode']=$sat_mode; } + if (isset($sat_name) && ($sat_name != null)) { $a_ret['satname']=$sat_name; } + if (isset($power) && ($power != null)) { $a_ret['power']=$power; } + if (isset($prop_mode) && ($prop_mode != null)) { $a_ret['prop_mode']=$prop_mode; } + $a_ret['update_minutes_ago']=$updated_at; + echo json_encode($a_ret, JSON_PRETTY_PRINT); } } } diff --git a/application/models/Cat.php b/application/models/Cat.php index ba4671f7e..f7a5b7db5 100644 --- a/application/models/Cat.php +++ b/application/models/Cat.php @@ -34,7 +34,11 @@ function update($result, $user_id) { if (isset($result['mode']) && $result['mode'] != "NULL") { $data['mode'] = $result['mode']; } else { - $data['mode'] = $result['uplink_mode']; + if (isset($result['uplink_mode']) && $result['uplink_mode'] != "NULL") { + $data['mode'] = $result['uplink_mode']; + } else { + $data['mode'] = NULL; + } } if (isset($result['frequency_rx'])) { $data['frequency_rx'] = $result['frequency_rx']; diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index acd8656bf..057fa5494 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -1406,8 +1406,12 @@ function getUTCDateStamp(el) { $("#band_rx").val(frequencyToBand(data.frequency_rx)); } - old_mode = $(".mode").val(); - $(".mode").val(data.mode); + if ((data.mode != "") && (data.mode != null)) { + old_mode = $(".mode").val(); + $(".mode").val(data.mode); + } else { + old_mode = $(".mode").val(); + } if (old_mode !== $(".mode").val()) { // Update RST on mode change via CAT