PianetaRadio 2022-04-08 18:04:54 +02:00 zatwierdzone przez GitHub
rodzic d0d145d839
commit c28c1dbb35
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
9 zmienionych plików z 303 dodań i 37 usunięć

Wyświetl plik

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 6.0.2, 2022-03-29T22:53:38. -->
<!-- Written by QtCreator 6.0.2, 2022-04-08T17:56:59. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>

Wyświetl plik

@ -3,10 +3,12 @@ CatRadio
(+ New, * Updated, - Removed)
1.2.0 -
+ Clarifier RIT/XIT commands
+ Up/Down VFO buttons
+ Repeater shift offset
+ DCS code and squelch
+ COM port list in the communication config dialog
* Bug correction: IF shift slider now correctly updated
1.1.1 - 2022-03-19
* VFO operations: check rig caps before perform VFO operations

Wyświetl plik

@ -20,3 +20,4 @@
#include "guidata.h"
guiConfig guiConf;
guiCommand guiCmd;

Wyświetl plik

@ -6,5 +6,13 @@
typedef struct {
int vfoDisplayMode; //0: use Left/Right mouse button, 1: click digit up or down
} guiConfig;
typedef struct {
int bwidthList;
int antList;
int rangeList;
int tabList;
int toneList;
} guiCommand;

Wyświetl plik

@ -45,6 +45,7 @@ extern rigSettings rigSet;
extern rigCommand rigCmd;
extern rigCommand rigCap;
extern guiConfig guiConf;
extern guiCommand guiCmd;
int retcode; //Return code from function
int i; //Index
@ -80,6 +81,7 @@ MainWindow::MainWindow(QWidget *parent)
connect(ui->verticalSlider_RFgain, &QAbstractSlider::valueChanged, ui->label_RFgainValue, QOverload<int>::of(&QLabel::setNum));
connect(ui->verticalSlider_AFGain, &QAbstractSlider::valueChanged, ui->label_AFGainValue, QOverload<int>::of(&QLabel::setNum));
connect(ui->verticalSlider_Squelch, &QAbstractSlider::valueChanged, ui->label_SquelchValue, QOverload<int>::of(&QLabel::setNum));
connect(ui->horizontalSlider_clar, &QAbstractSlider::valueChanged, ui->label_clar, QOverload<int>::of(&QLabel::setNum));
connect(ui->horizontalSlider_IFshift, &QAbstractSlider::valueChanged, ui->label_IFshiftValue,QOverload<int>::of(&QLabel::setNum));
//* Signal and Slot connection for vfoDisplay
@ -175,7 +177,7 @@ void MainWindow::guiInit()
}
}
ui->comboBox_ModeSub->addItem(rig_strrmode(RIG_MODE_NONE)); //add None mode in the modeSub list, used in case mode sub vfo is not targetable
rigCmd.bwidthList = 1; //Command to populate BW combobox in guiUpdate()
guiCmd.bwidthList = 1; //Command to populate BW combobox in guiUpdate()
}
//* AGC level comboBox
@ -219,6 +221,10 @@ void MainWindow::guiInit()
ui->comboBox_Preamp->addItem(QString::number(my_rig->state.preamp[i]));
}
//* Clarifier
rigSet.rit = 1;
if (!rig_has_get_func(my_rig, RIG_FUNC_XIT)) ui->radioButton_clarXIT->setCheckable(false);
//* Tone
ui->comboBox_toneType->clear();
ui->comboBox_toneType->addItem(""); //None
@ -247,9 +253,10 @@ void MainWindow::guiInit()
rigCap.modeSub = 1;
}
rigCmd.rangeList = 1; //update range list
rigCmd.antList = 1; //update antenna list
rigCmd.toneList = 1; //update tone list
guiCmd.rangeList = 1; //update range list
guiCmd.antList = 1; //update antenna list
guiCmd.toneList = 1; //update tone list
guiCmd.tabList = 1; //select tab
}
void MainWindow::guiUpdate()
@ -275,11 +282,16 @@ void MainWindow::guiUpdate()
ui->comboBox_Mode->setCurrentText(rig_strrmode(rigGet.mode));
ui->comboBox_ModeSub->setCurrentText(rig_strrmode(rigGet.modeSub));
if (rigGet.mode == RIG_MODE_CW || rigGet.mode == RIG_MODE_CWR || rigGet.mode == RIG_MODE_CWN) ui->tabWidget->setCurrentIndex(0); //CW tab
if (rigGet.mode == RIG_MODE_FM || rigGet.mode == RIG_MODE_FMN || rigGet.mode == RIG_MODE_PKTFM || rigGet.mode == RIG_MODE_PKTFMN || rigGet.mode == RIG_MODE_C4FM || rigGet.mode == RIG_MODE_DSTAR) ui->tabWidget->setCurrentIndex(1); //FM tab
if (guiCmd.tabList)
{
if (rigGet.mode == RIG_MODE_SSB || rigGet.mode == RIG_MODE_USB || rigGet.mode == RIG_MODE_LSB) ui->tabWidget->setCurrentIndex(0); //Clarifier tab
if (rigGet.mode == RIG_MODE_CW || rigGet.mode == RIG_MODE_CWR || rigGet.mode == RIG_MODE_CWN) ui->tabWidget->setCurrentIndex(1); //CW tab
if (rigGet.mode == RIG_MODE_FM || rigGet.mode == RIG_MODE_FMN || rigGet.mode == RIG_MODE_PKTFM || rigGet.mode == RIG_MODE_PKTFMN || rigGet.mode == RIG_MODE_C4FM || rigGet.mode == RIG_MODE_DSTAR) ui->tabWidget->setCurrentIndex(2); //FM tab
guiCmd.tabList = 0;
}
//* BW combobox
if (rigCmd.bwidthList)
if (guiCmd.bwidthList)
{
ui->comboBox_BW->clear();
filter_list bwidth_list; //IF filter bandwidth per mode
@ -301,14 +313,14 @@ void MainWindow::guiUpdate()
//else qDebug() << "vuoto" << rigGet.mode;
}
ui->comboBox_BW->model()->sort(0, Qt::DescendingOrder);
rigCmd.bwidthList = 0;
guiCmd.bwidthList = 0;
}
ui->comboBox_BW->setCurrentText(QString::number(rigGet.bwidth));
ui->checkBox_NAR->setChecked(rigGet.bwNarrow);
//* Range list
if (rigCmd.rangeList)
if (guiCmd.rangeList)
{
for (i=0; i<HAMLIB_FRQRANGESIZ; i++) //Tx range list
{
@ -320,14 +332,14 @@ void MainWindow::guiUpdate()
{
if (rigGet.freqMain >= my_rig->state.rx_range_list[i].startf && rigGet.freqMain <= my_rig->state.rx_range_list[i].endf) break;
}
if (rigGet.rangeListRxIndex != i) rigCmd.antList = 1;
if (rigGet.rangeListRxIndex != i) guiCmd.antList = 1;
rigGet.rangeListRxIndex = i;
rigCmd.rangeList = 0;
guiCmd.rangeList = 0;
}
//* Antenna list
if (rigCmd.antList)
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
@ -348,11 +360,11 @@ void MainWindow::guiUpdate()
}
}
}
rigCmd.antList = 0;
guiCmd.antList = 0;
}
//* Tone list
if (rigCmd.toneList)
if (guiCmd.toneList)
{
ui->comboBox_toneFreq->clear();
@ -374,7 +386,7 @@ void MainWindow::guiUpdate()
}
}
rigCmd.toneList = 0;
guiCmd.toneList = 0;
}
//* RF
@ -437,6 +449,20 @@ void MainWindow::guiUpdate()
ui->checkBox_NR->setChecked(rigGet.noiseReduction);
ui->spinBox_NR->setValue(rigGet.noiseReductionLevel);
ui->checkBox_NF->setChecked(rigGet.notchFilter);
if (!ui->horizontalSlider_IFshift->isSliderDown()) ui->horizontalSlider_IFshift->setValue(rigGet.ifShift);
//* Clarifier
ui->checkBox_clar->setChecked(rigGet.clar);
if (rigSet.xit)
{
ui->radioButton_clarXIT->setChecked(true);
if (!ui->horizontalSlider_clar->isSliderDown()) ui->horizontalSlider_clar->setValue(rigGet.xitOffset);
}
else //rigSet.rit
{
ui->radioButton_clarRIT->setChecked(true);
if (!ui->horizontalSlider_clar->isSliderDown()) ui->horizontalSlider_clar->setValue(rigGet.ritOffset);
}
//* CW
ui->checkBox_BKIN->setChecked(rigGet.bkin);
@ -613,6 +639,13 @@ void MainWindow::on_pushButton_Tune_clicked()
rigCmd.tune = 1;
}
void MainWindow::on_pushButton_clarClear_clicked()
{
if (rigSet.rit) rigSet.ritOffset = 0;
else rigSet.xitOffset = 0; //rigSet.xit
rigCmd.clar = 1;
}
void MainWindow::on_pushButton_Band160_clicked()
{
set_band(160);
@ -765,6 +798,20 @@ void MainWindow::on_checkBox_NF_toggled(bool checked)
}
}
void MainWindow::on_checkBox_clar_toggled(bool checked)
{
if (checked && !rigGet.clar)
{
rigSet.clar = 1;
rigCmd.clar = 1;
}
else if (!checked && rigGet.clar)
{
rigSet.clar = 0;
rigCmd.clar = 1;
}
}
void MainWindow::on_checkBox_APF_toggled(bool checked)
{
if (checked && !rigGet.apf)
@ -796,6 +843,26 @@ void MainWindow::on_radioButton_Tuner_toggled(bool checked)
}
}
void MainWindow::on_radioButton_clarRIT_toggled(bool checked)
{
if (checked)
{
rigSet.rit = 1;
rigSet.xit = 0;
rigCmd.clar = 1;
}
}
void MainWindow::on_radioButton_clarXIT_toggled(bool checked)
{
if (checked)
{
rigSet.rit = 0;
rigSet.xit = 1;
rigCmd.clar = 1;
}
}
void MainWindow::on_radioButton_RPTshiftSimplex_toggled(bool checked)
{
if (checked)
@ -859,6 +926,7 @@ void MainWindow::on_vfoDisplayValueChanged(int value)
void MainWindow::on_comboBox_Mode_activated(int index)
{
rigSet.mode = rig_parse_mode(ui->comboBox_Mode->itemText(index).toLatin1());
guiCmd.tabList = 1; //update tab
rigCmd.mode = 1;
}
@ -913,7 +981,7 @@ void MainWindow::on_comboBox_toneType_activated(int index)
else if (toneType == "DCS") rigSet.toneType = 4;
else rigSet.toneType = 0;
rigCmd.toneList = 1; //update tone list
guiCmd.toneList = 1; //update tone list
rigCmd.tone = 1;
}
@ -1001,6 +1069,22 @@ void MainWindow::on_horizontalSlider_IFshift_valueChanged(int value)
}
}
void MainWindow::on_horizontalSlider_clar_valueChanged(int value)
{
if (!rigCmd.clar)
{
if (rigSet.rit)
{
rigSet.ritOffset = value;
if (rigSet.ritOffset != rigGet.ritOffset) rigCmd.clar = 1;
}
else //rigSet.xit
{
rigSet.xitOffset = value;
if (rigSet.xitOffset != rigGet.xitOffset) rigCmd.clar = 1;
}
}
}
//***** Menu *****

Wyświetl plik

@ -162,6 +162,16 @@ private slots:
void on_pushButton_right_clicked();
void on_checkBox_clar_toggled(bool checked);
void on_pushButton_clarClear_clicked();
void on_horizontalSlider_clar_valueChanged(int value);
void on_radioButton_clarRIT_toggled(bool checked);
void on_radioButton_clarXIT_toggled(bool checked);
private:
Ui::MainWindow *ui;
QTimer *timer;

Wyświetl plik

@ -1429,12 +1429,121 @@
<height>131</height>
</rect>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab_clar">
<property name="autoFillBackground">
<bool>true</bool>
</property>
<attribute name="title">
<string>Clar</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QCheckBox" name="checkBox_clar">
<property name="text">
<string>Clarifier</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButton_clarRIT">
<property name="text">
<string>RIT</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButton_clarXIT">
<property name="text">
<string>XIT</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_clarClear">
<property name="text">
<string>Clear</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6" stretch="1,0,0">
<property name="spacing">
<number>5</number>
</property>
<item>
<widget class="QSlider" name="horizontalSlider_clar">
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="minimum">
<number>-10000</number>
</property>
<property name="maximum">
<number>10000</number>
</property>
<property name="singleStep">
<number>10</number>
</property>
<property name="pageStep">
<number>100</number>
</property>
<property name="tracking">
<bool>true</bool>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksAbove</enum>
</property>
<property name="tickInterval">
<number>1000</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_clar">
<property name="minimumSize">
<size>
<width>40</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>0</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<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>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_CW">
<property name="autoFillBackground">
<bool>true</bool>

Wyświetl plik

@ -19,6 +19,7 @@
#include "rigdaemon.h"
#include "rigdata.h"
#include "guidata.h"
#include "rigcommand.h"
#include <QThread>
@ -35,6 +36,7 @@ extern rigSettings rigGet;
extern rigSettings rigSet;
extern rigCommand rigCmd;
extern rigCommand rigCap;
extern guiCommand guiCmd;
int commandPriority = 0;
@ -116,7 +118,7 @@ void RigDaemon::rigUpdate()
retcode = rig_set_freq(my_rig, RIG_VFO_CURR, rigSet.freqMain);
if (retcode == RIG_OK) rigGet.freqMain = rigSet.freqMain;
rigCmd.freqMain = 0;
rigCmd.rangeList = 1;
guiCmd.rangeList = 1;
}
else if (rigCmd.freqSub && rigCap.freqSub) //VFO Sub
@ -164,7 +166,7 @@ void RigDaemon::rigUpdate()
retcode = rig_set_mode(my_rig, RIG_VFO_CURR, rigSet.mode, RIG_PASSBAND_NOCHANGE);
if (retcode == RIG_OK)
{
rigCmd.bwidthList = 1; //Update BWidth list
guiCmd.bwidthList = 1; //Update BWidth list
commandPriority = 0;
//rig_get_mode(my_rig, RIG_VFO_CURR, &rigGet.mode, &rigGet.bwidth); //Get BW
}
@ -217,7 +219,7 @@ void RigDaemon::rigUpdate()
{
if (rigCap.modeSub == 0) rigGet.modeSub = tempMode; //If mode sub VFO not targettable, use buffer
commandPriority = 0;
rigCmd.bwidthList = 1;
guiCmd.bwidthList = 1;
}
}
@ -231,7 +233,7 @@ void RigDaemon::rigUpdate()
if (rigCap.freqSub == 0) rigGet.freqSub = tempFreq; //If freq sub VFO not targettable, use buffer
if (rigCap.modeSub == 0) rigGet.modeSub = tempMode; //If mode sub VFO not targettable, use buffer
commandPriority = 0;
rigCmd.bwidthList = 1;
guiCmd.bwidthList = 1;
}
}
rigCmd.vfoXchange = 0;
@ -275,7 +277,7 @@ void RigDaemon::rigUpdate()
if (retcode == RIG_OK)
{
commandPriority = 0;
rigCmd.bwidthList = 1;
guiCmd.bwidthList = 1;
}
}
rigCmd.bandUp = 0;
@ -290,7 +292,7 @@ void RigDaemon::rigUpdate()
if (retcode == RIG_OK)
{
commandPriority = 0;
rigCmd.bwidthList = 1;
guiCmd.bwidthList = 1;
}
}
rigCmd.bandDown = 0;
@ -300,7 +302,7 @@ void RigDaemon::rigUpdate()
if (rigCmd.bandChange)
{
commandPriority = 0;
rigCmd.bwidthList = 1;
guiCmd.bwidthList = 1;
}
//* Tune
@ -412,6 +414,45 @@ void RigDaemon::rigUpdate()
rigCmd.ifShift = 0;
}
//* Clarifier
if (rigCmd.clar)
{
if (rigSet.clar != rigGet.clar)
{
if (rigSet.rit) retcode = rig_set_func(my_rig, RIG_VFO_CURR, RIG_FUNC_RIT, rigSet.clar);
else if (rigSet.xit) retcode = rig_set_func(my_rig, RIG_VFO_CURR, RIG_FUNC_XIT, rigSet.clar);
if (retcode == RIG_OK)
{
rigGet.clar = rigSet.clar;
rigGet.rit = rigSet.rit;
rigGet.xit = rigSet.xit;
}
}
if ((rigSet.rit != rigGet.rit) && rigGet.clar)
{
retcode = rig_set_func(my_rig, RIG_VFO_CURR, RIG_FUNC_RIT, rigSet.rit);
if (retcode == RIG_OK) rigGet.rit = rigSet.rit;
}
if ((rigSet.xit != rigGet.xit) && rigGet.clar)
{
retcode = rig_set_func(my_rig, RIG_VFO_CURR, RIG_FUNC_XIT, rigSet.xit);
if (retcode == RIG_OK) rigGet.xit = rigSet.xit;
}
if (rigSet.rit)
{
retcode = rig_set_rit(my_rig, RIG_VFO_CURR, rigSet.ritOffset);
if (retcode == RIG_OK) rigGet.ritOffset = rigSet.ritOffset;
}
else if (rigSet.xit)
{
retcode = rig_set_xit(my_rig, RIG_VFO_CURR, rigSet.xitOffset);
if (retcode == RIG_OK) rigGet.xitOffset = rigSet.xitOffset;
}
rigCmd.clar = 0;
}
//** CW
//* CW break-in
if (rigCmd.bkin)
@ -494,7 +535,7 @@ void RigDaemon::rigUpdate()
rigGet.tone = rigSet.tone;
}
rigCmd.tone = 0;
rigCmd.toneList = 1;
guiCmd.toneList = 1;
}
} //end if (!rigGet.ptt)
@ -611,8 +652,20 @@ void RigDaemon::rigUpdate()
rigGet.ifShift = retvalue.i;
}
//* Clarifier
if ((commandPriority == 16 && !rigGet.ptt && rigCom.fullPoll) || commandPriority == 0)
{
if (rig_has_get_func(my_rig, RIG_FUNC_RIT)) rig_get_func(my_rig, RIG_VFO_CURR, RIG_FUNC_RIT, &rigGet.rit); //RIT
if (rig_has_get_func(my_rig, RIG_FUNC_XIT)) rig_get_func(my_rig, RIG_VFO_CURR, RIG_FUNC_XIT, &rigGet.xit); //XIT
rigGet.clar = rigGet.rit || rigGet.xit;
//qDebug() << rigGet.clar << rigGet.rit << rigGet.xit;
if (rigSet.rit && my_rig->caps->get_rit) rig_get_rit(my_rig, RIG_VFO_CURR, &rigGet.ritOffset);
else if (rigSet.xit && my_rig->caps->get_xit) rig_get_xit(my_rig, RIG_VFO_CURR, &rigGet.xitOffset);
//else rigGet.clarOffset = rigSet.clarOffset;
}
//* CW
if ((commandPriority == 16 && !rigGet.ptt && rigCom.fullPoll) || commandPriority == 0) //&& mode=CW
if ((commandPriority == 17 && !rigGet.ptt && rigCom.fullPoll) || commandPriority == 0) //&& mode=CW
{
rig_get_func(my_rig, RIG_VFO_CURR, RIG_FUNC_FBKIN, &rigGet.bkin); //Break-in
rig_get_func(my_rig, RIG_VFO_CURR, RIG_FUNC_APF, &rigGet.apf); //Audio Peak Filter
@ -621,7 +674,7 @@ void RigDaemon::rigUpdate()
}
//* FM
if ((commandPriority == 17 && !rigGet.ptt && rigCom.fullPoll) || commandPriority == 0) //&& mode=FM
if ((commandPriority == 18 && !rigGet.ptt && rigCom.fullPoll) || commandPriority == 0) //&& mode=FM
{
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
@ -659,11 +712,11 @@ void RigDaemon::rigUpdate()
rigCmd.tone = 1;
}*/
if (rigGet.toneType != rigSet.toneType) rigCmd.toneList = 1; //update tone list
if (rigGet.toneType != rigSet.toneType) guiCmd.toneList = 1; //update tone list
}
commandPriority ++;
if (commandPriority == 18) commandPriority = 1;
if (commandPriority == 19) commandPriority = 1;
}
emit resultReady();

Wyświetl plik

@ -68,6 +68,8 @@ typedef struct {
int noiseReduction, noiseReductionLevel;
int notchFilter;
int ifShift;
int clar, rit, xit; //Clarifier Rx or Tx
shortfreq_t ritOffset, xitOffset; //Clarifier offset (Hz)
rptr_shift_t rptShift; //Repeater shift
shortfreq_t rptOffset; //Repeater offset (Hz)
int toneType; //0 none, 1 burst 1750, 2 CTCSS, 3 CTCSS SQL, 4 DCS
@ -79,7 +81,6 @@ typedef struct {
int freqMain, freqSub;
int mode, modeSub;
int bwidth;
int bwidthList;
int vfo;
int split;
int vfoXchange, vfoCopy;
@ -104,9 +105,7 @@ typedef struct {
int noiseReduction, noiseReductionLevel;
int notchFilter;
int ifShift;
int clar;
int rptShift, rptOffset;
int tone;
int antList;
int rangeList;
int toneList;
} rigCommand;