Add power field to CAT interface

这个提交包含在:
phl0 2022-04-06 14:50:24 +02:00
父节点 e173d202b9
当前提交 7ef299c869
找不到此签名对应的密钥
GPG 密钥 ID: 48EA1E640798CA9A
共有 7 个文件被更改,包括 76 次插入5 次删除

查看文件

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

查看文件

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

查看文件

@ -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');
}
}

查看文件

@ -30,6 +30,27 @@
'uplink_mode' => $result['uplink_mode'], '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('id', $radio_id);
$this->db->where('user_id', $user_id); $this->db->where('user_id', $user_id);
$this->db->update('cat', $data); $this->db->update('cat', $data);
@ -66,6 +87,21 @@
'uplink_mode' => $result['uplink_mode'], 'uplink_mode' => $result['uplink_mode'],
'user_id' => $user_id, '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 { } else {
$data = array( $data = array(
'radio' => $result['radio'], 'radio' => $result['radio'],

查看文件

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

查看文件

@ -1072,6 +1072,7 @@ $(document).on('keypress',function(e) {
"mode": "SSB", "mode": "SSB",
"satmode": "", "satmode": "",
"satname": "ES'HAIL-2" "satname": "ES'HAIL-2"
"power": "20"
} */ } */
if (data.uplink_freq != "") if (data.uplink_freq != "")
{ {
@ -1097,6 +1098,7 @@ $(document).on('keypress',function(e) {
} }
$("#sat_name").val(data.satname); $("#sat_name").val(data.satname);
$("#sat_mode").val(data.satmode); $("#sat_mode").val(data.satmode);
$("#transmit_power").val(data.power);
// Display CAT Timeout warnng based on the figure given in the config file // 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); 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. // If a radios selected from drop down select radio update.
$('.radios').change(updateFromCAT); $('.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() { $( ".radios" ).change(function() {
if ($(".radios option:selected").text() != "SatPC32") { if ($(".radios option:selected").text() != "SatPC32" && $(".radios option:selected").text() != "CloudLogCATQt") {
$("#sat_name").val(""); $("#sat_name").val("");
$("#sat_mode").val(""); $("#sat_mode").val("");
$("#frequency").val(""); $("#frequency").val("");

查看文件

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