Skip to content

Commit

Permalink
Merge pull request #2684 from int2001/singlecat
Browse files Browse the repository at this point in the history
Enable QRG-Only-Update (should fix #2611)
  • Loading branch information
magicbug authored Nov 13, 2023
2 parents 4b66a4a + cce52c1 commit 0325d5c
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 16 deletions.
29 changes: 16 additions & 13 deletions application/controllers/Radio.php
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down Expand Up @@ -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);
}
}
}
Expand Down
6 changes: 5 additions & 1 deletion application/models/Cat.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand Down
8 changes: 6 additions & 2 deletions application/views/interface_assets/footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0325d5c

Please sign in to comment.