kopia lustrzana https://github.com/PianetaRadio/CatRadio
Porównaj commity
50 Commity
Autor | SHA1 | Data |
---|---|---|
PianetaRadio | 8fb790c1eb | |
PianetaRadio | 8fa52c8273 | |
PianetaRadio | f51d68fc0e | |
PianetaRadio | 29682cbad5 | |
PianetaRadio | 882558b523 | |
PianetaRadio | 0fdc71f98d | |
PianetaRadio | 146207cd98 | |
PianetaRadio | 17a3cf614e | |
PianetaRadio | 46cad6b5bc | |
PianetaRadio | 1415cad921 | |
PianetaRadio | ceccbe2b92 | |
PianetaRadio | a258c1fe13 | |
PianetaRadio | df7e3bdcec | |
PianetaRadio | b8bead15f3 | |
PianetaRadio | 69d3995653 | |
PianetaRadio | f4ea500269 | |
PianetaRadio | 778761a1a8 | |
PianetaRadio | 0ae620b732 | |
PianetaRadio | 7909e2a0de | |
PianetaRadio | 2043bb7b2a | |
PianetaRadio | 0e932dd3c5 | |
PianetaRadio | 8781583cd9 | |
PianetaRadio | 7c4fad92a5 | |
PianetaRadio | ef30ab50eb | |
PianetaRadio | 97f2b54ab8 | |
PianetaRadio | a2fda861ce | |
PianetaRadio | c17bb04fd7 | |
PianetaRadio | c2ea381757 | |
PianetaRadio | e91f5aae09 | |
PianetaRadio | 6d2356a04d | |
PianetaRadio | d9a15a9826 | |
PianetaRadio | 18994840a5 | |
PianetaRadio | b8ce26670e | |
PianetaRadio | 068922c6b6 | |
PianetaRadio | 2c3b14e2d0 | |
PianetaRadio | 7fe09861b4 | |
PianetaRadio | c22d15ea35 | |
PianetaRadio | 8ee38b8b3a | |
PianetaRadio | 0689460b40 | |
PianetaRadio | 94a79d7ff1 | |
PianetaRadio | e9a5613888 | |
PianetaRadio | a055937a57 | |
PianetaRadio | 8c4d24c5e2 | |
PianetaRadio | d8c9bf1594 | |
PianetaRadio | 1cbbc555af | |
PianetaRadio | 0e19ee12cd | |
PianetaRadio | d2db142e34 | |
PianetaRadio | 4de9e1647b | |
PianetaRadio | dfa37bedec | |
PianetaRadio | 724a3dc356 |
|
@ -0,0 +1,9 @@
|
|||
[Desktop Entry]
|
||||
Name=CatRadio
|
||||
Comment=Radio Control Software
|
||||
Icon=/home/pi/CatRadio/catradio.png
|
||||
Exec=/home/pi/CatRadio/CatRadio
|
||||
Type=Application
|
||||
Terminal=false
|
||||
Encoding=UTF-8
|
||||
Categories=HamRadio;
|
|
@ -53,10 +53,11 @@ else: unix:!android: target.path = /opt/$${TARGET}/bin
|
|||
LIBS += -L$$PWD/hamlib/ -lhamlib
|
||||
INCLUDEPATH += $$PWD/hamlib
|
||||
|
||||
# RESOURCES += theme/breeze.qrc
|
||||
RESOURCES += qdarkstyle/dark/darkstyle.qrc
|
||||
# RESOURCES += qdarkstyle/light/lightstyle.qrc
|
||||
|
||||
VERSION = 1.3.0
|
||||
VERSION = 1.4.1
|
||||
|
||||
RC_ICONS = catradio.ico
|
||||
|
||||
|
|
|
@ -2,6 +2,24 @@ CatRadio
|
|||
|
||||
(+ New, * Updated, - Removed)
|
||||
|
||||
1.4.1 - 2024-xx-xx
|
||||
+ CW memory keyer
|
||||
+ Check hamlib version on startup
|
||||
* Bug fix: IF shift
|
||||
|
||||
1.4.0 - 2024-03-17
|
||||
+ Auto Connect option
|
||||
+ Auto Power-on option
|
||||
+ High SWR indicator
|
||||
+ Meter peak hold indicator
|
||||
+ Debug mode
|
||||
* Updated serial port configuration
|
||||
* Bug fix: NR level
|
||||
* Bug fix: Repeater shift
|
||||
* Bug fix: Power status
|
||||
* Bug fix: COM port list
|
||||
* Updated to library Hamlib 4.6 beta
|
||||
|
||||
1.3.0 - 2022-11-24
|
||||
+ Radio info
|
||||
+ Dark theme
|
||||
|
|
|
@ -22,6 +22,11 @@
|
|||
|
||||
#include "rig.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
DialogCommand::DialogCommand(RIG *rig, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
|
@ -29,6 +34,10 @@ DialogCommand::DialogCommand(RIG *rig, QWidget *parent) :
|
|||
{
|
||||
ui->setupUi(this);
|
||||
my_rig = rig;
|
||||
int backend = RIG_BACKEND_NUM(my_rig->caps->rig_model);
|
||||
|
||||
if (backend == RIG_YAESU || backend == RIG_KENWOOD) ui->radioButton_yaesu->setChecked(true);
|
||||
else if (backend == RIG_ICOM) ui->radioButton_icom->setChecked(true);
|
||||
}
|
||||
|
||||
DialogCommand::~DialogCommand()
|
||||
|
@ -38,25 +47,45 @@ DialogCommand::~DialogCommand()
|
|||
|
||||
void DialogCommand::on_pushButton_send_clicked()
|
||||
{
|
||||
|
||||
bool hex = false; //Flag for Hex command
|
||||
|
||||
QString sendCmdS = ui->lineEdit_commandSend->text();
|
||||
const unsigned char *sendCmd = (unsigned char*)sendCmdS.toLatin1().data();
|
||||
int sendCmdLen = sendCmdS.size();
|
||||
unsigned char termCmd[] = ";";
|
||||
QByteArray sendCmdA;
|
||||
if (sendCmdS.isEmpty()) return;
|
||||
if (sendCmdS.contains("0x", Qt::CaseInsensitive)) //Hex input
|
||||
{
|
||||
sendCmdS = sendCmdS.mid(2);
|
||||
sendCmdA = QByteArray::fromHex(sendCmdS.toLatin1());
|
||||
hex = true;
|
||||
}
|
||||
else sendCmdA = sendCmdS.toUtf8(); //Char input
|
||||
|
||||
unsigned char rcvdCmd[100];
|
||||
QByteArray termCmdA;
|
||||
termCmdA.resize(1);
|
||||
if (ui->radioButton_yaesu->isChecked()) termCmdA[0] = ';';
|
||||
else if (ui->radioButton_icom->isChecked()) termCmdA[0] = 0xfd;
|
||||
else if (ui->radioButton_CR->isChecked()) termCmdA[0] = 0x0d;
|
||||
else if (ui->radioButton_LF->isChecked()) termCmdA[0] = 0x0a;
|
||||
else termCmdA[0] = '\0';
|
||||
unsigned char *termCmd = (unsigned char*)termCmdA.data();
|
||||
|
||||
sendCmdA.append(termCmdA);
|
||||
unsigned char *sendCmd = (unsigned char*)sendCmdA.data();
|
||||
int sendCmdLen = strlen((char*)sendCmd);
|
||||
|
||||
unsigned char rcvdCmd[200];
|
||||
int rcvdCmdLen = sizeof(rcvdCmd);
|
||||
|
||||
//qDebug()<<sendCmdS<<(char*)termCmd<<(char*)sendCmd<<sendCmdLen;
|
||||
|
||||
rig_send_raw(my_rig, sendCmd, sendCmdLen, rcvdCmd, rcvdCmdLen, termCmd);
|
||||
|
||||
//QString rcvdCmdS = rcvdCmd;
|
||||
|
||||
//qDebug()<<(char *)rcvdCmd;
|
||||
int retLen = rig_send_raw(my_rig, sendCmd, sendCmdLen, rcvdCmd, rcvdCmdLen, termCmd);
|
||||
|
||||
if (retLen > 0)
|
||||
{
|
||||
QString rcvdCmdS;
|
||||
QByteArray rcvdCmdA(QByteArray::fromRawData((char *)rcvdCmd, retLen));
|
||||
if (hex) rcvdCmdS = rcvdCmdA.toHex();
|
||||
else rcvdCmdS = rcvdCmdA;
|
||||
ui->lineEdit_receive->setText(rcvdCmdS);
|
||||
}
|
||||
|
||||
//int rig_send_raw(rig, const unsigned char *send, int send_len, unsigned char *reply, int reply_len, unsigned char *term);
|
||||
//send contains the raw command data
|
||||
|
|
|
@ -13,49 +13,79 @@
|
|||
<property name="windowTitle">
|
||||
<string>Command</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<layout class="QGridLayout" name="gridLayout" columnstretch="0,0,0,0">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_commandSend">
|
||||
<property name="text">
|
||||
<string>Command Send</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>lineEdit_commandSend</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_commandSend"/>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_received">
|
||||
<property name="text">
|
||||
<string>Received</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>lineEdit_receive</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<item row="0" column="3">
|
||||
<widget class="QPushButton" name="pushButton_send">
|
||||
<property name="text">
|
||||
<string>Send</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_receive">
|
||||
<item row="1" column="3">
|
||||
<widget class="QRadioButton" name="radioButton_LF">
|
||||
<property name="text">
|
||||
<string>Receive</string>
|
||||
<string>LF</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<item row="0" column="1" colspan="2">
|
||||
<widget class="QLineEdit" name="lineEdit_commandSend"/>
|
||||
</item>
|
||||
<item row="3" column="3">
|
||||
<widget class="QPushButton" name="pushButton_close">
|
||||
<property name="text">
|
||||
<string>Close</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QRadioButton" name="radioButton_CR">
|
||||
<property name="text">
|
||||
<string>CR</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="3">
|
||||
<widget class="QLineEdit" name="lineEdit_receive">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QCheckBox" name="checkBox_icom">
|
||||
<item row="1" column="1">
|
||||
<widget class="QRadioButton" name="radioButton_icom">
|
||||
<property name="text">
|
||||
<string>Icom</string>
|
||||
<string>Icom 0xfd</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QPushButton" name="pushButton_close">
|
||||
<item row="1" column="0">
|
||||
<widget class="QRadioButton" name="radioButton_yaesu">
|
||||
<property name="text">
|
||||
<string>Close</string>
|
||||
<string>Yaesu/Kwd ;</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
140
dialogconfig.cpp
140
dialogconfig.cpp
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
** This file is part of the CatRadio project.
|
||||
** Copyright 2022 Gianfranco Sordetti IZ8EWD <iz8ewd@pianetaradio.it>.
|
||||
** Copyright 2022-2024 Gianfranco Sordetti IZ8EWD <iz8ewd@pianetaradio.it>.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
@ -105,9 +105,12 @@ DialogConfig::DialogConfig(QWidget *parent) :
|
|||
ui->comboBox_comPort->setCurrentText(rigCom.rigPort);
|
||||
ui->comboBox_serialSpeed->setCurrentText(QString::number(rigCom.serialSpeed));
|
||||
if (rigCom.civAddr) ui->lineEdit_civAddr->setText(QString::number(rigCom.civAddr,16));
|
||||
setDialogSerialConfig(rigCom.serialDataBits, rigCom.serialParity, rigCom.serialStopBits, rigCom.serialHandshake);
|
||||
}
|
||||
ui->spinBox_RefreshRate->setValue(rigCom.rigRefresh);
|
||||
ui->checkBox_fullPoll->setChecked(rigCom.fullPoll);
|
||||
ui->checkBox_autoConnect->setChecked(rigCom.autoConnect);
|
||||
ui->checkBox_autoPowerOn->setChecked(rigCom.autoPowerOn);
|
||||
}
|
||||
|
||||
DialogConfig::~DialogConfig()
|
||||
|
@ -115,6 +118,63 @@ DialogConfig::~DialogConfig()
|
|||
delete ui;
|
||||
}
|
||||
|
||||
|
||||
int DialogConfig::findRigModel(QString rigModel)
|
||||
{
|
||||
QRegularExpression regexp("[0-9]+");
|
||||
QRegularExpressionMatch rigNumber = regexp.match(rigModel);
|
||||
return rigNumber.captured(0).toInt();
|
||||
}
|
||||
|
||||
|
||||
void DialogConfig::setDialogSerialConfig(int dataBits, int parity, int stopBits, int handshake)
|
||||
{
|
||||
switch (dataBits)
|
||||
{
|
||||
case 7: ui->radioButton_dataBits7->setChecked(true); break;
|
||||
case 8: ui->radioButton_dataBits8->setChecked(true); break;
|
||||
}
|
||||
|
||||
switch (parity)
|
||||
{
|
||||
case 0: ui->radioButton_parityNone->setChecked(true); break;
|
||||
case 1: ui->radioButton_parityOdd->setChecked(true); break;
|
||||
case 2: ui->radioButton_parityEven->setChecked(true); break;
|
||||
}
|
||||
|
||||
switch (stopBits)
|
||||
{
|
||||
case 1: ui->radioButton_stopBits1->setChecked(true); break;
|
||||
case 2: ui->radioButton_stopBits2->setChecked(true); break;
|
||||
}
|
||||
|
||||
switch (handshake)
|
||||
{
|
||||
case 0: ui->radioButton_handshakeNone->setChecked(true); break;
|
||||
case 1: ui->radioButton_handshakeXonXoff->setChecked(true); break;
|
||||
case 2: ui->radioButton_handshakeHardware->setChecked(true); break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DialogConfig::setRigSerialConfigFromDialog()
|
||||
{
|
||||
if (ui->radioButton_dataBits7->isChecked()) rigCom.serialDataBits = 7;
|
||||
else rigCom.serialDataBits = 8;
|
||||
|
||||
if (ui->radioButton_parityOdd->isChecked()) rigCom.serialParity = RIG_PARITY_ODD;
|
||||
else if (ui->radioButton_parityEven->isChecked()) rigCom.serialParity = RIG_PARITY_EVEN;
|
||||
else rigCom.serialParity = RIG_PARITY_NONE;
|
||||
|
||||
if (ui->radioButton_stopBits1->isChecked()) rigCom.serialStopBits = 1;
|
||||
else rigCom.serialStopBits = 2;
|
||||
|
||||
if (ui->radioButton_handshakeXonXoff->isChecked()) rigCom.serialHandshake = RIG_HANDSHAKE_XONXOFF;
|
||||
else if (ui->radioButton_handshakeHardware->isChecked()) rigCom.serialHandshake = RIG_HANDSHAKE_HARDWARE;
|
||||
else rigCom.serialHandshake = RIG_HANDSHAKE_NONE;
|
||||
}
|
||||
|
||||
|
||||
void DialogConfig::on_buttonBox_accepted()
|
||||
{
|
||||
bool civAddrConv;
|
||||
|
@ -132,9 +192,10 @@ void DialogConfig::on_buttonBox_accepted()
|
|||
else
|
||||
{
|
||||
QString rigModel = ui->comboBox_rigModel->currentText();
|
||||
QRegularExpression regexp("[0-9]+");
|
||||
QRegularExpressionMatch rigNumber = regexp.match(rigModel);
|
||||
rigCom.rigModel = rigNumber.captured(0).toInt();
|
||||
//QRegularExpression regexp("[0-9]+");
|
||||
//QRegularExpressionMatch rigNumber = regexp.match(rigModel);
|
||||
//rigCom.rigModel = rigNumber.captured(0).toInt();
|
||||
rigCom.rigModel = findRigModel(rigModel);
|
||||
|
||||
if (ui->checkBox_netRigctl->isChecked()) //TCP port
|
||||
{
|
||||
|
@ -155,8 +216,9 @@ void DialogConfig::on_buttonBox_accepted()
|
|||
{
|
||||
rigCom.netRigctl = false;
|
||||
rigCom.rigPort = ui->comboBox_comPort->currentText();
|
||||
rigCom.serialSpeed = ui->comboBox_serialSpeed->currentText().toInt();
|
||||
rigCom.civAddr = ui->lineEdit_civAddr->text().toInt(&civAddrConv,16);
|
||||
//rigCom.serialSpeed = ui->comboBox_serialSpeed->currentText().toInt();
|
||||
//rigCom.civAddr = ui->lineEdit_civAddr->text().toInt(&civAddrConv,16);
|
||||
//setRigSerialConfigFromDialog();
|
||||
|
||||
if (rigCom.rigPort == "" && rigCom.rigModel != 1 && rigCom.rigModel != 6)
|
||||
{
|
||||
|
@ -168,10 +230,16 @@ void DialogConfig::on_buttonBox_accepted()
|
|||
msgBox.exec();
|
||||
}
|
||||
}
|
||||
|
||||
rigCom.serialSpeed = ui->comboBox_serialSpeed->currentText().toInt();
|
||||
rigCom.civAddr = ui->lineEdit_civAddr->text().toInt(&civAddrConv,16);
|
||||
setRigSerialConfigFromDialog();
|
||||
}
|
||||
|
||||
rigCom.rigRefresh = ui->spinBox_RefreshRate->value();
|
||||
rigCom.fullPoll = ui->checkBox_fullPoll->isChecked();
|
||||
rigCom.autoConnect = ui->checkBox_autoConnect->isChecked();
|
||||
rigCom.autoPowerOn = ui->checkBox_autoPowerOn->isChecked();
|
||||
|
||||
//* Save settings in catradio.ini
|
||||
QSettings configFile(QString("catradio.ini"), QSettings::IniFormat);
|
||||
|
@ -179,18 +247,34 @@ void DialogConfig::on_buttonBox_accepted()
|
|||
configFile.setValue("rigPort", rigCom.rigPort);
|
||||
configFile.setValue("serialSpeed", ui->comboBox_serialSpeed->currentText());
|
||||
configFile.setValue("civAddress", ui->lineEdit_civAddr->text().toInt(&civAddrConv,16));
|
||||
configFile.setValue("serialDataBits", rigCom.serialDataBits);
|
||||
configFile.setValue("serialParity", rigCom.serialParity);
|
||||
configFile.setValue("serialStopBits", rigCom.serialStopBits);
|
||||
configFile.setValue("serialHandshake", rigCom.serialHandshake);
|
||||
configFile.setValue("netRigctl", ui->checkBox_netRigctl->isChecked());
|
||||
configFile.setValue("rigRefresh", ui->spinBox_RefreshRate->value());
|
||||
configFile.setValue("fullPolling", ui->checkBox_fullPoll->isChecked());
|
||||
configFile.setValue("autoConnect", ui->checkBox_autoConnect->isChecked());
|
||||
configFile.setValue("autoPowerOn", ui->checkBox_autoPowerOn->isChecked());
|
||||
}
|
||||
|
||||
int printRigList(const struct rig_caps *rigCaps, void *data) //Load rig list from hamlib and save into file rig.lst
|
||||
#ifdef RIGCAPS_NOT_CONST //rig_caps is no longer constant starting from hamlib v.4.6
|
||||
int printRigList(struct rig_caps *rigCaps, void *data) //Load rig list from hamlib and save into file rig.lst
|
||||
{
|
||||
if (data) return 0;
|
||||
QTextStream stream(&rigFile);
|
||||
stream << rigCaps->rig_model << " " << rigCaps->mfg_name << " " << rigCaps->model_name << "\n";
|
||||
return 1;
|
||||
}
|
||||
#else
|
||||
int printRigList(const struct rig_caps *rigCaps, void *data)
|
||||
{
|
||||
if (data) return 0;
|
||||
QTextStream stream(&rigFile);
|
||||
stream << rigCaps->rig_model << " " << rigCaps->mfg_name << " " << rigCaps->model_name << "\n";
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool createRigFile()
|
||||
{
|
||||
|
@ -206,21 +290,53 @@ void DialogConfig::on_checkBox_netRigctl_toggled(bool checked)
|
|||
{
|
||||
if (checked) //TCP port
|
||||
{
|
||||
ui->comboBox_comPort->setCurrentText(""); //clear COM port
|
||||
//ui->comboBox_comPort->setCurrentText(""); //clear COM port
|
||||
}
|
||||
else //COM port
|
||||
{
|
||||
ui->lineEdit_ip->setText(""); //clear IP address
|
||||
//ui->lineEdit_ip->setText(""); //clear IP address
|
||||
}
|
||||
}
|
||||
|
||||
void DialogConfig::on_comboBox_rigModel_currentIndexChanged(int index)
|
||||
{
|
||||
if (index == 2 || index == 3 || index == 4)
|
||||
int currentRig = 0;
|
||||
RIG *rig;
|
||||
|
||||
if (index)
|
||||
{
|
||||
ui->checkBox_netRigctl->setChecked(true);
|
||||
ui->tabWidget_Config->setCurrentIndex(1);
|
||||
QString rigModel = ui->comboBox_rigModel->currentText();
|
||||
currentRig = findRigModel(rigModel);
|
||||
}
|
||||
|
||||
if (currentRig)
|
||||
{
|
||||
rig = rig_init(currentRig);
|
||||
if (rig->caps->port_type == RIG_PORT_SERIAL)
|
||||
{
|
||||
//ui->checkBox_netRigctl->setChecked(false);
|
||||
ui->tabWidget_Config->setCurrentIndex(0);
|
||||
setDialogSerialConfig(rig->caps->serial_data_bits, rig->caps->serial_parity, rig->caps->serial_stop_bits, rig->caps->serial_handshake);
|
||||
//qDebug() << rig->caps->serial_data_bits << rig->caps->serial_parity << rig->caps->serial_stop_bits << rig->caps->serial_handshake;
|
||||
}
|
||||
else if (rig->caps->port_type == RIG_PORT_NETWORK)
|
||||
{
|
||||
ui->checkBox_netRigctl->setChecked(true);
|
||||
ui->tabWidget_Config->setCurrentIndex(1);
|
||||
}
|
||||
else if (rig->caps->port_type == RIG_PORT_NONE)
|
||||
{
|
||||
ui->checkBox_netRigctl->setChecked(false);
|
||||
ui->tabWidget_Config->setCurrentIndex(0);
|
||||
ui->comboBox_comPort->clear();
|
||||
}
|
||||
}
|
||||
|
||||
//if (index == 2 || index == 3 || index == 4)
|
||||
//{
|
||||
// ui->checkBox_netRigctl->setChecked(true);
|
||||
// ui->tabWidget_Config->setCurrentIndex(1);
|
||||
//}
|
||||
}
|
||||
|
||||
void DialogConfig::on_comboBox_comPort_currentIndexChanged(int index)
|
||||
|
|
|
@ -45,6 +45,10 @@ private slots:
|
|||
|
||||
private:
|
||||
Ui::DialogConfig *ui;
|
||||
|
||||
int findRigModel(QString rigModel); //Find hamlib rig model from the rig selected in the comboBox_rigModel
|
||||
void setDialogSerialConfig(int dataBits, int parity, int stopBits, int handshake); //Set the serial port configuration on the dialog
|
||||
void setRigSerialConfigFromDialog(); //Set the rigConf serial config from dialog serial settings
|
||||
};
|
||||
|
||||
int printRigList(const struct rig_caps *rigCaps, void *data); //Retrives rig list from Hamlib and write to file
|
||||
|
|
183
dialogconfig.ui
183
dialogconfig.ui
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>385</width>
|
||||
<height>338</height>
|
||||
<width>390</width>
|
||||
<height>700</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -52,7 +52,11 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="comboBox_comPort"/>
|
||||
<widget class="QComboBox" name="comboBox_comPort">
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_serialSpeed">
|
||||
|
@ -114,6 +118,124 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="groupBox_serialDataBits">
|
||||
<property name="title">
|
||||
<string>Data Bits</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButton_dataBits7">
|
||||
<property name="text">
|
||||
<string>7</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButton_dataBits8">
|
||||
<property name="text">
|
||||
<string>8</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="groupBox_serialStopBits">
|
||||
<property name="title">
|
||||
<string>Stop Bits</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButton_stopBits1">
|
||||
<property name="text">
|
||||
<string>1</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButton_stopBits2">
|
||||
<property name="text">
|
||||
<string>2</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="groupBox_serialHandshake">
|
||||
<property name="title">
|
||||
<string>Handshake</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0">
|
||||
<widget class="QRadioButton" name="radioButton_handshakeXonXoff">
|
||||
<property name="text">
|
||||
<string>XON/XOFF</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QRadioButton" name="radioButton_handshakeHardware">
|
||||
<property name="text">
|
||||
<string>Hardware</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QRadioButton" name="radioButton_handshakeNone">
|
||||
<property name="text">
|
||||
<string>None</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="groupBox_serialParity">
|
||||
<property name="title">
|
||||
<string>Parity</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="2" column="0">
|
||||
<widget class="QRadioButton" name="radioButton_parityOdd">
|
||||
<property name="text">
|
||||
<string>Odd</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QRadioButton" name="radioButton_parityEven">
|
||||
<property name="text">
|
||||
<string>Even</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QRadioButton" name="radioButton_parityNone">
|
||||
<property name="text">
|
||||
<string>None</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_tcp">
|
||||
|
@ -141,7 +263,10 @@
|
|||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_ip">
|
||||
<property name="toolTip">
|
||||
<string>e.g. 127.0.0.1:4532</string>
|
||||
<string>rigctld ip:port</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>127.0.0.1:4532</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -154,8 +279,8 @@
|
|||
<property name="title">
|
||||
<string>Options</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout_3">
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_RefreshRate">
|
||||
|
@ -198,11 +323,34 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QCheckBox" name="checkBox_fullPoll">
|
||||
<property name="text">
|
||||
<string>Full polling</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="checkBox_autoConnect">
|
||||
<property name="toolTip">
|
||||
<string>Auto connect on startup</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Auto connect</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QCheckBox" name="checkBox_autoPowerOn">
|
||||
<property name="toolTip">
|
||||
<string>Auto power-on on startup</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Auto power ON</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -221,12 +369,25 @@
|
|||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>comboBox_rigModel</tabstop>
|
||||
<tabstop>tabWidget_Config</tabstop>
|
||||
<tabstop>comboBox_comPort</tabstop>
|
||||
<tabstop>comboBox_serialSpeed</tabstop>
|
||||
<tabstop>lineEdit_civAddr</tabstop>
|
||||
<tabstop>radioButton_dataBits7</tabstop>
|
||||
<tabstop>radioButton_dataBits8</tabstop>
|
||||
<tabstop>radioButton_parityNone</tabstop>
|
||||
<tabstop>radioButton_parityOdd</tabstop>
|
||||
<tabstop>radioButton_parityEven</tabstop>
|
||||
<tabstop>radioButton_stopBits1</tabstop>
|
||||
<tabstop>radioButton_stopBits2</tabstop>
|
||||
<tabstop>radioButton_handshakeNone</tabstop>
|
||||
<tabstop>radioButton_handshakeXonXoff</tabstop>
|
||||
<tabstop>radioButton_handshakeHardware</tabstop>
|
||||
<tabstop>spinBox_RefreshRate</tabstop>
|
||||
<tabstop>checkBox_fullPoll</tabstop>
|
||||
<tabstop>checkBox_autoConnect</tabstop>
|
||||
<tabstop>checkBox_autoPowerOn</tabstop>
|
||||
<tabstop>checkBox_netRigctl</tabstop>
|
||||
<tabstop>lineEdit_ip</tabstop>
|
||||
</tabstops>
|
||||
|
@ -239,8 +400,8 @@
|
|||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>259</x>
|
||||
<y>324</y>
|
||||
<x>270</x>
|
||||
<y>688</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
|
@ -255,8 +416,8 @@
|
|||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>327</x>
|
||||
<y>324</y>
|
||||
<x>338</x>
|
||||
<y>688</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
|
|
|
@ -19,6 +19,8 @@ DialogSetup::DialogSetup(QWidget *parent) :
|
|||
|
||||
if (guiConf.vfoDisplayMode) ui->radioButton_vfoDispMode_UD->setChecked(true);
|
||||
if (guiConf.darkTheme) ui->radioButton_themeDark->setChecked(true);
|
||||
if (guiConf.peakHold) ui->checkBox_peakHold->setChecked(true);
|
||||
if (guiConf.debugMode) ui->checkBox_debug->setChecked(true);
|
||||
}
|
||||
|
||||
DialogSetup::~DialogSetup()
|
||||
|
@ -40,9 +42,13 @@ void DialogSetup::on_buttonBox_accepted()
|
|||
|
||||
guiConf.vfoDisplayMode = ui->radioButton_vfoDispMode_UD->isChecked();
|
||||
guiConf.darkTheme = ui->radioButton_themeDark->isChecked();
|
||||
guiConf.peakHold = ui->checkBox_peakHold->isChecked();
|
||||
guiConf.debugMode = ui->checkBox_debug->isChecked();
|
||||
|
||||
//* Save settings in catradio.ini
|
||||
QSettings configFile(QString("catradio.ini"), QSettings::IniFormat);
|
||||
configFile.setValue("vfoDisplayMode", guiConf.vfoDisplayMode);
|
||||
configFile.setValue("darkTheme", guiConf.darkTheme);
|
||||
configFile.setValue("peakHold", guiConf.peakHold);
|
||||
configFile.setValue("debugMode", guiConf.debugMode);
|
||||
}
|
||||
|
|
101
dialogsetup.ui
101
dialogsetup.ui
|
@ -14,14 +14,65 @@
|
|||
<string>Setup</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_theme">
|
||||
<property name="title">
|
||||
<string>Theme</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButton_themeDefault">
|
||||
<property name="text">
|
||||
<string>Default</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButton_themeDark">
|
||||
<property name="text">
|
||||
<string>Dark</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_peakHold">
|
||||
<property name="text">
|
||||
<string>Meter Peak hold</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
|
@ -50,43 +101,21 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<item row="5" column="0">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</spacer>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_theme">
|
||||
<property name="title">
|
||||
<string>Theme</string>
|
||||
<item row="4" column="0">
|
||||
<widget class="QCheckBox" name="checkBox_debug">
|
||||
<property name="text">
|
||||
<string>Debug mode (developers only)</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButton_themeDefault">
|
||||
<property name="text">
|
||||
<string>Default</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButton_themeDark">
|
||||
<property name="text">
|
||||
<string>Dark</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
typedef struct {
|
||||
int vfoDisplayMode; //0: use Left/Right mouse button, 1: click digit Up or Down
|
||||
bool darkTheme; //flag for Dark theme
|
||||
bool peakHold; //meters peak hold
|
||||
bool debugMode;
|
||||
} guiConfig;
|
||||
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
#ifndef _AMPLIFIER_H
|
||||
#define _AMPLIFIER_H 1
|
||||
|
@ -232,9 +233,9 @@ struct amp_caps
|
|||
int (*set_freq)(AMP *amp, freq_t val); /*!< Pointer to backend implementation of ::amp_set_freq(). */
|
||||
int (*get_freq)(AMP *amp, freq_t *val); /*!< Pointer to backend implementation of ::amp_get_freq(). */
|
||||
|
||||
int (*set_conf)(AMP *amp, token_t token, const char *val); /*!< Pointer to backend implementation of ::amp_set_conf(). */
|
||||
int (*get_conf2)(AMP *amp, token_t token, char *val, int val_len); /*!< Pointer to backend implementation of ::amp_get_conf(). */
|
||||
int (*get_conf)(AMP *amp, token_t token, char *val); /*!< Pointer to backend implementation of ::amp_get_conf(). */
|
||||
int (*set_conf)(AMP *amp, hamlib_token_t token, const char *val); /*!< Pointer to backend implementation of ::amp_set_conf(). */
|
||||
int (*get_conf2)(AMP *amp, hamlib_token_t token, char *val, int val_len); /*!< Pointer to backend implementation of ::amp_get_conf(). */
|
||||
int (*get_conf)(AMP *amp, hamlib_token_t token, char *val); /*!< Pointer to backend implementation of ::amp_get_conf(). */
|
||||
|
||||
/*
|
||||
* General API commands, from most primitive to least.. :()
|
||||
|
@ -244,8 +245,8 @@ struct amp_caps
|
|||
int (*reset)(AMP *amp, amp_reset_t reset); /*!< Pointer to backend implementation of ::amp_reset(). */
|
||||
int (*get_level)(AMP *amp, setting_t level, value_t *val); /*!< Pointer to backend implementation of ::amp_get_level(). */
|
||||
int (*set_level)(AMP *amp, setting_t level, value_t val); /*!< Pointer to backend implementation of ::amp_get_level(). */
|
||||
int (*get_ext_level)(AMP *amp, token_t level, value_t *val); /*!< Pointer to backend implementation of ::amp_get_ext_level(). */
|
||||
int (*set_ext_level)(AMP *amp, token_t level, value_t val); /*!< Pointer to backend implementation of ::amp_set_ext_level(). */
|
||||
int (*get_ext_level)(AMP *amp, hamlib_token_t level, value_t *val); /*!< Pointer to backend implementation of ::amp_get_ext_level(). */
|
||||
int (*set_ext_level)(AMP *amp, hamlib_token_t level, value_t val); /*!< Pointer to backend implementation of ::amp_set_ext_level(). */
|
||||
int (*set_powerstat)(AMP *amp, powerstat_t status); /*!< Pointer to backend implementation of ::amp_set_powerstat(). */
|
||||
int (*get_powerstat)(AMP *amp, powerstat_t *status); /*!< Pointer to backend implementation of ::amp_get_powerstat(). */
|
||||
|
||||
|
@ -335,11 +336,11 @@ amp_cleanup HAMLIB_PARAMS((AMP *amp));
|
|||
|
||||
extern HAMLIB_EXPORT(int)
|
||||
amp_set_conf HAMLIB_PARAMS((AMP *amp,
|
||||
token_t token,
|
||||
hamlib_token_t token,
|
||||
const char *val));
|
||||
extern HAMLIB_EXPORT(int)
|
||||
amp_get_conf HAMLIB_PARAMS((AMP *amp,
|
||||
token_t token,
|
||||
hamlib_token_t token,
|
||||
char *val));
|
||||
extern HAMLIB_EXPORT(int)
|
||||
amp_set_powerstat HAMLIB_PARAMS((AMP *amp,
|
||||
|
@ -407,7 +408,7 @@ extern HAMLIB_EXPORT(const struct confparams *)
|
|||
amp_confparam_lookup HAMLIB_PARAMS((AMP *amp,
|
||||
const char *name));
|
||||
|
||||
extern HAMLIB_EXPORT(token_t)
|
||||
extern HAMLIB_EXPORT(hamlib_token_t)
|
||||
amp_token_lookup HAMLIB_PARAMS((AMP *amp,
|
||||
const char *name));
|
||||
|
||||
|
@ -428,12 +429,12 @@ amp_ext_lookup HAMLIB_PARAMS((AMP *amp,
|
|||
|
||||
extern HAMLIB_EXPORT(int)
|
||||
amp_get_ext_level HAMLIB_PARAMS((AMP *amp,
|
||||
token_t token,
|
||||
hamlib_token_t token,
|
||||
value_t *val));
|
||||
|
||||
extern HAMLIB_EXPORT(int)
|
||||
amp_set_ext_level HAMLIB_PARAMS((AMP *amp,
|
||||
token_t token,
|
||||
hamlib_token_t token,
|
||||
value_t val));
|
||||
|
||||
extern HAMLIB_EXPORT(const char *) amp_strlevel(setting_t);
|
||||
|
@ -445,6 +446,8 @@ rig_ext_lookup HAMLIB_PARAMS((RIG *rig,
|
|||
extern HAMLIB_EXPORT(setting_t) amp_parse_level(const char *s);
|
||||
extern HAMLIB_EXPORT(const char *) amp_strlevel(setting_t);
|
||||
|
||||
extern HAMLIB_EXPORT(void *) amp_data_pointer(AMP *amp, rig_ptrx_t idx);
|
||||
|
||||
//! @endcond
|
||||
|
||||
|
||||
|
|
|
@ -106,10 +106,15 @@
|
|||
//! @endcond
|
||||
#define AMP_MODEL_ELECRAFT_KPA1500 AMP_MAKE_MODEL(AMP_ELECRAFT, 1)
|
||||
//#define AMP_MODEL_ELECRAFT_KPA500 AMP_MAKE_MODEL(AMP_ELECRAFT, 2)
|
||||
|
||||
#define AMP_GEMINI 3
|
||||
#define AMP_BACKEND_GEMINI "gemini"
|
||||
#define AMP_MODEL_GEMINI_DX1200 AMP_MAKE_MODEL(AMP_GEMINI, 1)
|
||||
|
||||
#define AMP_EXPERT 4
|
||||
#define AMP_BACKEND_EXPERT "expert"
|
||||
#define AMP_MODEL_EXPERT_FA AMP_MAKE_MODEL(AMP_EXPERT, 1)
|
||||
|
||||
|
||||
/**
|
||||
* \brief Convenience type definition for an amplifier model.
|
||||
|
|
|
@ -5,11 +5,20 @@
|
|||
#define ABI_AGE 0
|
||||
|
||||
/* Frontend ABI revision */
|
||||
#define ABI_REVISION 5
|
||||
#define ABI_REVISION 6
|
||||
|
||||
/* Frontend ABI version */
|
||||
#define ABI_VERSION 4
|
||||
|
||||
/* Frontend Major version */
|
||||
#define ABI_VERSION_MAJOR 4
|
||||
|
||||
/* Frontend Minor version */
|
||||
#define ABI_VERSION_MINOR 6
|
||||
|
||||
/* Frontend Patch version */
|
||||
#define ABI_VERSION_PATCH 0
|
||||
|
||||
/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
|
||||
systems. This function is required for `alloca.c' support on those systems.
|
||||
*/
|
||||
|
@ -165,6 +174,9 @@
|
|||
/* Define to 1 if you have the <netinet/in.h> header file. */
|
||||
/* #undef HAVE_NETINET_IN_H */
|
||||
|
||||
/* Define if parallel devices are to be built */
|
||||
#define HAVE_PARALLEL 1
|
||||
|
||||
/* Define to 1 if you have the `pow' function. */
|
||||
#define HAVE_POW 1
|
||||
|
||||
|
@ -321,6 +333,9 @@
|
|||
/* Define to 1 if you have the `usleep' function. */
|
||||
#define HAVE_USLEEP 1
|
||||
|
||||
/* Define if usrp is available */
|
||||
/* #undef HAVE_USRP */
|
||||
|
||||
/* Define to 1 if you have the <values.h> header file. */
|
||||
/* #undef HAVE_VALUES_H */
|
||||
|
||||
|
@ -342,6 +357,9 @@
|
|||
/* Define to 1 if you have the <wspiapi.h> header file. */
|
||||
#define HAVE_WSPIAPI_H 1
|
||||
|
||||
/* Define if libxml2 is available */
|
||||
/* #undef HAVE_XML2 */
|
||||
|
||||
/* Define to the sub-directory where libtool stores uninstalled libraries. */
|
||||
#define LT_OBJDIR ".libs/"
|
||||
|
||||
|
@ -358,7 +376,7 @@
|
|||
#define PACKAGE_NAME "Hamlib"
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#define PACKAGE_STRING "Hamlib 4.5"
|
||||
#define PACKAGE_STRING "Hamlib 4.6~git"
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#define PACKAGE_TARNAME "hamlib"
|
||||
|
@ -367,7 +385,7 @@
|
|||
#define PACKAGE_URL "http://www.hamlib.org"
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#define PACKAGE_VERSION "4.5"
|
||||
#define PACKAGE_VERSION "4.6~git"
|
||||
|
||||
/* Define to necessary symbol if this constant uses a non-standard name on
|
||||
your system. */
|
||||
|
@ -407,7 +425,7 @@
|
|||
|
||||
|
||||
/* Version number of package */
|
||||
#define VERSION "4.5"
|
||||
#define VERSION "4.6~git"
|
||||
|
||||
/* Define to 1 if on MINIX. */
|
||||
/* #undef _MINIX */
|
||||
|
|
Plik binarny nie jest wyświetlany.
Plik binarny nie jest wyświetlany.
|
@ -0,0 +1,45 @@
|
|||
//include <stdio.h>
|
||||
//#include <stdlib.h>
|
||||
//#include <string.h>
|
||||
//#include <errno.h>
|
||||
//#include <unistd.h>
|
||||
#include <hamlib/rig.h>
|
||||
//#include <sys/socket.h>
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
#ifdef _WIN32
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ARPA_INET_H
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#ifndef MULTICAST_H
|
||||
#define MULTICAST_H
|
||||
|
||||
struct multicast_vfo
|
||||
{
|
||||
char *name;
|
||||
double freq;
|
||||
char *mode;
|
||||
int width;
|
||||
int widthLower;
|
||||
int widthUpper;
|
||||
unsigned char rx; // true if in rx mode
|
||||
unsigned char tx; // true in in tx mode
|
||||
};
|
||||
|
||||
struct multicast_broadcast
|
||||
{
|
||||
char *ID;
|
||||
struct multicast_vfo **vfo;
|
||||
};
|
||||
|
||||
// returns # of bytes sent
|
||||
extern HAMLIB_EXPORT (int) multicast_init(RIG *rig, char *addr, int port);
|
||||
extern HAMLIB_EXPORT (int) multicast_send(RIG *rig, const char *msg, int msglen);
|
||||
extern HAMLIB_EXPORT (int) multicast_stop(RIG *rig);
|
||||
#endif //MULTICAST_H
|
645
hamlib/rig.h
645
hamlib/rig.h
Plik diff jest za duży
Load Diff
|
@ -33,6 +33,8 @@
|
|||
#define RIG_MAKE_MODEL(a,b) ((a)*MAX_MODELS_PER_BACKEND+(b))
|
||||
#define RIG_BACKEND_NUM(a) ((a)/MAX_MODELS_PER_BACKEND)
|
||||
|
||||
//! @endcond
|
||||
|
||||
/*! \file riglist.h
|
||||
* \brief Hamlib rig(radio) model definitions.
|
||||
*
|
||||
|
@ -49,6 +51,13 @@
|
|||
* whishes to use. It is done with the rig_init() API call.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \def RIG_MODEL_NONE
|
||||
* \brief A macro that returns the model number for an unknown model.
|
||||
*
|
||||
* The none backend, as the name suggests, does nothing. It is mainly for
|
||||
* internal use.
|
||||
*/
|
||||
#define RIG_MODEL_NONE 0
|
||||
|
||||
/*! \def RIG_MODEL_DUMMY
|
||||
|
@ -62,16 +71,21 @@
|
|||
* It has also been expanded to provide support to "virtual" type of rigs
|
||||
* such as the network rig control backend and W1HKJ's Flrig application.
|
||||
*/
|
||||
//! @cond Doxygen_Suppress
|
||||
#define RIG_DUMMY 0
|
||||
#define RIG_BACKEND_DUMMY "dummy"
|
||||
//! @endcond
|
||||
#define RIG_MODEL_DUMMY RIG_MAKE_MODEL(RIG_DUMMY, 1)
|
||||
//! @cond Doxygen_Suppress
|
||||
#define RIG_MODEL_NETRIGCTL RIG_MAKE_MODEL(RIG_DUMMY, 2)
|
||||
#define RIG_MODEL_ARMSTRONG RIG_MAKE_MODEL(RIG_DUMMY, 3)
|
||||
#define RIG_MODEL_FLRIG RIG_MAKE_MODEL(RIG_DUMMY, 4)
|
||||
#define RIG_MODEL_TRXMANAGER_RIG RIG_MAKE_MODEL(RIG_DUMMY, 5)
|
||||
#define RIG_MODEL_DUMMY_NOVFO RIG_MAKE_MODEL(RIG_DUMMY, 6)
|
||||
#define RIG_MODEL_TCI1X RIG_MAKE_MODEL(RIG_DUMMY, 7)
|
||||
|
||||
#define RIG_MODEL_ACLOG RIG_MAKE_MODEL(RIG_DUMMY, 8)
|
||||
#define RIG_MODEL_SDRSHARP RIG_MAKE_MODEL(RIG_DUMMY, 9)
|
||||
#define RIG_MODEL_QUISK RIG_MAKE_MODEL(RIG_DUMMY, 10)
|
||||
|
||||
/*
|
||||
* Yaesu
|
||||
|
@ -127,7 +141,8 @@
|
|||
#define RIG_MODEL_FT650 RIG_MAKE_MODEL(RIG_YAESU, 47)
|
||||
#define RIG_MODEL_FT990UNI RIG_MAKE_MODEL(RIG_YAESU, 48)
|
||||
#define RIG_MODEL_FT710 RIG_MAKE_MODEL(RIG_YAESU, 49)
|
||||
|
||||
#define RIG_MODEL_FT9000OLD RIG_MAKE_MODEL(RIG_YAESU, 50)
|
||||
#define RIG_MODEL_Q900 RIG_MAKE_MODEL(RIG_YAESU, 51)
|
||||
|
||||
/*
|
||||
* Kenwood
|
||||
|
@ -185,6 +200,10 @@
|
|||
#define RIG_MODEL_MALACHITE RIG_MAKE_MODEL(RIG_KENWOOD, 49)
|
||||
#define RIG_MODEL_LAB599_TX500 RIG_MAKE_MODEL(RIG_KENWOOD,50)
|
||||
#define RIG_MODEL_SDRUNO RIG_MAKE_MODEL(RIG_KENWOOD,51)
|
||||
#define RIG_MODEL_QRPLABS RIG_MAKE_MODEL(RIG_KENWOOD,52)
|
||||
#define RIG_MODEL_FX4 RIG_MAKE_MODEL(RIG_KENWOOD,53)
|
||||
#define RIG_MODEL_THETIS RIG_MAKE_MODEL(RIG_KENWOOD, 54)
|
||||
#define RIG_MODEL_TRUSDX RIG_MAKE_MODEL(RIG_KENWOOD, 55)
|
||||
|
||||
/*
|
||||
* Icom
|
||||
|
@ -272,7 +291,7 @@
|
|||
#define RIG_MODEL_X6100 RIG_MAKE_MODEL(RIG_ICOM, 87) /* Xiegu X6100 */
|
||||
#define RIG_MODEL_G90 RIG_MAKE_MODEL(RIG_ICOM, 88) /* Xiegu G90 */
|
||||
#define RIG_MODEL_X5105 RIG_MAKE_MODEL(RIG_ICOM, 89) /* Xiegu X5105 -- G90 compatible */
|
||||
|
||||
#define RIG_MODEL_IC905 RIG_MAKE_MODEL(RIG_ICOM, 90)
|
||||
|
||||
/*
|
||||
* Optoelectronics (CI-V)
|
||||
|
@ -282,7 +301,6 @@
|
|||
#define RIG_MODEL_OS535 RIG_MAKE_MODEL(RIG_ICOM, 52)
|
||||
#define RIG_MODEL_OS456 RIG_MAKE_MODEL(RIG_ICOM, 53)
|
||||
|
||||
|
||||
/*
|
||||
* TenTec (CI-V)
|
||||
*/
|
||||
|
@ -291,7 +309,6 @@
|
|||
#define RIG_MODEL_PARAGON2 RIG_MAKE_MODEL(RIG_ICOM, 59)
|
||||
#define RIG_MODEL_DELTAII RIG_MAKE_MODEL(RIG_ICOM, 64)
|
||||
|
||||
|
||||
/*
|
||||
* Icom PCR
|
||||
*/
|
||||
|
@ -302,7 +319,6 @@
|
|||
#define RIG_MODEL_PCR1500 RIG_MAKE_MODEL(RIG_PCR, 3)
|
||||
#define RIG_MODEL_PCR2500 RIG_MAKE_MODEL(RIG_PCR, 4)
|
||||
|
||||
|
||||
/*
|
||||
* AOR
|
||||
*/
|
||||
|
@ -325,7 +341,6 @@
|
|||
#define RIG_MODEL_AR7030P RIG_MAKE_MODEL(RIG_AOR, 15)
|
||||
#define RIG_MODEL_SR2200 RIG_MAKE_MODEL(RIG_AOR, 16)
|
||||
|
||||
|
||||
/*
|
||||
* JRC
|
||||
*/
|
||||
|
@ -339,7 +354,6 @@
|
|||
#define RIG_MODEL_NRD535 RIG_MAKE_MODEL(RIG_JRC, 6)
|
||||
#define RIG_MODEL_NRD545 RIG_MAKE_MODEL(RIG_JRC, 7)
|
||||
|
||||
|
||||
/*
|
||||
* Radio Shack
|
||||
* Actually, they might be either Icom or Uniden. TBC --SF
|
||||
|
@ -353,7 +367,6 @@
|
|||
#define RIG_MODEL_RS2042 RIG_MAKE_MODEL(RIG_RADIOSHACK, 5) /* w/ OptoElectronics OS435 Board */
|
||||
#define RIG_MODEL_RS2041 RIG_MAKE_MODEL(RIG_RADIOSHACK, 6) /* PRO-2041 */
|
||||
|
||||
|
||||
/*
|
||||
* Uniden
|
||||
*/
|
||||
|
@ -372,7 +385,6 @@
|
|||
#define RIG_MODEL_BCD996T RIG_MAKE_MODEL(RIG_UNIDEN, 11)
|
||||
#define RIG_MODEL_BC898 RIG_MAKE_MODEL(RIG_UNIDEN, 12)
|
||||
|
||||
|
||||
/*
|
||||
* Drake
|
||||
*/
|
||||
|
@ -382,7 +394,6 @@
|
|||
#define RIG_MODEL_DKR8A RIG_MAKE_MODEL(RIG_DRAKE, 2)
|
||||
#define RIG_MODEL_DKR8B RIG_MAKE_MODEL(RIG_DRAKE, 3)
|
||||
|
||||
|
||||
/*
|
||||
* Lowe
|
||||
*/
|
||||
|
@ -393,7 +404,6 @@
|
|||
#define RIG_MODEL_HF250 RIG_MAKE_MODEL(RIG_LOWE, 3)
|
||||
#define RIG_MODEL_HF235 RIG_MAKE_MODEL(RIG_LOWE, 4)
|
||||
|
||||
|
||||
/*
|
||||
* Racal
|
||||
*/
|
||||
|
@ -405,7 +415,6 @@
|
|||
#define RIG_MODEL_RA3710 RIG_MAKE_MODEL(RIG_RACAL, 4)
|
||||
#define RIG_MODEL_RA3702 RIG_MAKE_MODEL(RIG_RACAL, 5)
|
||||
|
||||
|
||||
/*
|
||||
* Watkins-Johnson
|
||||
*/
|
||||
|
@ -416,7 +425,6 @@
|
|||
#define RIG_MODEL_WJ8711 RIG_MAKE_MODEL(RIG_WJ, 3)
|
||||
#define RIG_MODEL_WJ8888 RIG_MAKE_MODEL(RIG_WJ, 4)
|
||||
|
||||
|
||||
/*
|
||||
* Rohde & Schwarz--ek
|
||||
*/
|
||||
|
@ -428,7 +436,6 @@
|
|||
#define RIG_MODEL_EK895 RIG_MAKE_MODEL(RIG_EK, 4)
|
||||
#define RIG_MODEL_EK070 RIG_MAKE_MODEL(RIG_EK, 5)
|
||||
|
||||
|
||||
/*
|
||||
* Skanti
|
||||
*/
|
||||
|
@ -439,7 +446,6 @@
|
|||
#define RIG_MODEL_TRP9000 RIG_MAKE_MODEL(RIG_SKANTI, 3)
|
||||
#define RIG_MODEL_TRP8255 RIG_MAKE_MODEL(RIG_SKANTI, 4)
|
||||
|
||||
|
||||
/*
|
||||
* WiNRADiO/LinRADiO
|
||||
*/
|
||||
|
@ -457,7 +463,6 @@
|
|||
#define RIG_MODEL_G305 RIG_MAKE_MODEL(RIG_WINRADIO, 10)
|
||||
#define RIG_MODEL_G315 RIG_MAKE_MODEL(RIG_WINRADIO, 11)
|
||||
|
||||
|
||||
/*
|
||||
* Ten Tec
|
||||
*/
|
||||
|
@ -476,7 +481,6 @@
|
|||
#define RIG_MODEL_RX331 RIG_MAKE_MODEL(RIG_TENTEC, 12)
|
||||
#define RIG_MODEL_TT599 RIG_MAKE_MODEL(RIG_TENTEC, 13) /* Eagle */
|
||||
|
||||
|
||||
/*
|
||||
* Alinco
|
||||
*/
|
||||
|
@ -485,7 +489,6 @@
|
|||
#define RIG_MODEL_DX77 RIG_MAKE_MODEL(RIG_ALINCO, 1)
|
||||
#define RIG_MODEL_DXSR8 RIG_MAKE_MODEL(RIG_ALINCO, 2)
|
||||
|
||||
|
||||
/*
|
||||
* Kachina
|
||||
*/
|
||||
|
@ -493,7 +496,6 @@
|
|||
#define RIG_BACKEND_KACHINA "kachina"
|
||||
#define RIG_MODEL_505DSP RIG_MAKE_MODEL(RIG_KACHINA, 1)
|
||||
|
||||
|
||||
/*
|
||||
* Gnuradio backend
|
||||
*/
|
||||
|
@ -505,7 +507,6 @@
|
|||
#define RIG_MODEL_GRAUDIOIQ RIG_MAKE_MODEL(RIG_GNURADIO, 4) /* I&Q stereo sound card source */
|
||||
#define RIG_MODEL_USRP_G RIG_MAKE_MODEL(RIG_GNURADIO, 5) /* Universal Software Radio Peripheral */
|
||||
|
||||
|
||||
/*
|
||||
* Microtune tuners
|
||||
*/
|
||||
|
@ -515,7 +516,6 @@
|
|||
#define RIG_MODEL_MICROTUNE_4702 RIG_MAKE_MODEL(RIG_MICROTUNE, 2) /* Alan's */
|
||||
#define RIG_MODEL_MICROTUNE_4707 RIG_MAKE_MODEL(RIG_MICROTUNE, 3)
|
||||
|
||||
|
||||
/*
|
||||
* TAPR
|
||||
*/
|
||||
|
@ -523,7 +523,6 @@
|
|||
#define RIG_BACKEND_TAPR "tapr"
|
||||
#define RIG_MODEL_DSP10 RIG_MAKE_MODEL(RIG_TAPR, 1)
|
||||
|
||||
|
||||
/*
|
||||
* Flex-radio
|
||||
*/
|
||||
|
@ -534,7 +533,6 @@
|
|||
#define RIG_MODEL_DTTSP RIG_MAKE_MODEL(RIG_FLEXRADIO, 3)
|
||||
#define RIG_MODEL_DTTSP_UDP RIG_MAKE_MODEL(RIG_FLEXRADIO, 4)
|
||||
|
||||
|
||||
/*
|
||||
* VEB Funkwerk Köpenick RFT
|
||||
*/
|
||||
|
@ -542,7 +540,6 @@
|
|||
#define RIG_BACKEND_RFT "rft"
|
||||
#define RIG_MODEL_EKD500 RIG_MAKE_MODEL(RIG_RFT, 1)
|
||||
|
||||
|
||||
/*
|
||||
* Various kits
|
||||
*/
|
||||
|
@ -568,7 +565,6 @@
|
|||
#define RIG_MODEL_FUNCUBEDONGLEPLUS RIG_MAKE_MODEL(RIG_KIT, 18) /* FunCUBE Dongle Pro+ */
|
||||
#define RIG_MODEL_RSHFIQ RIG_MAKE_MODEL(RIG_KIT, 19) /* RS-HFIQ */
|
||||
|
||||
|
||||
/*
|
||||
* SW/FM/TV tuner cards supported by Video4Linux,*BSD, ..
|
||||
*/
|
||||
|
@ -577,7 +573,6 @@
|
|||
#define RIG_MODEL_V4L RIG_MAKE_MODEL(RIG_TUNER, 1)
|
||||
#define RIG_MODEL_V4L2 RIG_MAKE_MODEL(RIG_TUNER, 2)
|
||||
|
||||
|
||||
/*
|
||||
* Rohde & Schwarz--rs
|
||||
*/
|
||||
|
@ -588,7 +583,6 @@
|
|||
#define RIG_MODEL_XK2100 RIG_MAKE_MODEL(RIG_RS, 3)
|
||||
#define RIG_MODEL_EK89X RIG_MAKE_MODEL(RIG_RS, 4)
|
||||
|
||||
|
||||
/*
|
||||
* Phillips/Simoco PRM80
|
||||
*/
|
||||
|
@ -597,7 +591,6 @@
|
|||
#define RIG_MODEL_PRM8060 RIG_MAKE_MODEL(RIG_PRM80, 1)
|
||||
#define RIG_MODEL_PRM8070 RIG_MAKE_MODEL(RIG_PRM80, 2)
|
||||
|
||||
|
||||
/*
|
||||
* ADAT by HB9CBU
|
||||
*
|
||||
|
@ -607,7 +600,6 @@
|
|||
#define RIG_BACKEND_ADAT "adat"
|
||||
#define RIG_MODEL_ADT_200A RIG_MAKE_MODEL(RIG_ADAT, 1)
|
||||
|
||||
|
||||
/*
|
||||
* ICOM Marine
|
||||
*/
|
||||
|
@ -618,7 +610,6 @@
|
|||
#define RIG_MODEL_IC_M710 RIG_MAKE_MODEL(RIG_ICMARINE, 3)
|
||||
#define RIG_MODEL_IC_M803 RIG_MAKE_MODEL(RIG_ICMARINE, 4)
|
||||
|
||||
|
||||
/*
|
||||
* Dorji transceiver modules
|
||||
*/
|
||||
|
@ -635,6 +626,7 @@
|
|||
#define RIG_MODEL_BARRETT_2050 RIG_MAKE_MODEL(RIG_BARRETT, 1)
|
||||
#define RIG_MODEL_BARRETT_950 RIG_MAKE_MODEL(RIG_BARRETT, 2)
|
||||
#define RIG_MODEL_BARRETT_4050 RIG_MAKE_MODEL(RIG_BARRETT, 3)
|
||||
#define RIG_MODEL_BARRETT_4100 RIG_MAKE_MODEL(RIG_BARRETT, 4)
|
||||
|
||||
/*
|
||||
* Elad
|
||||
|
@ -657,8 +649,14 @@
|
|||
#define RIG_GOMSPACE 35
|
||||
#define RIG_BACKEND_GOMSPACE "gomspace"
|
||||
#define RIG_MODEL_GS100 RIG_MAKE_MODEL(RIG_GOMSPACE, 1)
|
||||
//! @endcond
|
||||
|
||||
/*
|
||||
* MDS Microwave Data Systems https://en.wikipedia.org/wiki/Microwave_Data_Systems
|
||||
*/
|
||||
#define RIG_MDS 36
|
||||
#define RIG_BACKEND_MDS "MDS"
|
||||
#define RIG_MODEL_MDS4710 RIG_MAKE_MODEL(RIG_MDS, 1)
|
||||
#define RIG_MODEL_MDS9710 RIG_MAKE_MODEL(RIG_MDS, 2)
|
||||
/*
|
||||
* TODO:
|
||||
RIG_MODEL_KWZ30, KNEISNER +DOERING
|
||||
|
@ -666,6 +664,15 @@
|
|||
etc.
|
||||
*/
|
||||
|
||||
/*
|
||||
* AnyTone rigs
|
||||
*/
|
||||
#define RIG_ANYTONE 37
|
||||
#define RIG_BACKEND_ANYTONE "AnyTone"
|
||||
#define RIG_MODEL_ATD578UVIII RIG_MAKE_MODEL(RIG_ANYTONE, 1)
|
||||
|
||||
|
||||
//! @endcond
|
||||
|
||||
/*! \typedef typedef int rig_model_t
|
||||
\brief Convenience type definition for rig model.
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
#ifndef _ROTATOR_H
|
||||
#define _ROTATOR_H 1
|
||||
|
@ -413,8 +414,8 @@ struct rot_caps {
|
|||
int (*rot_open)(ROT *rot); /*!< Pointer to backend implementation of ::rot_open(). */
|
||||
int (*rot_close)(ROT *rot); /*!< Pointer to backend implementation of ::rot_close(). */
|
||||
|
||||
int (*set_conf)(ROT *rot, token_t token, const char *val); /*!< Pointer to backend implementation of ::rot_set_conf(). */
|
||||
int (*get_conf)(ROT *rot, token_t token, char *val); /*!< Pointer to backend implementation of ::rot_get_conf(). */
|
||||
int (*set_conf)(ROT *rot, hamlib_token_t token, const char *val); /*!< Pointer to backend implementation of ::rot_set_conf(). */
|
||||
int (*get_conf)(ROT *rot, hamlib_token_t token, char *val); /*!< Pointer to backend implementation of ::rot_get_conf(). */
|
||||
|
||||
/*
|
||||
* General API commands, from most primitive to least.. :()
|
||||
|
@ -441,19 +442,19 @@ struct rot_caps {
|
|||
int (*set_parm)(ROT *rot, setting_t parm, value_t val); /*!< Pointer to backend implementation of ::rot_set_parm(). */
|
||||
int (*get_parm)(ROT *rot, setting_t parm, value_t *val); /*!< Pointer to backend implementation of ::rot_get_parm(). */
|
||||
|
||||
int (*set_ext_level)(ROT *rot, token_t token, value_t val); /*!< Pointer to backend implementation of ::rot_set_ext_level(). */
|
||||
int (*get_ext_level)(ROT *rot, token_t token, value_t *val); /*!< Pointer to backend implementation of ::rot_get_ext_level(). */
|
||||
int (*set_ext_level)(ROT *rot, hamlib_token_t token, value_t val); /*!< Pointer to backend implementation of ::rot_set_ext_level(). */
|
||||
int (*get_ext_level)(ROT *rot, hamlib_token_t token, value_t *val); /*!< Pointer to backend implementation of ::rot_get_ext_level(). */
|
||||
|
||||
int (*set_ext_func)(ROT *rot, token_t token, int status); /*!< Pointer to backend implementation of ::rot_set_ext_func(). */
|
||||
int (*get_ext_func)(ROT *rot, token_t token, int *status); /*!< Pointer to backend implementation of ::rot_get_ext_func(). */
|
||||
int (*set_ext_func)(ROT *rot, hamlib_token_t token, int status); /*!< Pointer to backend implementation of ::rot_set_ext_func(). */
|
||||
int (*get_ext_func)(ROT *rot, hamlib_token_t token, int *status); /*!< Pointer to backend implementation of ::rot_get_ext_func(). */
|
||||
|
||||
int (*set_ext_parm)(ROT *rot, token_t token, value_t val); /*!< Pointer to backend implementation of ::rot_set_ext_parm(). */
|
||||
int (*get_ext_parm)(ROT *rot, token_t token, value_t *val); /*!< Pointer to backend implementation of ::rot_get_ext_parm(). */
|
||||
int (*set_ext_parm)(ROT *rot, hamlib_token_t token, value_t val); /*!< Pointer to backend implementation of ::rot_set_ext_parm(). */
|
||||
int (*get_ext_parm)(ROT *rot, hamlib_token_t token, value_t *val); /*!< Pointer to backend implementation of ::rot_get_ext_parm(). */
|
||||
|
||||
int (*get_status)(ROT *rot, rot_status_t *status); /*!< Pointer to backend implementation of ::rot_get_status(). */
|
||||
|
||||
const char *macro_name; /*!< Rotator model macro name. */
|
||||
int (*get_conf2)(ROT *rot, token_t token, char *val, int val_len); /*!< Pointer to backend implementation of ::rot_get_conf2(). */
|
||||
int (*get_conf2)(ROT *rot, hamlib_token_t token, char *val, int val_len); /*!< Pointer to backend implementation of ::rot_get_conf2(). */
|
||||
};
|
||||
//! @cond Doxygen_Suppress
|
||||
#define ROT_MODEL(arg) .rot_model=arg,.macro_name=#arg
|
||||
|
@ -544,16 +545,16 @@ rot_cleanup HAMLIB_PARAMS((ROT *rot));
|
|||
|
||||
extern HAMLIB_EXPORT(int)
|
||||
rot_set_conf HAMLIB_PARAMS((ROT *rot,
|
||||
token_t token,
|
||||
hamlib_token_t token,
|
||||
const char *val));
|
||||
extern HAMLIB_EXPORT(int)
|
||||
rot_get_conf HAMLIB_PARAMS((ROT *rot,
|
||||
token_t token,
|
||||
hamlib_token_t token,
|
||||
char *val));
|
||||
|
||||
extern HAMLIB_EXPORT(int)
|
||||
rot_get_conf2 HAMLIB_PARAMS((ROT *rot,
|
||||
token_t token,
|
||||
hamlib_token_t token,
|
||||
char *val,
|
||||
int val_len));
|
||||
|
||||
|
@ -635,29 +636,29 @@ rot_get_parm HAMLIB_PARAMS((ROT *rig,
|
|||
|
||||
extern HAMLIB_EXPORT(int)
|
||||
rot_set_ext_level HAMLIB_PARAMS((ROT *rig,
|
||||
token_t token,
|
||||
hamlib_token_t token,
|
||||
value_t val));
|
||||
extern HAMLIB_EXPORT(int)
|
||||
rot_get_ext_level HAMLIB_PARAMS((ROT *rig,
|
||||
token_t token,
|
||||
hamlib_token_t token,
|
||||
value_t *val));
|
||||
|
||||
extern HAMLIB_EXPORT(int)
|
||||
rot_set_ext_func HAMLIB_PARAMS((ROT *rig,
|
||||
token_t token,
|
||||
hamlib_token_t token,
|
||||
int status));
|
||||
extern HAMLIB_EXPORT(int)
|
||||
rot_get_ext_func HAMLIB_PARAMS((ROT *rig,
|
||||
token_t token,
|
||||
hamlib_token_t token,
|
||||
int *status));
|
||||
|
||||
extern HAMLIB_EXPORT(int)
|
||||
rot_set_ext_parm HAMLIB_PARAMS((ROT *rig,
|
||||
token_t token,
|
||||
hamlib_token_t token,
|
||||
value_t val));
|
||||
extern HAMLIB_EXPORT(int)
|
||||
rot_get_ext_parm HAMLIB_PARAMS((ROT *rig,
|
||||
token_t token,
|
||||
hamlib_token_t token,
|
||||
value_t *val));
|
||||
|
||||
extern HAMLIB_EXPORT(const char *)
|
||||
|
@ -700,7 +701,7 @@ extern HAMLIB_EXPORT(const struct confparams *)
|
|||
rot_confparam_lookup HAMLIB_PARAMS((ROT *rot,
|
||||
const char *name));
|
||||
|
||||
extern HAMLIB_EXPORT(token_t)
|
||||
extern HAMLIB_EXPORT(hamlib_token_t)
|
||||
rot_token_lookup HAMLIB_PARAMS((ROT *rot,
|
||||
const char *name));
|
||||
|
||||
|
@ -729,8 +730,8 @@ rot_ext_lookup HAMLIB_PARAMS((ROT *rot,
|
|||
|
||||
extern HAMLIB_EXPORT(const struct confparams *)
|
||||
rot_ext_lookup_tok HAMLIB_PARAMS((ROT *rot,
|
||||
token_t token));
|
||||
extern HAMLIB_EXPORT(token_t)
|
||||
hamlib_token_t token));
|
||||
extern HAMLIB_EXPORT(hamlib_token_t)
|
||||
rot_ext_token_lookup HAMLIB_PARAMS((ROT *rot,
|
||||
const char *name));
|
||||
|
||||
|
@ -797,6 +798,8 @@ extern HAMLIB_EXPORT(const char *) rot_strlevel(setting_t);
|
|||
extern HAMLIB_EXPORT(const char *) rot_strparm(setting_t);
|
||||
extern HAMLIB_EXPORT(const char *) rot_strstatus(rot_status_t);
|
||||
|
||||
extern HAMLIB_EXPORT(void *) rot_data_pointer(ROT *rot, rig_ptrx_t idx);
|
||||
|
||||
//! @endcond
|
||||
|
||||
/**
|
||||
|
|
|
@ -325,7 +325,9 @@
|
|||
#define ROT_MODEL_GS232B_EL ROT_MAKE_MODEL(ROT_GS232A, 12)
|
||||
#define ROT_MODEL_GS23_AZ ROT_MAKE_MODEL(ROT_GS232A, 13)
|
||||
|
||||
|
||||
#define ROT_ARRAYSOLUTIONS 7
|
||||
#define ROT_BACKEND ARRAYSOLUTIONS "arraysolutions"
|
||||
#define ROT_MODEL_ARRAYSOLUTIONS_SAL_12_20_30 ROT_MAKE_MODEL(ROT_ARRAYSOLUTIONS, 1)
|
||||
/**
|
||||
* \brief A macro that returns the model number of the PCROTOR backend.
|
||||
*
|
||||
|
@ -555,6 +557,7 @@
|
|||
#define ROT_MODEL_PROSISTEL_D_AZ ROT_MAKE_MODEL(ROT_PROSISTEL, 1)
|
||||
#define ROT_MODEL_PROSISTEL_D_EL ROT_MAKE_MODEL(ROT_PROSISTEL, 2)
|
||||
#define ROT_MODEL_PROSISTEL_COMBI_TRACK_AZEL ROT_MAKE_MODEL(ROT_PROSISTEL, 3)
|
||||
#define ROT_MODEL_PROSISTEL_D_EL_CBOXAZ ROT_MAKE_MODEL(ROT_PROSISTEL, 4)
|
||||
|
||||
|
||||
/**
|
||||
|
@ -634,9 +637,17 @@
|
|||
#define ROT_MODEL_ANDROIDSENSOR ROT_MAKE_MODEL(ROT_ANDROIDSENSOR, 1)
|
||||
|
||||
/**
|
||||
* \brief A macro that returns the model number of the GRBLTRK backend.
|
||||
* \brief A macro that returns the model number of the ROT_MODEL_GRBLTRK_SER backend.
|
||||
*
|
||||
* \def ROT_MODEL_GRBLTRK
|
||||
* \def ROT_MODEL_GRBLTRK_SER
|
||||
*
|
||||
* The GRBLTRK backend can be used with rotators that support the GRBL
|
||||
* protocol.
|
||||
*/
|
||||
/**
|
||||
* \brief A macro that returns the model number of the ROT_MODEL_GRBLTRK_NET backend.
|
||||
*
|
||||
* \def ROT_MODEL_GRBLTRK_NET
|
||||
*
|
||||
* The GRBLTRK backend can be used with rotators that support the GRBL
|
||||
* protocol.
|
||||
|
@ -648,6 +659,48 @@
|
|||
#define ROT_MODEL_GRBLTRK_SER ROT_MAKE_MODEL(ROT_GRBLTRK, 1)
|
||||
#define ROT_MODEL_GRBLTRK_NET ROT_MAKE_MODEL(ROT_GRBLTRK, 2)
|
||||
|
||||
/**
|
||||
* \brief A macro that returns the model number of the FLIR backend.
|
||||
*
|
||||
* \def ROT_MODEL_FLIR
|
||||
*
|
||||
* The FLIR backend can be used with FLIR and DirectedPercepition
|
||||
* rotators using the PTU protocol (e.g. PTU-D48). Currently only
|
||||
* the serial interface is supported and no ethernet.
|
||||
*/
|
||||
//! @cond Doxygen_Suppress
|
||||
#define ROT_FLIR 25
|
||||
#define ROT_BACKEND_FLIR "flir"
|
||||
//! @endcond
|
||||
#define ROT_MODEL_FLIR ROT_MAKE_MODEL(ROT_FLIR, 1)
|
||||
|
||||
/**
|
||||
* \brief A macro that returns the model number of the APEX backend.
|
||||
*
|
||||
* \def ROT_MODEL_APEX_SHARED_LOOP
|
||||
*
|
||||
* The APEX backend can be used with APEX * rotators.
|
||||
*/
|
||||
//! @cond Doxygen_Suppress
|
||||
#define ROT_APEX 26
|
||||
#define ROT_BACKEND_APEX "apex"
|
||||
//! @endcond
|
||||
#define ROT_MODEL_APEX_SHARED_LOOP ROT_MAKE_MODEL(ROT_APEX, 1)
|
||||
|
||||
/**
|
||||
* \brief A macro that returns the model number of the SAEBRTRACK backend.
|
||||
*
|
||||
* \def ROT_MODEL_SAEBRTRACK
|
||||
*
|
||||
* The SAEBRTRACK backend can be used with SAEBRTRACK * rotators.
|
||||
*/
|
||||
//! @cond Doxygen_Suppress
|
||||
#define ROT_SAEBRTRACK 27
|
||||
#define ROT_BACKEND_SAEBRTRACK "SAEBRTrack"
|
||||
//! @endcond
|
||||
#define ROT_MODEL_SAEBRTRACK ROT_MAKE_MODEL(ROT_SAEBRTRACK, 1)
|
||||
|
||||
|
||||
/**
|
||||
* \brief Convenience type definition for a rotator model.
|
||||
*
|
||||
|
|
429
mainwindow.cpp
429
mainwindow.cpp
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
** This file is part of the CatRadio project.
|
||||
** Copyright 2022 Gianfranco Sordetti IZ8EWD <iz8ewd@pianetaradio.it>.
|
||||
** Copyright 2022-2024 Gianfranco Sordetti IZ8EWD <iz8ewd@pianetaradio.it>.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
@ -40,6 +40,7 @@
|
|||
#include <QCoreApplication>
|
||||
#include <QDir>
|
||||
|
||||
#include <cwchar>
|
||||
#include <rig.h> //Hamlib
|
||||
|
||||
//RIG *my_rig;
|
||||
|
@ -57,6 +58,8 @@ int i; //Index
|
|||
int prevDial; //Previous dial value
|
||||
int fastDial; //Fast pushbutton state
|
||||
|
||||
const float fudge = 0.003;
|
||||
|
||||
FILE* debugFile;
|
||||
|
||||
|
||||
|
@ -79,13 +82,6 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
|
||||
timer = new QTimer(this); //timer for rigDaemon thread call
|
||||
|
||||
//* Debug
|
||||
rig_set_debug_level(RIG_DEBUG_WARN); //normal
|
||||
//rig_set_debug_level(RIG_DEBUG_TRACE); //debug
|
||||
rig_set_debug_time_stamp(true);
|
||||
if ((debugFile=fopen("catradio.log","w+")) == NULL) rig_set_debug_level(RIG_DEBUG_NONE);
|
||||
else rig_set_debug_file(debugFile);
|
||||
|
||||
//* Signal and Slot connection for Slider and associated Label
|
||||
connect(ui->verticalSlider_RFpower, &QAbstractSlider::valueChanged, ui->label_RFpowerValue, QOverload<int>::of(&QLabel::setNum));
|
||||
connect(ui->verticalSlider_RFgain, &QAbstractSlider::valueChanged, ui->label_RFgainValue, QOverload<int>::of(&QLabel::setNum));
|
||||
|
@ -110,19 +106,39 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
|
||||
//* Load settings from catradio.ini
|
||||
QSettings configFile(QString("catradio.ini"), QSettings::IniFormat);
|
||||
rigCom.rigModel = configFile.value("rigModel", 0).toInt();
|
||||
rigCom.rigModel = configFile.value("rigModel", 0).toUInt();
|
||||
rigCom.rigPort = configFile.value("rigPort").toString();
|
||||
rigCom.serialSpeed = configFile.value("serialSpeed", 9600).toInt();
|
||||
rigCom.serialSpeed = configFile.value("serialSpeed", 9600).toUInt();
|
||||
rigCom.civAddr = configFile.value("civAddress", 0).toInt();
|
||||
if (configFile.contains("serialDataBits")) //For backward compatibility with CatRadio v.< 1.4.0
|
||||
{
|
||||
rigCom.serialDataBits = configFile.value("serialDataBits", 8).toUInt();
|
||||
rigCom.serialParity = configFile.value("serialParity", 0).toUInt();
|
||||
rigCom.serialStopBits = configFile.value("serialStopBits", 2).toUInt();
|
||||
rigCom.serialHandshake = configFile.value("serialHandshake", 0).toUInt();
|
||||
}
|
||||
rigCom.netRigctl = configFile.value("netRigctl", false).toBool();
|
||||
rigCom.rigRefresh = configFile.value("rigRefresh", 100).toInt();
|
||||
rigCom.fullPoll = configFile.value("fullPolling", true).toBool();
|
||||
rigCom.autoConnect = configFile.value("autoConnect", false).toBool();
|
||||
rigCom.autoPowerOn = configFile.value("autoPowerOn", false).toBool();
|
||||
guiConf.vfoDisplayMode = configFile.value("vfoDisplayMode", 0).toInt();
|
||||
guiConf.darkTheme = configFile.value("darkTheme", false).toBool();
|
||||
guiConf.peakHold = configFile.value("peakHold", true).toBool();
|
||||
guiConf.debugMode = configFile.value("debugMode", false).toBool();
|
||||
//Window settings
|
||||
restoreGeometry(configFile.value("WindowSettings/geometry").toByteArray());
|
||||
restoreState(configFile.value("WindowSettings/state").toByteArray());
|
||||
|
||||
//* Debug
|
||||
if (guiConf.debugMode) rig_set_debug_level(RIG_DEBUG_VERBOSE); //debug verbose
|
||||
else rig_set_debug_level(RIG_DEBUG_WARN); //normal
|
||||
//rig_set_debug_level(RIG_DEBUG_VERBOSE); //debug verbose
|
||||
//rig_set_debug_level(RIG_DEBUG_TRACE); //debug trace
|
||||
rig_set_debug_time_stamp(true);
|
||||
if ((debugFile=fopen("catradio.log","w+")) == NULL) rig_set_debug_level(RIG_DEBUG_NONE);
|
||||
else rig_set_debug_file(debugFile);
|
||||
|
||||
//* Style
|
||||
//ui->pushButton_PTT->setStyleSheet("QPushButton::checked {font: bold; color: red;}");
|
||||
|
||||
|
@ -161,6 +177,35 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
//Light QFile darkStyleFile(":qdarkstyle/light/lightstyle.qss");
|
||||
|
||||
QApplication::setWheelScrollLines(10); //Mouse wheel scroll step
|
||||
|
||||
//* Init
|
||||
//Meter
|
||||
ui->progressBar_Smeter->setTx(false);
|
||||
ui->progressBar_Smeter->setMaxValue(100);
|
||||
ui->progressBar_Smeter->setGateValue(80);
|
||||
ui->progressBar_Smeter->setValue(-54);
|
||||
ui->progressBar_Smeter->resetPeakValue();
|
||||
ui->progressBar_Smeter->setPeakFactor(rigCom.rigRefresh/1000.0);
|
||||
ui->progressBar_subMeter->resetPeakValue();
|
||||
ui->progressBar_subMeter->setPeakFactor(rigCom.rigRefresh/1000.0);
|
||||
|
||||
//VFO
|
||||
ui->lineEdit_vfoMain->setValue(0);
|
||||
ui->lineEdit_vfoSub->setValue(0);
|
||||
|
||||
//Check Hamlib version
|
||||
if (!checkHamlibVersion(4, 6, 0))
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setWindowTitle("Hamlib");
|
||||
msgBox.setText("Please, update Hamlib libraries to version 4.6 or higher.");
|
||||
msgBox.setIcon(QMessageBox::Warning);
|
||||
msgBox.setStandardButtons(QMessageBox::Ok);
|
||||
msgBox.exec();
|
||||
}
|
||||
|
||||
//Auto connect
|
||||
if (rigCom.autoConnect) ui->pushButton_Connect->toggle();
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
|
@ -194,8 +239,8 @@ MainWindow::~MainWindow()
|
|||
void MainWindow::guiInit()
|
||||
{
|
||||
//* Power on/off cap
|
||||
//if (rig_has_set_func(my_rig, RIG_FUNCTION_SET_POWERSTAT)==0)
|
||||
if (my_rig->caps->set_powerstat == NULL)
|
||||
if (rig_has_set_func(my_rig, RIG_FUNCTION_SET_POWERSTAT)==0)
|
||||
//if (my_rig->caps->set_powerstat == NULL)
|
||||
{
|
||||
ui->pushButton_Power->setDisabled(true); //Power pushbutton disabled
|
||||
rigCap.onoff = 0;
|
||||
|
@ -207,8 +252,8 @@ void MainWindow::guiInit()
|
|||
}
|
||||
|
||||
//* PTT cap
|
||||
//if (rig_has_set_func(my_rig, RIG_FUNCTION_SET_PTT)==0)
|
||||
if (my_rig->caps->set_ptt == NULL)
|
||||
if (rig_has_set_func(my_rig, RIG_FUNCTION_SET_PTT)==0)
|
||||
//if (my_rig->caps->set_ptt == NULL)
|
||||
{
|
||||
ui->pushButton_PTT->setDisabled(true); //PTT pushbutton disabled
|
||||
rigCap.ptt = 0;
|
||||
|
@ -245,19 +290,30 @@ void MainWindow::guiInit()
|
|||
guiCmd.bwidthList = 1; //Command to populate BW combobox in guiUpdate()
|
||||
}
|
||||
|
||||
//* ANT comboBox
|
||||
ui->comboBox_Ant->clear();
|
||||
if (!rig_has_set_func(my_rig, RIG_FUNCTION_SET_ANT)) ui->comboBox_Ant->setEnabled(false);
|
||||
|
||||
//* AGC level comboBox
|
||||
ui->comboBox_AGC->clear();
|
||||
for (i = 0; i < HAMLIB_MAX_AGC_LEVELS && i < my_rig->caps->agc_level_count; i++) ui->comboBox_AGC->addItem(rig_stragclevel(my_rig->caps->agc_levels[i]));
|
||||
if (i==0) //Print all levels if list is not specified
|
||||
if (!rig_has_set_level(my_rig, RIG_LEVEL_AGC)) ui->comboBox_AGC->setEnabled(false);
|
||||
else
|
||||
{
|
||||
ui->comboBox_AGC->addItem(rig_stragclevel(RIG_AGC_OFF));
|
||||
ui->comboBox_AGC->addItem(rig_stragclevel(RIG_AGC_AUTO));
|
||||
ui->comboBox_AGC->addItem(rig_stragclevel(RIG_AGC_FAST));
|
||||
ui->comboBox_AGC->addItem(rig_stragclevel(RIG_AGC_MEDIUM));
|
||||
ui->comboBox_AGC->addItem(rig_stragclevel(RIG_AGC_SLOW));
|
||||
for (i = 0; i < HAMLIB_MAX_AGC_LEVELS && i < my_rig->state.agc_level_count; i++) ui->comboBox_AGC->addItem(rig_stragclevel(my_rig->state.agc_levels[i]));
|
||||
if (i==0) //Print all levels if list is not specified
|
||||
{
|
||||
ui->comboBox_AGC->addItem(rig_stragclevel(RIG_AGC_OFF));
|
||||
ui->comboBox_AGC->addItem(rig_stragclevel(RIG_AGC_AUTO));
|
||||
ui->comboBox_AGC->addItem(rig_stragclevel(RIG_AGC_FAST));
|
||||
ui->comboBox_AGC->addItem(rig_stragclevel(RIG_AGC_MEDIUM));
|
||||
ui->comboBox_AGC->addItem(rig_stragclevel(RIG_AGC_SLOW));
|
||||
}
|
||||
}
|
||||
|
||||
//* Meter comboBox
|
||||
//* Meters & Sub-meter comboBox
|
||||
//ui->progressBar_Smeter->setMaxValue(5); //FIXME tx_range_list
|
||||
ui->progressBar_Smeter->setPeak(guiConf.peakHold);
|
||||
ui->progressBar_subMeter->setPeak(guiConf.peakHold);
|
||||
ui->comboBox_Meter->clear();
|
||||
if (rig_has_get_level(my_rig, RIG_METER_SWR)) ui->comboBox_Meter->addItem("SWR");
|
||||
if (rig_has_get_level(my_rig, RIG_METER_ALC)) ui->comboBox_Meter->addItem("ALC");
|
||||
|
@ -266,9 +322,11 @@ void MainWindow::guiInit()
|
|||
if (rig_has_get_level(my_rig, RIG_METER_VDD)) ui->comboBox_Meter->addItem("VDD");
|
||||
rigSet.meter = levelmeterstr (ui->comboBox_Meter->currentText());
|
||||
setSubMeter();
|
||||
ui->label_hiSWR->setVisible(false);
|
||||
|
||||
//* Attenuator comboBox
|
||||
ui->comboBox_Att->clear();
|
||||
if (!rig_has_set_level(my_rig, RIG_LEVEL_ATT)) ui->comboBox_Att->setEnabled(false);
|
||||
ui->comboBox_Att->addItem("0");
|
||||
for (i = 0; i < HAMLIB_MAXDBLSTSIZ && my_rig->state.attenuator[i] != 0; i++)
|
||||
{
|
||||
|
@ -277,6 +335,7 @@ void MainWindow::guiInit()
|
|||
|
||||
//* Preamp comboBox
|
||||
ui->comboBox_Preamp->clear();
|
||||
if (!rig_has_set_level(my_rig, RIG_LEVEL_PREAMP)) ui->comboBox_Preamp->setEnabled(false);
|
||||
ui->comboBox_Preamp->addItem("0");
|
||||
for (i = 0; i < HAMLIB_MAXDBLSTSIZ && my_rig->state.preamp[i] != 0; i++)
|
||||
{
|
||||
|
@ -298,8 +357,44 @@ void MainWindow::guiInit()
|
|||
//* Filter
|
||||
if (!rig_has_set_func(my_rig, RIG_FUNC_NB)) ui->checkBox_NB->setEnabled(false);
|
||||
if (!rig_has_set_func(my_rig, RIG_FUNC_NB2)) ui->checkBox_NB2->setEnabled(false);
|
||||
if (!rig_has_set_func(my_rig, RIG_FUNC_NR)) {ui->checkBox_NR->setEnabled(false); ui->spinBox_NR->setEnabled(false);}
|
||||
if (!rig_has_set_func(my_rig, RIG_FUNC_ANF)) ui->checkBox_NF->setEnabled(false);
|
||||
if (rig_has_set_func(my_rig, RIG_FUNC_NR))
|
||||
{
|
||||
int max, min, step;
|
||||
|
||||
for (i = 0; i < RIG_SETTING_MAX; i++)
|
||||
{
|
||||
//qDebug()<<i<<rig_idx2setting(i)<<rig_strparm(rig_idx2setting(i));
|
||||
if (RIG_LEVEL_NR & rig_idx2setting(i)) break;
|
||||
}
|
||||
//qDebug()<<rig_strparm(RIG_LEVEL_NR & rig_idx2setting(i));
|
||||
//qDebug()<<i;
|
||||
|
||||
if (RIG_LEVEL_IS_FLOAT(rig_idx2setting(i))) //float 0..1
|
||||
{
|
||||
float stepf = 1/my_rig->state.level_gran[i].step.f;
|
||||
max = (int)(my_rig->state.level_gran[i].max.f*stepf+fudge);
|
||||
step = (int)(stepf+fudge);
|
||||
min = max-step+1;
|
||||
step = max/step;
|
||||
}
|
||||
else //integer
|
||||
{
|
||||
step = my_rig->state.level_gran[i].step.i;
|
||||
max = my_rig->state.level_gran[i].max.i;
|
||||
min = my_rig->state.level_gran[i].min.i;
|
||||
}
|
||||
//qDebug()<<max<<min<<step;
|
||||
|
||||
ui->spinBox_NR->setMaximum(max);
|
||||
ui->spinBox_NR->setMinimum(min);
|
||||
ui->spinBox_NR->setSingleStep(step);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->checkBox_NR->setEnabled(false);
|
||||
ui->spinBox_NR->setEnabled(false);
|
||||
}
|
||||
|
||||
//* Clarifier
|
||||
rigSet.rit = 1;
|
||||
|
@ -343,7 +438,7 @@ void MainWindow::guiInit()
|
|||
//}
|
||||
|
||||
//* Menu
|
||||
//ui->action_Command->setEnabled(true);
|
||||
ui->action_Command->setEnabled(true);
|
||||
ui->action_RadioInfo->setEnabled(true);
|
||||
|
||||
guiCmd.rangeList = 1; //update range list
|
||||
|
@ -355,7 +450,31 @@ void MainWindow::guiInit()
|
|||
void MainWindow::guiUpdate()
|
||||
{
|
||||
//* Power button
|
||||
if (rigGet.onoff == RIG_POWER_ON || rigGet.onoff == RIG_POWER_UNKNOWN) ui->pushButton_Power->setChecked(true);
|
||||
if (rigGet.onoff == RIG_POWER_ON)
|
||||
{
|
||||
ui->pushButton_Power->setChecked(true);
|
||||
//ui->pushButton_Power->setStyleSheet("QPushButton {color: limegreen;}");
|
||||
}
|
||||
else if (rigGet.onoff == RIG_POWER_OFF)
|
||||
{
|
||||
if(timer->isActive())
|
||||
{
|
||||
timer->stop();
|
||||
|
||||
ui->pushButton_Power->setChecked(false);
|
||||
//ui->pushButton_Power->setStyleSheet("");
|
||||
|
||||
//Reset Smeter
|
||||
rigGet.sMeter.i = -54;
|
||||
ui->progressBar_Smeter->resetPeakValue();
|
||||
|
||||
//Reset VFOs
|
||||
rigGet.freqMain = 0;
|
||||
rigGet.freqSub = 0;
|
||||
|
||||
ui->statusbar->showMessage("Radio off");
|
||||
}
|
||||
}
|
||||
|
||||
//* VFOs
|
||||
if (!rigCmd.freqMain) ui->lineEdit_vfoMain->setValue(rigGet.freqMain);
|
||||
|
@ -372,8 +491,8 @@ void MainWindow::guiUpdate()
|
|||
ui->label_vfoSub->setText(rig_strvfo(rigGet.vfoSub));
|
||||
|
||||
//* Mode
|
||||
ui->comboBox_Mode->setCurrentText(rig_strrmode(rigGet.mode));
|
||||
ui->comboBox_ModeSub->setCurrentText(rig_strrmode(rigGet.modeSub));
|
||||
if (!rigCmd.mode) ui->comboBox_Mode->setCurrentText(rig_strrmode(rigGet.mode));
|
||||
if (!rigCmd.modeSub) ui->comboBox_ModeSub->setCurrentText(rig_strrmode(rigGet.modeSub));
|
||||
|
||||
if (guiCmd.tabList) //Select appropriate mode function tab
|
||||
{
|
||||
|
@ -424,7 +543,7 @@ void MainWindow::guiUpdate()
|
|||
guiCmd.bwidthList = 0;
|
||||
}
|
||||
|
||||
ui->comboBox_BW->setCurrentText(QString::number(rigGet.bwidth));
|
||||
if (!rigCmd.bwidth) ui->comboBox_BW->setCurrentText(QString::number(rigGet.bwidth));
|
||||
ui->checkBox_NAR->setChecked(rigGet.bwNarrow);
|
||||
|
||||
//* Range list
|
||||
|
@ -432,6 +551,7 @@ void MainWindow::guiUpdate()
|
|||
{
|
||||
for (i=0; i<HAMLIB_FRQRANGESIZ; i++) //Tx range list
|
||||
{
|
||||
//qDebug()<<rigGet.freqMain<<my_rig->state.tx_range_list[i].startf<<my_rig->state.tx_range_list[i].endf;
|
||||
if (rigGet.freqMain >= my_rig->state.tx_range_list[i].startf && rigGet.freqMain <= my_rig->state.tx_range_list[i].endf) break;
|
||||
}
|
||||
rigGet.rangeListTxIndex = i;
|
||||
|
@ -450,7 +570,8 @@ void MainWindow::guiUpdate()
|
|||
if (guiCmd.antList)
|
||||
{
|
||||
ui->comboBox_Ant->clear();
|
||||
if (my_rig->state.tx_range_list[rigGet.rangeListRxIndex].ant == RIG_ANT_NONE) ui->comboBox_Ant->addItem("NONE"); //RIG_ANT_NONE
|
||||
if (!rig_has_get_func(my_rig, RIG_FUNCTION_GET_ANT)) ui->comboBox_Ant->addItem("");
|
||||
else if (my_rig->state.tx_range_list[rigGet.rangeListRxIndex].ant == RIG_ANT_NONE) ui->comboBox_Ant->addItem("NONE"); //RIG_ANT_NONE
|
||||
else for (i=0; i < RIG_ANT_MAX; i++)
|
||||
{
|
||||
if (my_rig->state.tx_range_list[rigGet.rangeListRxIndex].ant & (1UL << i))
|
||||
|
@ -498,10 +619,10 @@ void MainWindow::guiUpdate()
|
|||
}
|
||||
|
||||
//* RF
|
||||
ui->radioButton_Tuner->setChecked(rigGet.tuner);
|
||||
ui->comboBox_AGC->setCurrentText(rig_stragclevel(rigGet.agc));
|
||||
ui->comboBox_Att->setCurrentText(QString::number(rigGet.att));
|
||||
ui->comboBox_Preamp->setCurrentText(QString::number(rigGet.pre));
|
||||
if (!rigCmd.tuner) ui->radioButton_Tuner->setChecked(rigGet.tuner);
|
||||
if (!rigCmd.agc) ui->comboBox_AGC->setCurrentText(rig_stragclevel(rigGet.agc));
|
||||
if (!rigCmd.att) ui->comboBox_Att->setCurrentText(QString::number(rigGet.att));
|
||||
if (!rigCmd.pre) ui->comboBox_Preamp->setCurrentText(QString::number(rigGet.pre));
|
||||
|
||||
//* Split
|
||||
if (rigGet.split == RIG_SPLIT_ON)
|
||||
|
@ -529,50 +650,63 @@ void MainWindow::guiUpdate()
|
|||
if (rigGet.ptt == RIG_PTT_ON)
|
||||
{
|
||||
//ui->pushButton_PTT->setChecked(true);
|
||||
|
||||
if (rigGet.vfoTx == rigGet.vfoSub) ui->label_vfoSub->setStyleSheet("QLabel {background-color: red}");
|
||||
else ui->label_vfoMain->setStyleSheet("QLabel {background-color: red}");
|
||||
|
||||
ui->progressBar_Smeter->setTx(true);
|
||||
if (!ui->progressBar_Smeter->getTx())
|
||||
{
|
||||
ui->progressBar_Smeter->setTx(true);
|
||||
ui->progressBar_Smeter->setValue(0);
|
||||
ui->progressBar_Smeter->resetPeakValue();
|
||||
}
|
||||
ui->progressBar_Smeter->setValue(rigGet.powerMeter.f*100);
|
||||
ui->progressBar_subMeter->setValue(rigGet.subMeter.f);
|
||||
if (rigGet.hiSWR.f > 2) ui->label_hiSWR->setVisible(true);
|
||||
}
|
||||
else //RIG_PTT_OFF
|
||||
{
|
||||
//ui->pushButton_PTT->setChecked(false);
|
||||
|
||||
if (rigGet.vfoTx == rigGet.vfoSub) ui->label_vfoSub->setStyleSheet("QLabel {}");
|
||||
else ui->label_vfoMain->setStyleSheet("QLabel {}");
|
||||
|
||||
ui->progressBar_Smeter->setTx(false);
|
||||
if (ui->progressBar_Smeter->getTx())
|
||||
{
|
||||
ui->progressBar_Smeter->setTx(false);
|
||||
ui->progressBar_Smeter->setValue(-54);
|
||||
ui->progressBar_Smeter->resetPeakValue();
|
||||
ui->label_hiSWR->setVisible(false);
|
||||
//if (rigSet.meter == RIG_LEVEL_SWR) ui->progressBar_subMeter->setValue(1.0);
|
||||
//else ui->progressBar_subMeter->setValue(0.0);
|
||||
//ui->progressBar_subMeter->resetPeakValue();
|
||||
}
|
||||
ui->progressBar_Smeter->setValue(rigGet.sMeter.i);
|
||||
if (rigSet.meter == RIG_LEVEL_SWR) ui->progressBar_subMeter->setValue(1.0);
|
||||
else ui->progressBar_subMeter->setValue(0.0);
|
||||
}
|
||||
|
||||
//* Levels
|
||||
if (!ui->verticalSlider_RFpower->isSliderDown() && !rigCmd.rfPower) ui->verticalSlider_RFpower->setValue((int)(rigGet.rfPower*100));
|
||||
if (!ui->verticalSlider_RFgain->isSliderDown() && !rigCmd.rfGain) ui->verticalSlider_RFgain->setValue((int)(rigGet.rfGain*100));
|
||||
if (!ui->verticalSlider_AFGain->isSliderDown() && !rigCmd.afGain) ui->verticalSlider_AFGain->setValue((int)(rigGet.afGain*100));
|
||||
if (!ui->verticalSlider_Squelch->isSliderDown() && !rigCmd.squelch) ui->verticalSlider_Squelch->setValue((int)(rigGet.squelch*100));
|
||||
if (!ui->verticalSlider_RFpower->isSliderDown() && !rigCmd.rfPower) ui->verticalSlider_RFpower->setValue((int)(rigGet.rfPower*100+fudge));
|
||||
if (!ui->verticalSlider_RFgain->isSliderDown() && !rigCmd.rfGain) ui->verticalSlider_RFgain->setValue((int)(rigGet.rfGain*100+fudge));
|
||||
if (!ui->verticalSlider_AFGain->isSliderDown() && !rigCmd.afGain) ui->verticalSlider_AFGain->setValue((int)(rigGet.afGain*100+fudge));
|
||||
if (!ui->verticalSlider_Squelch->isSliderDown() && !rigCmd.squelch) ui->verticalSlider_Squelch->setValue((int)(rigGet.squelch*100+fudge));
|
||||
|
||||
//* MIC
|
||||
if (!ui->verticalSlider_micGain->isSliderDown() && !rigCmd.micGain) ui->verticalSlider_micGain->setValue((int)(rigGet.micGain*100));
|
||||
if (!ui->verticalSlider_micMonitor->isSliderDown() && !rigCmd.micMonLevel) ui->verticalSlider_micMonitor->setValue((int)(rigGet.micMonLevel*100));
|
||||
if (!ui->verticalSlider_micCompressor->isSliderDown() && !rigCmd.micCompLevel) ui->verticalSlider_micCompressor->setValue((int)(rigGet.micCompLevel*100));
|
||||
ui->checkBox_micCompressor->setChecked(rigGet.micComp);
|
||||
ui->checkBox_micMonitor->setChecked(rigGet.micMon);
|
||||
if (!ui->verticalSlider_micGain->isSliderDown() && !rigCmd.micGain) ui->verticalSlider_micGain->setValue((int)(rigGet.micGain*100+fudge));
|
||||
if (!ui->verticalSlider_micMonitor->isSliderDown() && !rigCmd.micMonLevel) ui->verticalSlider_micMonitor->setValue((int)(rigGet.micMonLevel*100+fudge));
|
||||
if (!ui->verticalSlider_micCompressor->isSliderDown() && !rigCmd.micCompLevel) ui->verticalSlider_micCompressor->setValue((int)(rigGet.micCompLevel*100+fudge));
|
||||
if (!rigCmd.micComp) ui->checkBox_micCompressor->setChecked(rigGet.micComp);
|
||||
if (!rigCmd.micMon) ui->checkBox_micMonitor->setChecked(rigGet.micMon);
|
||||
|
||||
//* Filter
|
||||
ui->checkBox_NB->setChecked(rigGet.noiseBlanker);
|
||||
ui->checkBox_NB2->setChecked(rigGet.noiseBlanker2);
|
||||
ui->checkBox_NR->setChecked(rigGet.noiseReduction);
|
||||
ui->spinBox_NR->setValue(rigGet.noiseReductionLevel);
|
||||
ui->checkBox_NF->setChecked(rigGet.notchFilter);
|
||||
if (!rigCmd.noiseBlanker) ui->checkBox_NB->setChecked(rigGet.noiseBlanker);
|
||||
if (!rigCmd.noiseBlanker2) ui->checkBox_NB2->setChecked(rigGet.noiseBlanker2);
|
||||
if (!rigCmd.noiseReduction) ui->checkBox_NR->setChecked(rigGet.noiseReduction);
|
||||
if (!rigCmd.noiseReductionLevel) ui->spinBox_NR->setValue((int)(rigGet.noiseReductionLevel*ui->spinBox_NR->maximum()+fudge));
|
||||
if (!rigCmd.notchFilter) ui->checkBox_NF->setChecked(rigGet.notchFilter);
|
||||
if (!ui->horizontalSlider_IFshift->isSliderDown() && !rigCmd.ifShift) ui->horizontalSlider_IFshift->setValue(rigGet.ifShift);
|
||||
|
||||
//* Clarifier
|
||||
ui->checkBox_clar->setChecked(rigGet.clar);
|
||||
if (!rigCmd.clar) ui->checkBox_clar->setChecked(rigGet.clar);
|
||||
if (rigSet.xit)
|
||||
{
|
||||
ui->radioButton_clarXIT->setChecked(true);
|
||||
|
@ -585,15 +719,15 @@ void MainWindow::guiUpdate()
|
|||
}
|
||||
|
||||
//* CW
|
||||
ui->checkBox_BKIN->setChecked(rigGet.bkin);
|
||||
ui->checkBox_APF->setChecked(rigGet.apf);
|
||||
ui->spinBox_WPM->setValue(rigGet.wpm);
|
||||
if (!rigCmd.bkin) ui->checkBox_BKIN->setChecked(rigGet.bkin);
|
||||
if (!rigCmd.apf) ui->checkBox_APF->setChecked(rigGet.apf);
|
||||
if (!rigCmd.wpm) ui->spinBox_WPM->setValue(rigGet.wpm);
|
||||
|
||||
//* FM
|
||||
if (rigGet.rptShift == RIG_RPT_SHIFT_MINUS) ui->radioButton_RPTshiftMinus->setChecked(true); //-
|
||||
else if (rigGet.rptShift == RIG_RPT_SHIFT_PLUS) ui->radioButton_RPTshiftPlus->setChecked(true); //+
|
||||
if (rigGet.rptShift == RIG_RPT_SHIFT_MINUS && !rigCmd.rptShift) ui->radioButton_RPTshiftMinus->setChecked(true); //-
|
||||
else if (rigGet.rptShift == RIG_RPT_SHIFT_PLUS && !rigCmd.rptShift) ui->radioButton_RPTshiftPlus->setChecked(true); //+
|
||||
else ui->radioButton_RPTshiftSimplex->setChecked(true); //Simplex
|
||||
ui->spinBox_RPToffset->setValue(rigGet.rptOffset/1000); //Offset (kHz)
|
||||
if (!rigCmd.rptOffset) ui->spinBox_RPToffset->setValue(rigGet.rptOffset/1000); //Offset (kHz)
|
||||
|
||||
switch (rigGet.toneType)
|
||||
{
|
||||
|
@ -604,7 +738,7 @@ void MainWindow::guiUpdate()
|
|||
default: ui->comboBox_toneType->setCurrentText(""); break;
|
||||
}
|
||||
|
||||
if (rigGet.toneType == 2 || rigGet.toneType ==3) ui->comboBox_toneFreq->setCurrentText(QString::number(rigGet.tone/10.0)); //CTCSS
|
||||
if (rigGet.toneType == 2 || rigGet.toneType == 3) ui->comboBox_toneFreq->setCurrentText(QString::number(rigGet.tone/10.0)); //CTCSS
|
||||
else if (rigGet.toneType == 4) ui->comboBox_toneFreq->setCurrentText(QString::number(rigGet.tone)); //DCS
|
||||
}
|
||||
|
||||
|
@ -675,6 +809,34 @@ void MainWindow::setSubMeter()
|
|||
ui->progressBar_subMeter->setShortStep(0.1);
|
||||
ui->progressBar_subMeter->setValue(0);
|
||||
}
|
||||
|
||||
ui->progressBar_subMeter->resetPeakValue();
|
||||
}
|
||||
|
||||
|
||||
bool MainWindow::checkHamlibVersion(int major, int minor, int revision)
|
||||
{
|
||||
QString hamlibVer = rig_version();
|
||||
QRegularExpression hamlibVerExp("(?P<major>\\d)\\.(?P<minor>\\d)\\.?(?P<revision>\\d)?");
|
||||
|
||||
QRegularExpressionMatch hamlibVerMatch = hamlibVerExp.match(hamlibVer);
|
||||
|
||||
if (hamlibVerMatch.hasMatch())
|
||||
{
|
||||
int majorVer = hamlibVerMatch.captured("major").toInt();
|
||||
int minorVer = hamlibVerMatch.captured("minor").toInt();
|
||||
int revisionVer = hamlibVerMatch.captured("revision").toInt();
|
||||
|
||||
//qDebug()<<majorVer<<minorVer<<revisionVer;
|
||||
|
||||
if (majorVer > major) return true;
|
||||
else if (majorVer < major) return false;
|
||||
else if (minorVer > minor) return true; //& majorVer=major
|
||||
else if (minorVer < minor) return false; //& majorVer=major
|
||||
else if (revisionVer < revision) return false; //& majorVer=major, minorVer=minor
|
||||
else return true; //revisionVer>=revision & majorVer=major, minorVer=minor
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -702,17 +864,40 @@ void MainWindow::on_pushButton_Connect_toggled(bool checked)
|
|||
rigCom.connected = 1;
|
||||
guiInit();
|
||||
connectMsg = "Connected to ";
|
||||
connectMsg.append(my_rig->caps->model_name);
|
||||
if (rigCap.onoff == 0 || rigGet.onoff == RIG_POWER_ON || rigGet.onoff == RIG_POWER_UNKNOWN) timer->start(rigCom.rigRefresh);
|
||||
connectMsg.append(my_rig->state.model_name);
|
||||
if (rigCap.onoff == 0 || rigGet.onoff == RIG_POWER_ON || rigGet.onoff == RIG_POWER_UNKNOWN)
|
||||
{
|
||||
freq_t retfreq;
|
||||
retcode = rig_get_freq(my_rig, RIG_VFO_CURR, &retfreq); //double check if rig is on, by getting the current frequency
|
||||
if (retcode==RIG_OK && retfreq!=0)
|
||||
{
|
||||
rigGet.onoff = RIG_POWER_ON; //force it for rigCap.onoff = 0 || rigGet.onoff = RIG_POWER_UNKNOWN
|
||||
timer->start(rigCom.rigRefresh);
|
||||
}
|
||||
else rigGet.onoff = RIG_POWER_OFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (rigCom.connected) //Button unchecked
|
||||
{
|
||||
rigCom.connected = 0;
|
||||
timer->stop();
|
||||
rig_close(my_rig); //Close the communication to the rig
|
||||
connectMsg = "Disconnected";
|
||||
//rig_cleanup(my_rig); //Release rig handle and free associated memory
|
||||
if (rigSet.ptt == RIG_PTT_OFF) //Disconnect only if PTT off
|
||||
{
|
||||
rigCom.connected = 0;
|
||||
if(timer->isActive()) timer->stop();
|
||||
rig_close(my_rig); //Close the communication to the rig
|
||||
connectMsg = "Disconnected";
|
||||
//rig_cleanup(my_rig); //Release rig handle and free associated memory
|
||||
|
||||
//Reset meters
|
||||
ui->progressBar_Smeter->setValue(-54);
|
||||
ui->progressBar_Smeter->resetPeakValue();
|
||||
setSubMeter();
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->pushButton_Connect->setChecked(false); //Uncheck the button
|
||||
connectMsg = "Warning PTT on!";
|
||||
}
|
||||
}
|
||||
|
||||
ui->statusbar->showMessage(connectMsg);
|
||||
|
@ -728,16 +913,16 @@ void MainWindow::on_pushButton_Power_toggled(bool checked)
|
|||
ui->pushButton_Power->setChecked(false); //Uncheck the button
|
||||
ui->statusbar->showMessage(rigerror(retcode));
|
||||
}
|
||||
else timer->start(rigCom.rigRefresh);
|
||||
else
|
||||
{
|
||||
rigGet.onoff = RIG_POWER_ON;
|
||||
timer->start(rigCom.rigRefresh);
|
||||
}
|
||||
}
|
||||
else if (!checked && rigGet.onoff)
|
||||
{
|
||||
retcode = rig_set_powerstat(my_rig, RIG_POWER_OFF);
|
||||
if (retcode == RIG_OK)
|
||||
{
|
||||
ui->pushButton_Power->setChecked(false); //Uncheck the button
|
||||
timer->stop();
|
||||
}
|
||||
rigCmd.onoff = 1;
|
||||
//Note: the onoff command works only if the PTT is off (see rigdaemon.cpp)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -893,6 +1078,32 @@ void MainWindow::on_pushButton_BandUp_clicked()
|
|||
rigCmd.bandUp = 1;
|
||||
}
|
||||
|
||||
void MainWindow::on_pushButton_CW1_clicked()
|
||||
{
|
||||
send_cw_mem(1);
|
||||
}
|
||||
|
||||
void MainWindow::on_pushButton_CW2_clicked()
|
||||
{
|
||||
send_cw_mem(2);
|
||||
}
|
||||
|
||||
void MainWindow::on_pushButton_CW3_clicked()
|
||||
{
|
||||
send_cw_mem(3);
|
||||
}
|
||||
|
||||
void MainWindow::on_pushButton_CW4_clicked()
|
||||
{
|
||||
send_cw_mem(4);
|
||||
}
|
||||
|
||||
void MainWindow::on_pushButton_CW5_clicked()
|
||||
{
|
||||
send_cw_mem(5);
|
||||
}
|
||||
|
||||
|
||||
//***** CheckBox *****
|
||||
void MainWindow::on_checkBox_micCompressor_toggled(bool checked)
|
||||
{
|
||||
|
@ -1139,44 +1350,65 @@ void MainWindow::on_vfoDisplaySubValueChanged(int value)
|
|||
|
||||
void MainWindow::on_comboBox_Mode_activated(int index)
|
||||
{
|
||||
rigSet.mode = rig_parse_mode(ui->comboBox_Mode->itemText(index).toLatin1());
|
||||
rigCmd.mode = 1;
|
||||
if (!rigCmd.mode)
|
||||
{
|
||||
rigSet.mode = rig_parse_mode(ui->comboBox_Mode->itemText(index).toLatin1());
|
||||
rigCmd.mode = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_comboBox_ModeSub_activated(int index)
|
||||
{
|
||||
rigSet.modeSub = rig_parse_mode(ui->comboBox_ModeSub->itemText(index).toLatin1());
|
||||
rigCmd.modeSub = 1;
|
||||
if (!rigCmd.modeSub)
|
||||
{
|
||||
rigSet.modeSub = rig_parse_mode(ui->comboBox_ModeSub->itemText(index).toLatin1());
|
||||
rigCmd.modeSub = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_comboBox_BW_activated(int index)
|
||||
{
|
||||
rigSet.bwidth = ui->comboBox_BW->itemText(index).toInt();
|
||||
rigCmd.bwidth = 1;
|
||||
if (!rigCmd.bwidth)
|
||||
{
|
||||
rigSet.bwidth = ui->comboBox_BW->itemText(index).toInt();
|
||||
rigCmd.bwidth = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_comboBox_AGC_activated(int index)
|
||||
{
|
||||
rigSet.agc = levelagcstr(ui->comboBox_AGC->itemText(index));
|
||||
rigCmd.agc = 1;
|
||||
if (!rigCmd.agc)
|
||||
{
|
||||
rigSet.agc = levelagcstr(ui->comboBox_AGC->itemText(index));
|
||||
rigCmd.agc = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_comboBox_Att_activated(int index)
|
||||
{
|
||||
rigSet.att = ui->comboBox_Att->itemText(index).toInt();
|
||||
rigCmd.att = 1;
|
||||
if (!rigCmd.att)
|
||||
{
|
||||
rigSet.att = ui->comboBox_Att->itemText(index).toInt();
|
||||
rigCmd.att = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_comboBox_Preamp_activated(int index)
|
||||
{
|
||||
rigSet.pre = ui->comboBox_Preamp->itemText(index).toInt();
|
||||
rigCmd.pre = 1;
|
||||
if (!rigCmd.pre)
|
||||
{
|
||||
rigSet.pre = ui->comboBox_Preamp->itemText(index).toInt();
|
||||
rigCmd.pre = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_comboBox_Ant_activated(int index)
|
||||
{
|
||||
rigSet.ant = antstr(ui->comboBox_Ant->itemText(index));
|
||||
rigCmd.ant = 1;
|
||||
if (!rigCmd.ant)
|
||||
{
|
||||
rigSet.ant = antstr(ui->comboBox_Ant->itemText(index));
|
||||
rigCmd.ant = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_comboBox_Meter_activated(int index)
|
||||
|
@ -1217,20 +1449,29 @@ void MainWindow::on_comboBox_toneFreq_activated(int index)
|
|||
|
||||
void MainWindow::on_spinBox_NR_valueChanged(int arg1)
|
||||
{
|
||||
rigSet.noiseReductionLevel = arg1;
|
||||
rigCmd.noiseReductionLevel = 1;
|
||||
if (!rigCmd.noiseReductionLevel)
|
||||
{
|
||||
rigSet.noiseReductionLevel = (float)(arg1) / ui->spinBox_NR->maximum();
|
||||
rigCmd.noiseReductionLevel = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_spinBox_WPM_valueChanged(int arg1)
|
||||
{
|
||||
rigSet.wpm = arg1;
|
||||
rigCmd.wpm = 1;
|
||||
if (!rigCmd.wpm)
|
||||
{
|
||||
rigSet.wpm = arg1;
|
||||
rigCmd.wpm = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_spinBox_RPToffset_valueChanged(int arg1)
|
||||
{
|
||||
rigSet.rptOffset = arg1*1000;
|
||||
rigCmd.rptOffset = 1;
|
||||
if (!rigCmd.rptOffset)
|
||||
{
|
||||
rigSet.rptOffset = arg1*1000;
|
||||
rigCmd.rptOffset = 1;
|
||||
}
|
||||
}
|
||||
|
||||
//***** Slider *****
|
||||
|
@ -1472,7 +1713,7 @@ void MainWindow::on_action_AboutCatRadio_triggered()
|
|||
msgBox.setTextFormat(Qt::RichText);
|
||||
QString version = QString::number(VERSION_MAJ)+"."+QString::number(VERSION_MIN)+"."+QString::number(VERSION_MIC);
|
||||
msgBox.setText("<b>CatRadio</b> <i>Radio control software</i><br/>version "+version+" "+RELEASE_DATE);
|
||||
msgBox.setInformativeText("<p>Copyright (C) 2022 Gianfranco Sordetti IZ8EWD<br/>"
|
||||
msgBox.setInformativeText("<p>Copyright (C) 2022-2024 Gianfranco Sordetti IZ8EWD<br/>"
|
||||
"<a href='https://www.pianetaradio.it' style='color: #668fb8'>www.pianetaradio.it</a></p>"
|
||||
"<p>This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.<br/>"
|
||||
"This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.<br/>"
|
||||
|
|
18
mainwindow.h
18
mainwindow.h
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
** This file is part of the CatRadio project.
|
||||
** Copyright 2022 Gianfranco Sordetti IZ8EWD <iz8ewd@pianetaradio.it>.
|
||||
** Copyright 2022-2024 Gianfranco Sordetti IZ8EWD <iz8ewd@pianetaradio.it>.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
@ -27,8 +27,8 @@
|
|||
|
||||
#define RELEASE_DATE __DATE__
|
||||
#define VERSION_MAJ 1
|
||||
#define VERSION_MIN 3
|
||||
#define VERSION_MIC 0
|
||||
#define VERSION_MIN 4
|
||||
#define VERSION_MIC 1
|
||||
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
@ -212,6 +212,16 @@ private slots:
|
|||
|
||||
void on_action_AboutDarkTheme_triggered();
|
||||
|
||||
void on_pushButton_CW1_clicked();
|
||||
|
||||
void on_pushButton_CW2_clicked();
|
||||
|
||||
void on_pushButton_CW3_clicked();
|
||||
|
||||
void on_pushButton_CW4_clicked();
|
||||
|
||||
void on_pushButton_CW5_clicked();
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
QTimer *timer;
|
||||
|
@ -220,6 +230,8 @@ private:
|
|||
|
||||
void guiInit();
|
||||
void setSubMeter();
|
||||
|
||||
bool checkHamlibVersion(int major, int minor, int revision);
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
|
|
130
mainwindow.ui
130
mainwindow.ui
|
@ -204,7 +204,7 @@
|
|||
<rect>
|
||||
<x>200</x>
|
||||
<y>10</y>
|
||||
<width>40</width>
|
||||
<width>51</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -217,7 +217,7 @@
|
|||
<rect>
|
||||
<x>430</x>
|
||||
<y>10</y>
|
||||
<width>40</width>
|
||||
<width>51</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -882,7 +882,7 @@
|
|||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>15</number>
|
||||
<number>10</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -1129,7 +1129,7 @@
|
|||
<widget class="SubMeter" name="progressBar_subMeter" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>250</x>
|
||||
<x>240</x>
|
||||
<y>0</y>
|
||||
<width>161</width>
|
||||
<height>61</height>
|
||||
|
@ -1146,6 +1146,19 @@
|
|||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_hiSWR">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>410</x>
|
||||
<y>0</y>
|
||||
<width>63</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Hi SWR</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QTabWidget" name="tabWidget_level">
|
||||
<property name="geometry">
|
||||
|
@ -1874,6 +1887,49 @@
|
|||
<string>CW</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="pushButton_CW2">
|
||||
<property name="text">
|
||||
<string>2</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>2</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QSpinBox" name="spinBox_WPM">
|
||||
<property name="minimum">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>60</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>20</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<widget class="QPushButton" name="pushButton_CW4">
|
||||
<property name="text">
|
||||
<string>4</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>4</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QPushButton" name="pushButton_CW3">
|
||||
<property name="text">
|
||||
<string>3</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>3</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="checkBox_BKIN">
|
||||
<property name="toolTip">
|
||||
|
@ -1885,30 +1941,36 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_WPM">
|
||||
<property name="text">
|
||||
<string>WPM</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBox_WPM">
|
||||
<property name="minimum">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>60</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>20</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<widget class="QLabel" name="label_WPM">
|
||||
<property name="text">
|
||||
<string>WPM</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="pushButton_CW1">
|
||||
<property name="text">
|
||||
<string>1</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>1</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="5">
|
||||
<widget class="QPushButton" name="pushButton_CW5">
|
||||
<property name="text">
|
||||
<string>5</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>5</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="5">
|
||||
<widget class="QCheckBox" name="checkBox_APF">
|
||||
<property name="toolTip">
|
||||
<string>Audio Peak Filter</string>
|
||||
|
@ -1918,6 +1980,19 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_FM">
|
||||
|
@ -1966,6 +2041,9 @@
|
|||
<property name="maximum">
|
||||
<number>10000</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>100</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
** This file is part of the CatRadio project.
|
||||
** Copyright 2022 Gianfranco Sordetti IZ8EWD <iz8ewd@pianetaradio.it>.
|
||||
** Copyright 2022-2024 Gianfranco Sordetti IZ8EWD <iz8ewd@pianetaradio.it>.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
@ -29,6 +29,7 @@ extern rigSettings rigSet;
|
|||
extern rigCommand rigCmd;
|
||||
extern rigCommand rigCap;
|
||||
|
||||
//* Set band to default frequency or use band change if radio has capability
|
||||
void set_band (int band)
|
||||
{
|
||||
if (rigCap.bandChange==0)
|
||||
|
@ -84,6 +85,7 @@ void set_band (int band)
|
|||
}
|
||||
}
|
||||
|
||||
//* Set split to 5kHz and activate it
|
||||
void quick_split ()
|
||||
{
|
||||
rigSet.freqSub = rigGet.freqMain + 5000;
|
||||
|
@ -94,6 +96,14 @@ void quick_split ()
|
|||
rigCmd.split = 1;
|
||||
}
|
||||
|
||||
//* Send CW keyer message 1-5
|
||||
void send_cw_mem (int memory)
|
||||
{
|
||||
rigSet.cwMem = (char)(memory + '0');
|
||||
rigCmd.cwSend = 1;
|
||||
}
|
||||
|
||||
//* Convert AGC int value to hamlib enumerated
|
||||
agc_level_e levelagcvalue (int agcValue)
|
||||
{
|
||||
agc_level_e agcLevel;
|
||||
|
@ -113,6 +123,7 @@ agc_level_e levelagcvalue (int agcValue)
|
|||
return agcLevel;
|
||||
}
|
||||
|
||||
//* Convert AGC string to hamlib enumerated
|
||||
agc_level_e levelagcstr (QString agcString)
|
||||
{
|
||||
agc_level_e agcLevel;
|
||||
|
@ -128,6 +139,7 @@ agc_level_e levelagcstr (QString agcString)
|
|||
return agcLevel;
|
||||
}
|
||||
|
||||
//* Convert AGC hamlib enumerated to hamlib value_t
|
||||
value_t valueagclevel (agc_level_e agcLevel)
|
||||
{
|
||||
value_t value;
|
||||
|
@ -143,6 +155,7 @@ value_t valueagclevel (agc_level_e agcLevel)
|
|||
return value;
|
||||
}
|
||||
|
||||
//* Convert antenna string to hamlib ant_t
|
||||
ant_t antstr (QString antString)
|
||||
{
|
||||
ant_t ant;
|
||||
|
@ -160,6 +173,7 @@ ant_t antstr (QString antString)
|
|||
return ant;
|
||||
}
|
||||
|
||||
//* Convert Submeter combo box string into hamlib RIG_LEVEL constant
|
||||
unsigned long long levelmeterstr (QString meterString)
|
||||
{
|
||||
unsigned long long levelMeter;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
** This file is part of the CatRadio project.
|
||||
** Copyright 2022 Gianfranco Sordetti IZ8EWD <iz8ewd@pianetaradio.it>.
|
||||
** Copyright 2022-2024 Gianfranco Sordetti IZ8EWD <iz8ewd@pianetaradio.it>.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
@ -29,8 +29,9 @@
|
|||
|
||||
void set_band (int band);
|
||||
void quick_split ();
|
||||
void send_cw_mem (int memory);
|
||||
agc_level_e levelagcvalue (int agcValue);
|
||||
agc_level_e levelagcstr (QString agcString);
|
||||
value_t valueagclevel (agc_level_e agcLevel);
|
||||
ant_t antstr (QString antString);
|
||||
unsigned long long levelmeterstr (QString meterString); //Convert Submeter combo box string into Hamlib RIG_LEVEL constant
|
||||
unsigned long long levelmeterstr (QString meterString);
|
||||
|
|
150
rigdaemon.cpp
150
rigdaemon.cpp
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
** This file is part of the CatRadio project.
|
||||
** Copyright 2022 Gianfranco Sordetti IZ8EWD <iz8ewd@pianetaradio.it>.
|
||||
** Copyright 2022-2024 Gianfranco Sordetti IZ8EWD <iz8ewd@pianetaradio.it>.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
@ -61,21 +61,23 @@ RIG *RigDaemon::rigConnect(int *retcode)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (rigCom.rigModel == 2) //Rigctld
|
||||
//if (rigCom.rigModel == 2) //Rigctld
|
||||
if (my_rig->state.port_type == RIG_PORT_NETWORK)
|
||||
{
|
||||
//myport.type.rig = RIG_PORT_NETWORK;
|
||||
strncpy(my_rig->state.rigport.pathname, rigCom.rigPort.toLatin1(), HAMLIB_FILPATHLEN - 1);
|
||||
my_rig->state.vfo_opt = 1;
|
||||
//strncpy(my_rig->state.rigport.pathname, RIG_FILE, HAMLIB_FILPATHLEN - 1);
|
||||
}
|
||||
else
|
||||
else //RIG_PORT_SERIAL
|
||||
{
|
||||
//myport.type.rig = RIG_PORT_SERIAL;
|
||||
strncpy(my_rig->state.rigport.pathname, rigCom.rigPort.toLatin1(), HAMLIB_FILPATHLEN - 1);
|
||||
my_rig->state.rigport.parm.serial.rate = rigCom.serialSpeed;
|
||||
//qDebug() << my_rig->state.rigport.parm.serial.stop_bits << my_rig->caps->serial_stop_bits;
|
||||
//qDebug() << my_rig->state.rigport.parm.serial.parity << my_rig->caps->serial_parity;
|
||||
//qDebug() << my_rig->state.rigport.parm.serial.handshake << my_rig->caps->serial_handshake;
|
||||
my_rig->state.rigport.parm.serial.data_bits = rigCom.serialDataBits;
|
||||
if (rigCom.serialParity == 1) my_rig->state.rigport.parm.serial.parity = RIG_PARITY_ODD;
|
||||
else if (rigCom.serialParity == 2) my_rig->state.rigport.parm.serial.parity = RIG_PARITY_EVEN;
|
||||
else my_rig->state.rigport.parm.serial.parity = RIG_PARITY_NONE;
|
||||
my_rig->state.rigport.parm.serial.stop_bits = rigCom.serialStopBits;
|
||||
if (rigCom.serialHandshake == 1) my_rig->state.rigport.parm.serial.handshake = RIG_HANDSHAKE_XONXOFF;
|
||||
else if (rigCom.serialHandshake == 2) my_rig->state.rigport.parm.serial.handshake = RIG_HANDSHAKE_HARDWARE;
|
||||
else my_rig->state.rigport.parm.serial.handshake = RIG_HANDSHAKE_NONE;
|
||||
|
||||
if (rigCom.civAddr) //CI-V address Icom
|
||||
{
|
||||
|
@ -85,12 +87,15 @@ RIG *RigDaemon::rigConnect(int *retcode)
|
|||
}
|
||||
}
|
||||
|
||||
if (rigCom.autoPowerOn) my_rig->state.auto_power_on = 1;
|
||||
|
||||
*retcode = rig_open(my_rig);
|
||||
|
||||
if (*retcode != RIG_OK) return nullptr; //Rig not connected
|
||||
else //Rig connected
|
||||
{
|
||||
if (my_rig->caps->get_powerstat != NULL) rig_get_powerstat(my_rig, &rigGet.onoff);
|
||||
if (rig_has_get_func(my_rig, RIG_FUNCTION_GET_POWERSTAT)) rig_get_powerstat(my_rig, &rigGet.onoff);
|
||||
//if (my_rig->caps->get_powerstat != NULL) rig_get_powerstat(my_rig, &rigGet.onoff);
|
||||
else rigGet.onoff = RIG_POWER_UNKNOWN;
|
||||
return my_rig;
|
||||
}
|
||||
|
@ -111,6 +116,14 @@ void RigDaemon::rigUpdate(RIG *my_rig)
|
|||
rigCmd.ptt = 0;
|
||||
}
|
||||
|
||||
if (rigCmd.cwSend && (rigGet.mode == RIG_MODE_CW || rigGet.mode == RIG_MODE_CWN || rigGet.mode == RIG_MODE_CWR))
|
||||
{
|
||||
//if (rig_has_get_func(my_rig, RIG_FUNCTION_SEND_MORSE)) rig_send_morse(my_rig, RIG_VFO_CURR, &rigSet.cwMem);
|
||||
retcode = rig_send_morse(my_rig, RIG_VFO_CURR, &rigSet.cwMem);
|
||||
if (retcode == RIG_OK) rigGet.ptt = RIG_PTT_ON; //assume PPT on if send_morse is ok
|
||||
rigCmd.cwSend = 0;
|
||||
}
|
||||
|
||||
//* VFO
|
||||
if (rigCmd.freqMain) //VFO Main
|
||||
{
|
||||
|
@ -130,6 +143,12 @@ void RigDaemon::rigUpdate(RIG *my_rig)
|
|||
//***** Priority Poll execution *****
|
||||
else
|
||||
{
|
||||
//* PTT
|
||||
ptt_t retptt;
|
||||
retcode = rig_get_ptt(my_rig, RIG_VFO_CURR, &retptt);
|
||||
if (retcode == RIG_OK) rigGet.ptt = retptt;
|
||||
|
||||
//* VFO
|
||||
freq_t retfreq;
|
||||
retcode = rig_get_freq(my_rig, RIG_VFO_CURR, &retfreq); //get VFO Main
|
||||
if (retcode == RIG_OK) rigGet.freqMain = retfreq;
|
||||
|
@ -139,16 +158,17 @@ void RigDaemon::rigUpdate(RIG *my_rig)
|
|||
if (retcode == RIG_OK) rigGet.freqSub = retfreq;
|
||||
}
|
||||
|
||||
//* PTT
|
||||
ptt_t retptt;
|
||||
retcode = rig_get_ptt(my_rig, RIG_VFO_CURR, &retptt);
|
||||
if (retcode == RIG_OK) rigGet.ptt = retptt;
|
||||
|
||||
//* Meter
|
||||
if (rigGet.ptt == 1 || rigSet.ptt == 1)
|
||||
{
|
||||
rig_get_level(my_rig, RIG_VFO_CURR, RIG_LEVEL_RFPOWER_METER, &rigGet.powerMeter);
|
||||
rig_get_level(my_rig, RIG_VFO_CURR, rigSet.meter, &rigGet.subMeter);
|
||||
if (rigSet.meter != RIG_METER_NONE) rig_get_level(my_rig, RIG_VFO_CURR, rigSet.meter, &rigGet.subMeter);
|
||||
|
||||
if (rig_has_get_level(my_rig, RIG_METER_SWR) && (rigSet.meter != RIG_LEVEL_SWR))
|
||||
{
|
||||
rig_get_level(my_rig, RIG_VFO_CURR, RIG_LEVEL_SWR, &rigGet.hiSWR);
|
||||
}
|
||||
else if (rigSet.meter == RIG_LEVEL_SWR) rigGet.hiSWR = rigGet.subMeter;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -159,6 +179,14 @@ void RigDaemon::rigUpdate(RIG *my_rig)
|
|||
//***** Command execution *****
|
||||
if (!rigGet.ptt && !rigSet.ptt)
|
||||
{
|
||||
//* Power off
|
||||
if (rigCmd.onoff && rigCap.onoff)
|
||||
{
|
||||
retcode = rig_set_powerstat(my_rig, RIG_POWER_OFF);
|
||||
if (retcode == RIG_OK) rigGet.onoff = RIG_POWER_OFF;
|
||||
}
|
||||
rigCmd.onoff = 0;
|
||||
|
||||
//* Mode
|
||||
if (rigCmd.mode && rigSet.mode != RIG_MODE_NONE) //VFO Main
|
||||
{
|
||||
|
@ -211,7 +239,8 @@ void RigDaemon::rigUpdate(RIG *my_rig)
|
|||
//* VFO Exchange
|
||||
if (rigCmd.vfoXchange)
|
||||
{
|
||||
if (my_rig->caps->vfo_ops & RIG_OP_XCHG)
|
||||
if (my_rig->state.vfo_ops & RIG_OP_XCHG)
|
||||
//if (my_rig->caps->vfo_ops & RIG_OP_XCHG)
|
||||
{
|
||||
mode_t tempMode = rigGet.mode;
|
||||
retcode = rig_vfo_op(my_rig, RIG_VFO_CURR, RIG_OP_XCHG);
|
||||
|
@ -223,7 +252,8 @@ void RigDaemon::rigUpdate(RIG *my_rig)
|
|||
}
|
||||
}
|
||||
|
||||
else if (my_rig->caps->vfo_ops & RIG_OP_TOGGLE)
|
||||
else if (my_rig->state.vfo_ops & RIG_OP_TOGGLE)
|
||||
//else if (my_rig->caps->vfo_ops & RIG_OP_TOGGLE)
|
||||
{
|
||||
freq_t tempFreq = rigGet.freqMain;
|
||||
mode_t tempMode = rigGet.mode;
|
||||
|
@ -242,7 +272,8 @@ void RigDaemon::rigUpdate(RIG *my_rig)
|
|||
//* VFO Copy
|
||||
if (rigCmd.vfoCopy)
|
||||
{
|
||||
if (my_rig->caps->vfo_ops & RIG_OP_CPY)
|
||||
if (my_rig->state.vfo_ops & RIG_OP_CPY)
|
||||
//if (my_rig->caps->vfo_ops & RIG_OP_CPY)
|
||||
{
|
||||
retcode = rig_vfo_op(my_rig, RIG_VFO_CURR, RIG_OP_CPY);
|
||||
if (retcode == RIG_OK)
|
||||
|
@ -271,7 +302,8 @@ void RigDaemon::rigUpdate(RIG *my_rig)
|
|||
//* Band Up
|
||||
if (rigCmd.bandUp)
|
||||
{
|
||||
if (my_rig->caps->vfo_ops & RIG_OP_BAND_UP)
|
||||
if (my_rig->state.vfo_ops & RIG_OP_BAND_UP)
|
||||
//if (my_rig->caps->vfo_ops & RIG_OP_BAND_UP)
|
||||
{
|
||||
retcode = rig_vfo_op(my_rig, RIG_VFO_CURR, RIG_OP_BAND_UP);
|
||||
if (retcode == RIG_OK) indexCmd = 21;
|
||||
|
@ -282,7 +314,8 @@ void RigDaemon::rigUpdate(RIG *my_rig)
|
|||
//* Band Down
|
||||
if (rigCmd.bandDown)
|
||||
{
|
||||
if (my_rig->caps->vfo_ops & RIG_OP_BAND_DOWN)
|
||||
if (my_rig->state.vfo_ops & RIG_OP_BAND_DOWN)
|
||||
//if (my_rig->caps->vfo_ops & RIG_OP_BAND_DOWN)
|
||||
{
|
||||
retcode = rig_vfo_op(my_rig, RIG_VFO_CURR, RIG_OP_BAND_DOWN);
|
||||
if (retcode == RIG_OK) indexCmd = 21;
|
||||
|
@ -309,7 +342,8 @@ void RigDaemon::rigUpdate(RIG *my_rig)
|
|||
//* Tune
|
||||
if (rigCmd.tune)
|
||||
{
|
||||
if (my_rig->caps->vfo_ops & RIG_OP_TUNE) rig_vfo_op(my_rig, RIG_VFO_CURR, RIG_OP_TUNE);
|
||||
if (my_rig->state.vfo_ops & RIG_OP_TUNE) rig_vfo_op(my_rig, RIG_VFO_CURR, RIG_OP_TUNE);
|
||||
//if (my_rig->caps->vfo_ops & RIG_OP_TUNE) rig_vfo_op(my_rig, RIG_VFO_CURR, RIG_OP_TUNE);
|
||||
rigCmd.tune = 0;
|
||||
}
|
||||
|
||||
|
@ -437,7 +471,7 @@ void RigDaemon::rigUpdate(RIG *my_rig)
|
|||
|
||||
if (rigCmd.noiseReductionLevel)
|
||||
{
|
||||
retvalue.i = rigSet.noiseReductionLevel;
|
||||
retvalue.f = rigSet.noiseReductionLevel;
|
||||
retcode = rig_set_level(my_rig, RIG_VFO_CURR, RIG_LEVEL_NR, retvalue);
|
||||
if (retcode == RIG_OK) rigGet.noiseReductionLevel = rigSet.noiseReductionLevel;
|
||||
rigCmd.noiseReductionLevel = 0;
|
||||
|
@ -527,7 +561,8 @@ void RigDaemon::rigUpdate(RIG *my_rig)
|
|||
//* Repeater shift
|
||||
if (rigCmd.rptShift)
|
||||
{
|
||||
if (my_rig->caps->set_rptr_shift)
|
||||
if (rig_has_set_func(my_rig, RIG_FUNCTION_SET_RPTR_SHIFT))
|
||||
//if (my_rig->caps->set_rptr_shift)
|
||||
{
|
||||
retcode = rig_set_rptr_shift(my_rig, RIG_VFO_CURR, rigSet.rptShift);
|
||||
if (retcode == RIG_OK) rigGet.rptShift = rigSet.rptShift;
|
||||
|
@ -537,7 +572,8 @@ void RigDaemon::rigUpdate(RIG *my_rig)
|
|||
//* Repeater offset
|
||||
if (rigCmd.rptOffset)
|
||||
{
|
||||
if (my_rig->caps->set_rptr_offs)
|
||||
if (rig_has_set_func(my_rig, RIG_FUNCTION_SET_RPTR_OFFS))
|
||||
//if (my_rig->caps->set_rptr_offs)
|
||||
{
|
||||
retcode = rig_set_rptr_offs(my_rig, RIG_VFO_CURR, rigSet.rptOffset);
|
||||
if (retcode == RIG_OK) rigGet.rptOffset = rigSet.rptOffset;
|
||||
|
@ -637,55 +673,79 @@ void RigDaemon::rigUpdate(RIG *my_rig)
|
|||
if ((indexCmd == 3 && !rigGet.ptt && rigCom.fullPoll) || indexCmd == 0) rig_get_func(my_rig, RIG_VFO_CURR, RIG_FUNC_TUNER, &rigGet.tuner);
|
||||
|
||||
//* Antenna
|
||||
if ((indexCmd == 4 && !rigGet.ptt && rigCom.fullPoll) || indexCmd == 0) rig_get_ant(my_rig, RIG_VFO_CURR, RIG_ANT_CURR, &retvalue, &rigGet.ant, &rigGet.antTx, &rigGet.antRx);
|
||||
if ((indexCmd == 4 && !rigGet.ptt && rigCom.fullPoll) || indexCmd == 0)
|
||||
{
|
||||
if (rig_has_get_func(my_rig, RIG_FUNCTION_GET_ANT)) rig_get_ant(my_rig, RIG_VFO_CURR, RIG_ANT_CURR, &retvalue, &rigGet.ant, &rigGet.antTx, &rigGet.antRx);
|
||||
}
|
||||
|
||||
//* AGC
|
||||
if ((indexCmd == 5 && !rigGet.ptt && rigCom.fullPoll) || indexCmd == 0)
|
||||
{
|
||||
rig_get_level(my_rig, RIG_VFO_CURR, RIG_LEVEL_AGC, &retvalue);
|
||||
rigGet.agc = levelagcvalue(retvalue.i);
|
||||
if (rig_has_get_level(my_rig, RIG_LEVEL_AGC))
|
||||
{
|
||||
rig_get_level(my_rig, RIG_VFO_CURR, RIG_LEVEL_AGC, &retvalue);
|
||||
rigGet.agc = levelagcvalue(retvalue.i);
|
||||
}
|
||||
}
|
||||
|
||||
//* Attenuator
|
||||
if ((indexCmd == 6 && !rigGet.ptt && rigCom.fullPoll) || indexCmd == 0)
|
||||
{
|
||||
rig_get_level(my_rig, RIG_VFO_CURR, RIG_LEVEL_ATT, &retvalue);
|
||||
rigGet.att = retvalue.i;
|
||||
if (rig_has_get_level(my_rig, RIG_LEVEL_ATT))
|
||||
{
|
||||
rig_get_level(my_rig, RIG_VFO_CURR, RIG_LEVEL_ATT, &retvalue);
|
||||
rigGet.att = retvalue.i;
|
||||
}
|
||||
}
|
||||
|
||||
//* Preamp
|
||||
if ((indexCmd == 7 && !rigGet.ptt && rigCom.fullPoll) || indexCmd == 0)
|
||||
{
|
||||
rig_get_level(my_rig, RIG_VFO_CURR, RIG_LEVEL_PREAMP, &retvalue);
|
||||
rigGet.pre = retvalue.i;
|
||||
if (rig_has_get_level(my_rig, RIG_LEVEL_PREAMP))
|
||||
{
|
||||
rig_get_level(my_rig, RIG_VFO_CURR, RIG_LEVEL_PREAMP, &retvalue);
|
||||
rigGet.pre = retvalue.i;
|
||||
}
|
||||
}
|
||||
|
||||
//* RF power
|
||||
if ((indexCmd == 8 && !rigGet.ptt && rigCom.fullPoll) || indexCmd == 0)
|
||||
{
|
||||
rig_get_level(my_rig, RIG_VFO_CURR, RIG_LEVEL_RFPOWER, &retvalue);
|
||||
rigGet.rfPower = retvalue.f;
|
||||
if (rig_has_get_level(my_rig, RIG_LEVEL_RFPOWER))
|
||||
{
|
||||
rig_get_level(my_rig, RIG_VFO_CURR, RIG_LEVEL_RFPOWER, &retvalue);
|
||||
rigGet.rfPower = retvalue.f;
|
||||
}
|
||||
}
|
||||
|
||||
//* RF gain
|
||||
if ((indexCmd == 9 && !rigGet.ptt && rigCom.fullPoll) || indexCmd == 0)
|
||||
{
|
||||
rig_get_level(my_rig, RIG_VFO_CURR, RIG_LEVEL_RF, &retvalue);
|
||||
rigGet.rfGain = retvalue.f;
|
||||
if (rig_has_get_level(my_rig, RIG_LEVEL_RF))
|
||||
{
|
||||
rig_get_level(my_rig, RIG_VFO_CURR, RIG_LEVEL_RF, &retvalue);
|
||||
rigGet.rfGain = retvalue.f;
|
||||
}
|
||||
}
|
||||
|
||||
//* AF gain
|
||||
if ((indexCmd == 10 && !rigGet.ptt && rigCom.fullPoll) || indexCmd == 0)
|
||||
{
|
||||
rig_get_level(my_rig, RIG_VFO_CURR, RIG_LEVEL_AF, &retvalue);
|
||||
rigGet.afGain = retvalue.f;
|
||||
if (rig_has_get_level(my_rig, RIG_LEVEL_AF))
|
||||
{
|
||||
rig_get_level(my_rig, RIG_VFO_CURR, RIG_LEVEL_AF, &retvalue);
|
||||
rigGet.afGain = retvalue.f;
|
||||
}
|
||||
}
|
||||
|
||||
//* Squelch
|
||||
if ((indexCmd == 11 && !rigGet.ptt && rigCom.fullPoll) || indexCmd == 0)
|
||||
{
|
||||
rig_get_level(my_rig, RIG_VFO_CURR, RIG_LEVEL_SQL, &retvalue);
|
||||
rigGet.squelch = retvalue.f;
|
||||
if (rig_has_get_level(my_rig, RIG_LEVEL_SQL))
|
||||
{
|
||||
rig_get_level(my_rig, RIG_VFO_CURR, RIG_LEVEL_SQL, &retvalue);
|
||||
rigGet.squelch = retvalue.f;
|
||||
}
|
||||
}
|
||||
|
||||
//* MIC
|
||||
|
@ -729,7 +789,7 @@ void RigDaemon::rigUpdate(RIG *my_rig)
|
|||
if (rig_has_get_level(my_rig, RIG_LEVEL_NR))
|
||||
{
|
||||
rig_get_level(my_rig, RIG_VFO_CURR, RIG_LEVEL_NR, &retvalue);
|
||||
rigGet.noiseReductionLevel = retvalue.i;
|
||||
rigGet.noiseReductionLevel = retvalue.f;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -742,7 +802,7 @@ void RigDaemon::rigUpdate(RIG *my_rig)
|
|||
//* IF Shift
|
||||
if ((indexCmd == 17 && !rigGet.ptt && rigCom.fullPoll) || indexCmd == 0)
|
||||
{
|
||||
if (rig_has_get_level(my_rig, RIG_LEVEL_NR))
|
||||
if (rig_has_get_level(my_rig, RIG_LEVEL_IF))
|
||||
{
|
||||
rig_get_level(my_rig, RIG_VFO_CURR, RIG_LEVEL_IF, &retvalue);
|
||||
rigGet.ifShift = retvalue.i;
|
||||
|
@ -762,7 +822,7 @@ void RigDaemon::rigUpdate(RIG *my_rig)
|
|||
}
|
||||
|
||||
//* CW
|
||||
if ((indexCmd == 19 && !rigGet.ptt && rigCom.fullPoll) || indexCmd == 0) //&& mode=CW
|
||||
if ((indexCmd == 19 && !rigGet.ptt && rigCom.fullPoll && (rigGet.mode == RIG_MODE_CW || rigGet.mode == RIG_MODE_CWN || rigGet.mode == RIG_MODE_CWR)) || indexCmd == 0)
|
||||
{
|
||||
if (rig_has_get_func(my_rig, RIG_FUNC_FBKIN)) rig_get_func(my_rig, RIG_VFO_CURR, RIG_FUNC_FBKIN, &rigGet.bkin); //Break-in
|
||||
if (rig_has_get_func(my_rig, RIG_FUNC_APF)) rig_get_func(my_rig, RIG_VFO_CURR, RIG_FUNC_APF, &rigGet.apf); //Audio Peak Filter
|
||||
|
@ -771,7 +831,7 @@ void RigDaemon::rigUpdate(RIG *my_rig)
|
|||
}
|
||||
|
||||
//* FM
|
||||
if ((indexCmd == 20 && !rigGet.ptt && rigCom.fullPoll) || indexCmd == 0) //&& mode=FM
|
||||
if ((indexCmd == 20 && !rigGet.ptt && rigCom.fullPoll && (rigGet.mode == RIG_MODE_FM || rigGet.mode == RIG_MODE_WFM || rigGet.mode == RIG_MODE_FMN)) || indexCmd == 0)
|
||||
{
|
||||
rig_get_rptr_shift(my_rig, RIG_VFO_CURR, &rigGet.rptShift); //Repeater Shift
|
||||
rig_get_rptr_offs(my_rig, RIG_VFO_CURR, &rigGet.rptOffset); //Repeater Offset
|
||||
|
|
20
rigdata.h
20
rigdata.h
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
** This file is part of the CatRadio project.
|
||||
** Copyright 2022 Gianfranco Sordetti IZ8EWD <iz8ewd@pianetaradio.it>.
|
||||
** Copyright 2022-2024 Gianfranco Sordetti IZ8EWD <iz8ewd@pianetaradio.it>.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
@ -30,11 +30,17 @@ typedef struct {
|
|||
unsigned rigModel; //Hamlib rig model
|
||||
QString rigPort; //COM port or IP address
|
||||
unsigned serialSpeed; //Serial port baud rate
|
||||
unsigned serialDataBits; //Serial port data bit
|
||||
unsigned serialParity; //Serial port parity (serial_parity_e RIG_PARITY_NONE = 0, RIG_PARITY_ODD, RIG_PARITY_EVEN)
|
||||
unsigned serialStopBits;
|
||||
unsigned serialHandshake; //Serial port handshake (serial_handshake_e RIG_HANDSHAKE_NONE = 0, RIG_HANDSHAKE_XONXOFF, RIG_HANDSHAKE_HARDWARE)
|
||||
int civAddr; //CI-V address (decimal, Icom radio)
|
||||
bool netRigctl; //TCP NET Rigctl
|
||||
unsigned rigRefresh; //GUI refresh interval (ms)
|
||||
int connected; //connected flag
|
||||
bool fullPoll; //full polling flag
|
||||
bool autoConnect; //Auto-connect flag
|
||||
bool autoPowerOn; //Auto Power ON flag
|
||||
} rigConnect;
|
||||
|
||||
typedef struct {
|
||||
|
@ -51,6 +57,7 @@ typedef struct {
|
|||
value_t sMeter; //Smeter signal strenght
|
||||
value_t powerMeter; //RF power meter
|
||||
value_t subMeter; //secondary meter
|
||||
value_t hiSWR; //SWR level for Hi SWR indicator
|
||||
unsigned long long meter; //secondary meter type
|
||||
float rfPower; //RF power output level
|
||||
float rfGain; //RF gain rx
|
||||
|
@ -64,9 +71,11 @@ typedef struct {
|
|||
int tuner; //Tuner
|
||||
int bkin; //CW Break-in
|
||||
int wpm; //CW Keyer speed WPM
|
||||
char cwMem; //CW memory keyer
|
||||
int apf; //Audio Peak Filter
|
||||
int noiseBlanker, noiseBlanker2; //NB
|
||||
int noiseReduction, noiseReductionLevel; //NR
|
||||
int noiseReduction; //NR
|
||||
float noiseReductionLevel; //NR level
|
||||
int notchFilter; //NF
|
||||
int ifShift;
|
||||
int clar, rit, xit; //Clarifier Rx or Tx
|
||||
|
@ -101,9 +110,10 @@ typedef struct {
|
|||
int tune;
|
||||
int bandUp, bandDown;
|
||||
int bandChange;
|
||||
int bkin;
|
||||
int wpm;
|
||||
int apf;
|
||||
int bkin; //CW break-in
|
||||
int wpm; //CW wpm
|
||||
int cwSend; //CW send memory (Yaesu only)
|
||||
int apf; //CW audio peak filter (Yaesu only)
|
||||
int noiseBlanker, noiseBlanker2;
|
||||
int noiseReduction, noiseReductionLevel;
|
||||
int notchFilter;
|
||||
|
|
78
smeter.cpp
78
smeter.cpp
|
@ -36,9 +36,13 @@ SMeter::SMeter(QWidget *parent) : QWidget(parent)
|
|||
shortStep = 10;
|
||||
precision = 0;
|
||||
|
||||
meterTx = 0;
|
||||
meterTx = false;
|
||||
|
||||
currentValue = -54;
|
||||
currentValue = minValue;
|
||||
peakValue = minValue;
|
||||
peakFactor = 0.1;
|
||||
|
||||
peakHold = true;
|
||||
}
|
||||
|
||||
void SMeter::paintEvent(QPaintEvent *)
|
||||
|
@ -53,6 +57,7 @@ void SMeter::paintEvent(QPaintEvent *)
|
|||
|
||||
drawMeter(&painter);
|
||||
drawProgress(&painter);
|
||||
if (peakHold) drawPeak(&painter);
|
||||
drawScaleSMeter(&painter);
|
||||
drawScalePWRMeter(&painter);
|
||||
}
|
||||
|
@ -94,6 +99,8 @@ void SMeter::drawProgress(QPainter *painter)
|
|||
double increment = length / (max - min);
|
||||
double initX, initXX;
|
||||
|
||||
if (currentValue>max) currentValue = max;
|
||||
|
||||
if (currentValue>gate)
|
||||
{
|
||||
initX = (gate - min) * increment;
|
||||
|
@ -116,6 +123,46 @@ void SMeter::drawProgress(QPainter *painter)
|
|||
painter->restore();
|
||||
}
|
||||
|
||||
void SMeter::drawPeak(QPainter *painter)
|
||||
{
|
||||
double max, min;
|
||||
double gate;
|
||||
|
||||
painter->save();
|
||||
painter->setPen(Qt::NoPen);
|
||||
|
||||
if (meterTx) //RF power meter
|
||||
{
|
||||
max = maxValue;
|
||||
min = minValue;
|
||||
gate = gateValue;
|
||||
}
|
||||
else //SMeter
|
||||
{
|
||||
max = 60;
|
||||
min = -54;
|
||||
gate = 0;
|
||||
}
|
||||
|
||||
double length = width()-14;
|
||||
double increment = length / (max - min);
|
||||
double initX;
|
||||
|
||||
if (currentValue>=peakValue) peakValue = currentValue;
|
||||
else peakValue = peakValue - peakFactor*(peakValue - currentValue);
|
||||
if (peakValue>max) peakValue = max;
|
||||
|
||||
if (peakValue>gate) painter->setBrush(QColor(Qt::red));
|
||||
else painter->setBrush(progressColor);
|
||||
|
||||
initX = (peakValue - min) * increment;
|
||||
|
||||
QRect rect(initX - 2, height()/3+2+1, 2, height()/3-4-2);
|
||||
painter->drawRect(rect);
|
||||
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
void SMeter::drawScalePWRMeter(QPainter *painter)
|
||||
{
|
||||
painter->save();
|
||||
|
@ -271,7 +318,6 @@ void SMeter::drawScaleSMeter(QPainter *painter)
|
|||
void SMeter::setMinValue(double value)
|
||||
{
|
||||
minValue = value;
|
||||
update();
|
||||
}
|
||||
|
||||
void SMeter::setMaxValue(double value)
|
||||
|
@ -288,19 +334,16 @@ void SMeter::setGateValue(double value)
|
|||
void SMeter::setLongStep(double value)
|
||||
{
|
||||
longStep = value;
|
||||
update();
|
||||
}
|
||||
|
||||
void SMeter::setShortStep(double value)
|
||||
{
|
||||
shortStep = value;
|
||||
update();
|
||||
}
|
||||
|
||||
void SMeter::setPrecision(int value)
|
||||
{
|
||||
precision = value;
|
||||
update();
|
||||
}
|
||||
|
||||
void SMeter::setBgColor(QColor color)
|
||||
|
@ -326,7 +369,7 @@ void SMeter::setScaleColor(QColor color)
|
|||
void SMeter::setValue(double value)
|
||||
{
|
||||
currentValue = value;
|
||||
update();
|
||||
update(1, height()/3+2+1, width()-14, height()/3-4-2);
|
||||
}
|
||||
|
||||
void SMeter::setValue(int value)
|
||||
|
@ -338,3 +381,24 @@ void SMeter::setTx(bool Tx)
|
|||
{
|
||||
meterTx = Tx;
|
||||
}
|
||||
|
||||
bool SMeter::getTx()
|
||||
{
|
||||
return meterTx;
|
||||
}
|
||||
|
||||
void SMeter::setPeak(bool Peak)
|
||||
{
|
||||
peakHold = Peak;
|
||||
}
|
||||
|
||||
void SMeter::setPeakFactor(double factor)
|
||||
{
|
||||
peakFactor = factor;
|
||||
}
|
||||
|
||||
void SMeter::resetPeakValue()
|
||||
{
|
||||
if (meterTx) peakValue = minValue;
|
||||
else peakValue = -54;
|
||||
}
|
||||
|
|
8
smeter.h
8
smeter.h
|
@ -46,11 +46,16 @@ public slots:
|
|||
void setValue(int value);
|
||||
|
||||
void setTx(bool Tx);
|
||||
bool getTx();
|
||||
void setPeak(bool Peak);
|
||||
void setPeakFactor(double factor);
|
||||
void resetPeakValue();
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *);
|
||||
void drawMeter(QPainter *painter);
|
||||
void drawProgress(QPainter *painter);
|
||||
void drawPeak(QPainter *painter);
|
||||
void drawScaleSMeter(QPainter *painter);
|
||||
void drawScalePWRMeter(QPainter *painter);
|
||||
|
||||
|
@ -64,8 +69,11 @@ private:
|
|||
|
||||
double value; //target value
|
||||
double currentValue; //current value
|
||||
double peakValue; //peak value
|
||||
double peakFactor; //peak factor
|
||||
|
||||
bool meterTx; //Switch between SMeter or PowerMeter
|
||||
bool peakHold; //Peak hold
|
||||
|
||||
QColor bgColor; //background color
|
||||
QColor lineColor; //line color
|
||||
|
|
64
submeter.cpp
64
submeter.cpp
|
@ -20,7 +20,6 @@
|
|||
#include "submeter.h"
|
||||
#include <QPainter>
|
||||
#include <math.h>
|
||||
#include <QDebug>
|
||||
|
||||
SubMeter::SubMeter(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
|
@ -40,6 +39,10 @@ SubMeter::SubMeter(QWidget *parent) : QWidget(parent)
|
|||
meterSWR = 0;
|
||||
|
||||
currentValue = 0;
|
||||
peakValue = minValue;
|
||||
peakFactor = 0.1;
|
||||
|
||||
peakHold = true;
|
||||
}
|
||||
|
||||
void SubMeter::paintEvent(QPaintEvent *)
|
||||
|
@ -54,6 +57,7 @@ void SubMeter::paintEvent(QPaintEvent *)
|
|||
|
||||
drawMeter(&painter);
|
||||
drawProgress(&painter);
|
||||
if (peakHold) drawPeak(&painter);
|
||||
drawScale(&painter);
|
||||
}
|
||||
|
||||
|
@ -116,6 +120,48 @@ void SubMeter::drawProgress(QPainter *painter)
|
|||
painter->restore();
|
||||
}
|
||||
|
||||
void SubMeter::drawPeak(QPainter *painter)
|
||||
{
|
||||
double max, min;
|
||||
double gate;
|
||||
|
||||
painter->save();
|
||||
painter->setPen(Qt::NoPen);
|
||||
|
||||
max = maxValue;
|
||||
min = minValue;
|
||||
gate = gateValue;
|
||||
if (meterSWR) min = 1; //SWR meter
|
||||
|
||||
double length = width()-14;
|
||||
double increment;
|
||||
double initX;
|
||||
|
||||
if (currentValue>=peakValue) peakValue = currentValue;
|
||||
else peakValue = peakValue - peakFactor*(peakValue - currentValue);
|
||||
if (peakValue>max) peakValue = max;
|
||||
|
||||
if (peakValue>gate) painter->setBrush(QColor(Qt::red));
|
||||
else painter->setBrush(progressColor);
|
||||
|
||||
if (meterSWR)
|
||||
{
|
||||
increment = length / (10 * log10(maxValue));
|
||||
initX = 10 * log10(peakValue) * increment;
|
||||
}
|
||||
else
|
||||
{
|
||||
increment = length / (max - min);
|
||||
initX = (peakValue - min) * increment;
|
||||
}
|
||||
//initX = (peakValue - min) * increment;
|
||||
|
||||
QRect rect(initX - 2, height()/3+2+1, 2, height()/3-4-2);
|
||||
painter->drawRect(rect);
|
||||
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
void SubMeter::drawScale(QPainter *painter)
|
||||
{
|
||||
painter->save();
|
||||
|
@ -276,3 +322,19 @@ void SubMeter::setMeterSWR(bool swr)
|
|||
{
|
||||
meterSWR = swr;
|
||||
}
|
||||
|
||||
void SubMeter::setPeak(bool Peak)
|
||||
{
|
||||
peakHold = Peak;
|
||||
}
|
||||
|
||||
void SubMeter::setPeakFactor(double factor)
|
||||
{
|
||||
peakFactor = factor;
|
||||
}
|
||||
|
||||
void SubMeter::resetPeakValue()
|
||||
{
|
||||
if (!meterSWR) peakValue = minValue;
|
||||
else peakValue = 1.0;
|
||||
}
|
||||
|
|
|
@ -46,10 +46,15 @@ public slots:
|
|||
|
||||
void setMeterSWR(bool swr);
|
||||
|
||||
void setPeak(bool Peak);
|
||||
void setPeakFactor(double factor);
|
||||
void resetPeakValue();
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *);
|
||||
void drawMeter(QPainter *painter);
|
||||
void drawProgress(QPainter *painter);
|
||||
void drawPeak(QPainter *painter);
|
||||
void drawScale(QPainter *painter);
|
||||
|
||||
private:
|
||||
|
@ -64,6 +69,10 @@ private:
|
|||
|
||||
double value; //target value
|
||||
double currentValue; //current value
|
||||
double peakValue; //peak value
|
||||
double peakFactor; //peak factor
|
||||
|
||||
bool peakHold; //Peak hold
|
||||
|
||||
QColor bgColor; //background color
|
||||
QColor lineColor; //line color
|
||||
|
|
Ładowanie…
Reference in New Issue