Added sub VFO repeater access and tone control, hopefully will work for

IC-7610 and IC-7850.
failbranch
Elliott Liggett 2023-01-27 14:05:50 -08:00
rodzic 404d6ddceb
commit 2c6884d827
9 zmienionych plików z 256 dodań i 54 usunięć

Wyświetl plik

@ -2,31 +2,7 @@
#define REPEATERATTRIBUTES_H
#include <QMetaType>
enum duplexMode {
dmSplitOff=0x00,
dmSplitOn=0x01,
dmSimplex=0x10,
dmDupMinus=0x11,
dmDupPlus=0x12,
dmDupRPS=0x13,
dmDupAutoOn=0x26,
dmDupAutoOff=0x36
};
// TODO: Remove this file as it does nothing.
// Here, T=tone, D=DCS, N=none
// And the naming convention order is Transmit Receive
enum rptAccessTxRx {
ratrNN=0x00,
ratrTN=0x01, // "TONE" (T only)
ratrNT=0x02, // "TSQL" (R only)
ratrDD=0x03, // "DTCS" (TR)
ratrDN=0x06, // "DTCS(T)"
ratrTD=0x07, // "TONE(T) / TSQL(R)"
ratrDT=0x08, // "DTCS(T) / TSQL(R)"
ratrTT=0x09 // "TONE(T) / TSQL(R)"
};
Q_DECLARE_METATYPE(enum duplexMode)
Q_DECLARE_METATYPE(enum rptAccessTxRx)
#endif // REPEATERATTRIBUTES_H

Wyświetl plik

@ -92,6 +92,16 @@ void repeaterSetup::setRig(rigCapabilities inRig)
// do not have a swap AB command.
ui->swapABBtn->setDisabled(true);
}
if(rig.hasSpecifyMainSubCmd)
{
ui->setRptrSubVFOBtn->setEnabled(true);
ui->setToneSubVFOBtn->setEnabled(true);
ui->setSplitRptrToneChk->setEnabled(true);
} else {
ui->setRptrSubVFOBtn->setDisabled(true);
ui->setToneSubVFOBtn->setDisabled(true);
ui->setSplitRptrToneChk->setDisabled(true);
}
}
void repeaterSetup::populateTones()
@ -362,6 +372,11 @@ void repeaterSetup::handleUpdateCurrentMainFrequency(freqt mainfreq)
on_splitMinusBtn_clicked();
}
}
if(ui->setSplitRptrToneChk->isChecked())
{
// TODO, not really needed if the op
// just sets the tone when needed, as it will do both bands.
}
}
this->currentMainFrequency = mainfreq;
}
@ -428,11 +443,25 @@ void repeaterSetup::on_rptToneCombo_activated(int tindex)
{
quint16 tone=0;
tone = (quint16)ui->rptToneCombo->itemData(tindex).toUInt();
rptrTone_t rt;
rt.tone = tone;
bool updateSub = ui->setSplitRptrToneChk->isEnabled() && ui->setSplitRptrToneChk->isChecked();
if(ui->toneTone->isChecked())
{
emit setTone(tone);
emit setTone(rt);
if(updateSub)
{
rt.useSecondaryVFO = true;
emit setTone(rt);
}
} else if (ui->toneTSQL->isChecked()) {
emit setTSQL(tone);
emit setTSQL(rt);
if(updateSub)
{
rt.useSecondaryVFO = true;
emit setTone(rt);
}
}
}
@ -448,38 +477,75 @@ void repeaterSetup::on_rptDTCSCombo_activated(int index)
void repeaterSetup::on_toneNone_clicked()
{
rptAccessTxRx rm;
rptrAccessData_t rd;
rm = ratrNN;
emit setRptAccessMode(rm);
rd.accessMode = rm;
emit setRptAccessMode(rd);
bool updateSub = ui->setSplitRptrToneChk->isEnabled() && ui->setSplitRptrToneChk->isChecked();
if(updateSub)
{
rd.useSecondaryVFO = true;
emit setRptAccessMode(rd);
}
}
void repeaterSetup::on_toneTone_clicked()
{
rptAccessTxRx rm;
rptrAccessData_t rd;
rm = ratrTN;
emit setRptAccessMode(rm);
emit setTone((quint16)ui->rptToneCombo->currentData().toUInt());
rd.accessMode = rm;
rptrTone_t rt;
rt.tone = (quint16)ui->rptToneCombo->currentData().toUInt();
emit setRptAccessMode(rd);
emit setTone(rt);
bool updateSub = ui->setSplitRptrToneChk->isEnabled() && ui->setSplitRptrToneChk->isChecked();
if(updateSub)
{
rd.useSecondaryVFO = true;
rt.useSecondaryVFO = true;
emit setRptAccessMode(rd);
emit setTone(rt);
}
}
void repeaterSetup::on_toneTSQL_clicked()
{
rptAccessTxRx rm;
rptrAccessData_t rd;
rm = ratrTT;
emit setRptAccessMode(rm);
emit setTSQL((quint16)ui->rptToneCombo->currentData().toUInt());
rptrTone_t rt;
rt.tone = (quint16)ui->rptToneCombo->currentData().toUInt();
rd.accessMode = rm;
emit setRptAccessMode(rd);
emit setTSQL(rt);
bool updateSub = ui->setSplitRptrToneChk->isEnabled() && ui->setSplitRptrToneChk->isChecked();
if(updateSub)
{
rd.useSecondaryVFO = true;
rt.useSecondaryVFO = true;
emit setRptAccessMode(rd);
emit setTone(rt);
}
}
void repeaterSetup::on_toneDTCS_clicked()
{
rptAccessTxRx rm;
rptrAccessData_t rd;
quint16 dcode=0;
rm = ratrDD;
emit setRptAccessMode(rm);
rd.accessMode = ratrDD;
emit setRptAccessMode(rd);
bool tinv = ui->rptDTCSInvertTx->isChecked();
bool rinv = ui->rptDTCSInvertRx->isChecked();
dcode = (quint16)ui->rptDTCSCombo->currentData().toUInt();
emit setDTCS(dcode, tinv, rinv);
// TODO: DTCS with subband
}
void repeaterSetup::on_debugBtn_clicked()
@ -667,3 +733,13 @@ void repeaterSetup::on_swapMSBtn_clicked()
{
emit swapVFOs();
}
void repeaterSetup::on_setToneSubVFOBtn_clicked()
{
}
void repeaterSetup::on_setRptrSubVFOBtn_clicked()
{
}

Wyświetl plik

@ -23,13 +23,14 @@ public:
signals:
void getDuplexMode();
void setDuplexMode(duplexMode dm);
void setTone(quint16 tone);
void setTSQL(quint16 tsql);
void setTone(rptrTone_t tone);
void setTSQL(rptrTone_t tsql);
void setDTCS(quint16 dcode, bool tinv, bool rinv);
void getTone();
void getTSQL();
void getDTCS();
void setRptAccessMode(rptAccessTxRx tmode);
void setRptAccessMode(rptrAccessData_t rd);
void getRptAccessMode();
// Split:
void getSplitModeEnabled();
@ -93,6 +94,10 @@ private slots:
void on_swapMSBtn_clicked();
void on_setToneSubVFOBtn_clicked();
void on_setRptrSubVFOBtn_clicked();
private:
Ui::repeaterSetup *ui;
freqt currentMainFrequency;

Wyświetl plik

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>1198</width>
<height>217</height>
<height>238</height>
</rect>
</property>
<property name="windowTitle">
@ -141,6 +141,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="setSplitRptrToneChk">
<property name="text">
<string>Set Repeater Tone</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
@ -339,6 +346,13 @@
</attribute>
</widget>
</item>
<item>
<widget class="QPushButton" name="setRptrSubVFOBtn">
<property name="text">
<string>Set Sub VFO</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -394,6 +408,13 @@
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="setToneSubVFOBtn">
<property name="text">
<string>Set Sub VFO</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>

Wyświetl plik

@ -1019,28 +1019,54 @@ void rigCommander::getTransmitFrequency()
void rigCommander::setTone(quint16 tone)
{
rptrTone_t t;
t.tone = tone;
setTone(t);
}
void rigCommander::setTone(rptrTone_t t)
{
quint16 tone = t.tone;
QByteArray fenc = encodeTone(tone);
QByteArray payload;
payload.setRawData("\x1B\x00", 2);
payload.append(fenc);
//qInfo() << __func__ << "TONE encoded payload: ";
printHex(payload);
if(t.useSecondaryVFO)
{
qDebug(logRig()) << "Sending TONE to secondary VFO";
payload.prepend("\x29\x01");
printHex(payload);
}
prepDataAndSend(payload);
}
void rigCommander::setTSQL(quint16 tsql)
void rigCommander::setTSQL(quint16 t)
{
rptrTone_t tn;
tn.tone = t;
setTSQL(tn);
}
void rigCommander::setTSQL(rptrTone_t t)
{
quint16 tsql = t.tone;
QByteArray fenc = encodeTone(tsql);
QByteArray payload;
payload.setRawData("\x1B\x01", 2);
payload.append(fenc);
//qInfo() << __func__ << "TSQL encoded payload: ";
printHex(payload);
if(t.useSecondaryVFO)
{
qDebug(logRig()) << "Sending TSQL to secondary VFO";
payload.prepend("\x29\x01");
printHex(payload);
}
prepDataAndSend(payload);
}
@ -1148,10 +1174,21 @@ void rigCommander::getRptAccessMode()
}
void rigCommander::setRptAccessMode(rptAccessTxRx ratr)
{
rptrAccessData_t rd;
rd.accessMode = ratr;
setRptAccessMode(rd);
}
void rigCommander::setRptAccessMode(rptrAccessData_t rd)
{
QByteArray payload;
payload.setRawData("\x16\x5D", 2);
payload.append((unsigned char)ratr);
payload.append((unsigned char)rd.accessMode);
if(rd.useSecondaryVFO)
{
payload.prepend("\x29\x01");
}
prepDataAndSend(payload);
}

Wyświetl plik

@ -135,13 +135,16 @@ public slots:
void setDuplexMode(duplexMode dm);
void getDuplexMode();
void getTransmitFrequency();
void setTone(quint16 tone);
void setTSQL(quint16 tsql);
void setTone(rptrTone_t t);
void setTSQL(rptrTone_t t);
void setTone(quint16 t);
void setTSQL(quint16 t);
void getTSQL();
void getTone();
void setDTCS(quint16 dcscode, bool tinv, bool rinv);
void getDTCS();
void setRptAccessMode(rptAccessTxRx ratr);
void setRptAccessMode(rptrAccessData_t ratr);
void getRptAccessMode();
// Get Levels:

Wyświetl plik

@ -57,11 +57,13 @@ wfmain::wfmain(const QString settingsFile, const QString logFile, bool debugMode
qRegisterMetaType<rigCapabilities>();
qRegisterMetaType<duplexMode>();
qRegisterMetaType<rptAccessTxRx>();
qRegisterMetaType<rptrAccessData_t>();
qRegisterMetaType<rigInput>();
qRegisterMetaType<meterKind>();
qRegisterMetaType<spectrumMode>();
qRegisterMetaType<freqt>();
qRegisterMetaType<vfo_t>();
qRegisterMetaType<rptrTone_t>();
qRegisterMetaType<mode_info>();
qRegisterMetaType<mode_kind>();
qRegisterMetaType<audioPacket>();
@ -385,11 +387,21 @@ void wfmain::rigConnections()
connect(rpt, SIGNAL(getTone()), rig, SLOT(getTone()));
connect(rpt, SIGNAL(getTSQL()), rig, SLOT(getTSQL()));
connect(rpt, SIGNAL(getDTCS()), rig, SLOT(getDTCS()));
connect(rpt, SIGNAL(setTone(quint16)), rig, SLOT(setTone(quint16)));
connect(rpt, SIGNAL(setTSQL(quint16)), rig, SLOT(setTSQL(quint16)));
connect(this->rpt, &repeaterSetup::setTone,
[=](const rptrTone_t &t) { issueCmd(cmdSetTone, t);});
connect(this->rpt, &repeaterSetup::setTSQL,
[=](const rptrTone_t &t) { issueCmd(cmdSetTSQL, t);});
connect(rpt, SIGNAL(setDTCS(quint16,bool,bool)), rig, SLOT(setDTCS(quint16,bool,bool)));
connect(rpt, SIGNAL(getRptAccessMode()), rig, SLOT(getRptAccessMode()));
connect(rpt, SIGNAL(setRptAccessMode(rptAccessTxRx)), rig, SLOT(setRptAccessMode(rptAccessTxRx)));
//connect(rpt, SIGNAL(setRptAccessMode(rptAccessTxRx)), rig, SLOT(setRptAccessMode(rptAccessTxRx)));
connect(this->rpt, &repeaterSetup::setRptAccessMode,
[=](const rptrAccessData_t &rd) { issueCmd(cmdSetRptAccessMode, rd);});
connect(rig, SIGNAL(haveTone(quint16)), rpt, SLOT(handleTone(quint16)));
connect(rig, SIGNAL(haveTSQL(quint16)), rpt, SLOT(handleTSQL(quint16)));
connect(rig, SIGNAL(haveDTCS(quint16,bool,bool)), rpt, SLOT(handleDTCS(quint16,bool,bool)));
@ -3681,6 +3693,18 @@ void wfmain::doCmd(commandtype cmddata)
emit setTPBFOuter(outerLevel);
break;
}
case cmdSetTone:
{
rptrTone_t t = (*std::static_pointer_cast<rptrTone_t>(data));
emit setTone(t);
break;
}
case cmdSetTSQL:
{
rptrAccessData_t rd = (*std::static_pointer_cast<rptrAccessData_t>(data));
emit setRepeaterAccessMode(rd);
break;
}
case cmdSetPTT:
{
bool pttrequest = (*std::static_pointer_cast<bool>(data));
@ -4108,6 +4132,14 @@ void wfmain::issueCmd(cmds cmd, mode_info m)
delayedCmdQue.push_back(cmddata);
}
void wfmain::issueCmd(cmds cmd, freqt f)
{
commandtype cmddata;
cmddata.cmd = cmd;
cmddata.data = std::shared_ptr<freqt>(new freqt(f));
delayedCmdQue.push_back(cmddata);
}
void wfmain::issueCmd(cmds cmd, vfo_t v)
{
commandtype cmddata;
@ -4116,11 +4148,19 @@ void wfmain::issueCmd(cmds cmd, vfo_t v)
delayedCmdQue.push_back(cmddata);
}
void wfmain::issueCmd(cmds cmd, freqt f)
void wfmain::issueCmd(cmds cmd, rptrTone_t v)
{
commandtype cmddata;
cmddata.cmd = cmd;
cmddata.data = std::shared_ptr<freqt>(new freqt(f));
cmddata.data = std::shared_ptr<rptrTone_t>(new rptrTone_t(v));
delayedCmdQue.push_back(cmddata);
}
void wfmain::issueCmd(cmds cmd, rptrAccessData_t rd)
{
commandtype cmddata;
cmddata.cmd = cmd;
cmddata.data = std::shared_ptr<rptrAccessData_t>(new rptrAccessData_t(rd));
delayedCmdQue.push_back(cmddata);
}

Wyświetl plik

@ -115,6 +115,9 @@ signals:
void getTSQL();
void getDTCS();
void getRptAccessMode();
void setRepeaterAccessMode(rptrAccessData_t rd);
void setTone(rptrTone_t t);
void setTSQL(rptrTone_t t);
// Level get:
void getLevels(); // get all levels
@ -913,6 +916,8 @@ private:
void issueCmd(cmds cmd, freqt f);
void issueCmd(cmds cmd, mode_info m);
void issueCmd(cmds cmd, vfo_t v);
void issueCmd(cmds cmd, rptrTone_t t);
void issueCmd(cmds cmd, rptrAccessData_t rd);
void issueCmd(cmds cmd, timekind t);
void issueCmd(cmds cmd, datekind d);
void issueCmd(cmds cmd, int i);
@ -1140,7 +1145,7 @@ Q_DECLARE_METATYPE(enum rigInput)
Q_DECLARE_METATYPE(enum meterKind)
Q_DECLARE_METATYPE(enum spectrumMode)
Q_DECLARE_METATYPE(enum mode_kind)
Q_DECLARE_METATYPE(enum vfo_t);
Q_DECLARE_METATYPE(enum vfo_t)
Q_DECLARE_METATYPE(QList<radio_cap_packet>)
Q_DECLARE_METATYPE(QList<spotData>)
Q_DECLARE_METATYPE(rigstate*)
@ -1150,6 +1155,10 @@ Q_DECLARE_METATYPE(QVector <COMMAND>*)
Q_DECLARE_METATYPE(const COMMAND*)
Q_DECLARE_METATYPE(codecType)
Q_DECLARE_METATYPE(errorType)
Q_DECLARE_METATYPE(enum duplexMode)
Q_DECLARE_METATYPE(enum rptAccessTxRx)
Q_DECLARE_METATYPE(struct rptrTone_t)
Q_DECLARE_METATYPE(struct rptrAccessData_t)
//void (*wfmain::logthistext)(QString text) = NULL;

Wyświetl plik

@ -72,6 +72,40 @@ enum vfo_t {
vfoSub = 0xD1
};
struct rptrTone_t {
quint16 tone = 0;
bool useSecondaryVFO = false;
};
enum duplexMode {
dmSplitOff=0x00,
dmSplitOn=0x01,
dmSimplex=0x10,
dmDupMinus=0x11,
dmDupPlus=0x12,
dmDupRPS=0x13,
dmDupAutoOn=0x26,
dmDupAutoOff=0x36
};
// Here, T=tone, D=DCS, N=none
// And the naming convention order is Transmit Receive
enum rptAccessTxRx {
ratrNN=0x00,
ratrTN=0x01, // "TONE" (T only)
ratrNT=0x02, // "TSQL" (R only)
ratrDD=0x03, // "DTCS" (TR)
ratrDN=0x06, // "DTCS(T)"
ratrTD=0x07, // "TONE(T) / TSQL(R)"
ratrDT=0x08, // "DTCS(T) / TSQL(R)"
ratrTT=0x09 // "TONE(T) / TSQL(R)"
};
struct rptrAccessData_t {
rptAccessTxRx accessMode = ratrNN;
bool useSecondaryVFO = false;
};
struct mode_info {
mode_kind mk;
unsigned char reg;
@ -119,7 +153,8 @@ enum cmds {
cmdGetCurrentModLevel, cmdStartRegularPolling, cmdStopRegularPolling, cmdQueNormalSpeed,
cmdGetVdMeter, cmdGetIdMeter, cmdGetSMeter, cmdGetCenterMeter, cmdGetPowerMeter,
cmdGetSWRMeter, cmdGetALCMeter, cmdGetCompMeter, cmdGetTxRxMeter,
cmdGetTone, cmdGetTSQL, cmdGetDTCS, cmdGetRptAccessMode, cmdSelVFO, cmdVFOSwap, cmdVFOEqualAB, cmdVFOEqualMS,
cmdGetTone, cmdGetTSQL, cmdGetDTCS, cmdGetRptAccessMode, cmdSetTone, cmdSetTSQL, cmdSetRptAccessMode,
cmdSelVFO, cmdVFOSwap, cmdVFOEqualAB, cmdVFOEqualMS,
cmdGetPreamp, cmdGetAttenuator, cmdGetAntenna,
cmdGetBandStackReg, cmdGetKeySpeed, cmdSetKeySpeed, cmdGetBreakMode, cmdSetBreakMode, cmdSendCW, cmdStopCW,
cmdSetTime, cmdSetDate, cmdSetUTCOffset