Add power field to CAT interface

pull/1451/head
phl0 2022-04-06 14:50:24 +02:00
rodzic e173d202b9
commit 7ef299c869
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 48EA1E640798CA9A
7 zmienionych plików z 76 dodań i 5 usunięć

Wyświetl plik

@ -21,7 +21,7 @@ $config['migration_enabled'] = TRUE;
| be upgraded / downgraded to.
|
*/
$config['migration_version'] = 87;
$config['migration_version'] = 88;
/*
|--------------------------------------------------------------------------

Wyświetl plik

@ -91,6 +91,8 @@
$uplink_freq = $row->uplink_freq;
$downlink_freq = $row->downlink_freq;
$power = $row->power;
// Check Mode
if(strtoupper($row->uplink_mode) == "FMN"){
$mode = "FM";
@ -119,6 +121,8 @@
$uplink_freq = $row->frequency;
$downlink_freq = "";
$power = $row->power;
// Check Mode
if(strtoupper($row->mode) == "FMN"){
$mode = "FM";
@ -148,6 +152,7 @@
"mode" => $mode,
"satmode" => $sat_mode,
"satname" => $sat_name,
"power" => $power,
"updated_minutes_ago" => $updated_at,
), JSON_PRETTY_PRINT);
}

Wyświetl plik

@ -0,0 +1,28 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Class Migration_add_power_to_cat
*
* Creates an int column in CAT table that holds value of radio output power
*
*/
class Migration_add_power_to_cat extends CI_Migration {
public function up()
{
if (!$this->db->field_exists('powre', 'cat')) {
$fields = array(
'power INT NULL DEFAULT 0',
);
$this->dbforge->add_column('cat', $fields, 'sat_name');
}
}
public function down()
{
$this->dbforge->drop_column('cat', 'power');
}
}

Wyświetl plik

@ -30,6 +30,27 @@
'uplink_mode' => $result['uplink_mode'],
);
$this->db->where('id', $radio_id);
$this->db->where('user_id', $user_id);
$this->db->update('cat', $data);
}
} else if($result['radio'] == "CloudLogCATQt") {
// Update the record
foreach ($query->result() as $row)
{
$radio_id = $row->id;
$data = array(
'sat_name' => $result['sat_name'],
'downlink_freq' => $result['downlink_freq'],
'uplink_freq' => $result['uplink_freq'],
'downlink_mode' => $result['downlink_mode'],
'uplink_mode' => $result['uplink_mode'],
);
if (isset($result['power'])) {
$data['power'] = $result['power'];
}
$this->db->where('id', $radio_id);
$this->db->where('user_id', $user_id);
$this->db->update('cat', $data);
@ -66,6 +87,21 @@
'uplink_mode' => $result['uplink_mode'],
'user_id' => $user_id,
);
} else if($result['radio'] == "CloudLogCATQt") {
$data = array(
'radio' => $result['radio'],
'frequency' => $result['frequency'],
'mode' => $result['mode'],
'sat_name' => $result['sat_name'],
'downlink_freq' => $result['downlink_freq'],
'uplink_freq' => $result['uplink_freq'],
'downlink_mode' => $result['downlink_mode'],
'uplink_mode' => $result['uplink_mode'],
'user_id' => $user_id,
);
if (isset($result['power'])) {
$data['power'] = $result['power'];
}
} else {
$data = array(
'radio' => $result['radio'],

Wyświetl plik

@ -141,7 +141,7 @@ function echoQrbCalcLink($mygrid, $grid, $vucc) {
<tr>
<td><?php echo $row['radio']; ?></td>
<td>
<?php if($row['radio'] == "SatPC32") { ?>
<?php if($row['radio'] == "SatPC32" || $row['radio'] == "CloudLogCATQt") { ?>
<?php echo $row['sat_name']; ?>
<?php } else { ?>
<?php echo $this->frequency->hz_to_mhz($row['frequency']); ?> (<?php echo $row['mode']; ?>)

Wyświetl plik

@ -1072,6 +1072,7 @@ $(document).on('keypress',function(e) {
"mode": "SSB",
"satmode": "",
"satname": "ES'HAIL-2"
"power": "20"
} */
if (data.uplink_freq != "")
{
@ -1097,6 +1098,7 @@ $(document).on('keypress',function(e) {
}
$("#sat_name").val(data.satname);
$("#sat_mode").val(data.satmode);
$("#transmit_power").val(data.power);
// Display CAT Timeout warnng based on the figure given in the config file
var minutes = Math.floor(<?php echo $this->config->item('cat_timeout_interval'); ?> / 60);
@ -1121,9 +1123,9 @@ $(document).on('keypress',function(e) {
// If a radios selected from drop down select radio update.
$('.radios').change(updateFromCAT);
// If radio isn't SatPC32 clear sat_name and sat_mode
// If radio isn't SatPC32 or CloudLogCATQt clear sat_name and sat_mode
$( ".radios" ).change(function() {
if ($(".radios option:selected").text() != "SatPC32") {
if ($(".radios option:selected").text() != "SatPC32" && $(".radios option:selected").text() != "CloudLogCATQt") {
$("#sat_name").val("");
$("#sat_mode").val("");
$("#frequency").val("");

Wyświetl plik

@ -122,7 +122,7 @@ function echoQrbCalcLink($mygrid, $grid, $vucc) {
<tr>
<td><?php echo $row['radio']; ?></td>
<td>
<?php if($row['radio'] == "SatPC32") { ?>
<?php if($row['radio'] == "SatPC32" || $row['radio'] == "CloudLogCATQt") { ?>
<?php echo $row['sat_name']; ?>
<?php } else { ?>
<?php echo $this->frequency->hz_to_mhz($row['frequency']); ?> (<?php echo $row['mode']; ?>)