kopia lustrzana https://gitlab.com/eliggett/wfview
Various fixes to USB controllers
rodzic
3faf8d331c
commit
479671386e
1
prefs.h
1
prefs.h
|
@ -45,6 +45,7 @@ struct preferences {
|
|||
bool enablePTT;
|
||||
bool niceTS;
|
||||
bool automaticSidebandSwitching = true;
|
||||
bool enableUSBControllers;
|
||||
|
||||
// LAN:
|
||||
bool enableLAN;
|
||||
|
|
|
@ -42,17 +42,17 @@ struct COMMAND {
|
|||
|
||||
COMMAND(int index, QString text, int command, char suffix) :
|
||||
index(index), text(text), command(command), suffix(suffix) {}
|
||||
COMMAND(int index, QString text, int command, bandType band) :
|
||||
COMMAND(int index, QString text, int command, availableBands band) :
|
||||
index(index), text(text), command(command), band(band) {}
|
||||
COMMAND(int index, QString text, int command, mode_kind mode) :
|
||||
index(index), text(text), command(command), mode(mode) {}
|
||||
|
||||
int index;
|
||||
int index=0;
|
||||
QString text;
|
||||
int command;
|
||||
unsigned char suffix;
|
||||
bandType band;
|
||||
mode_kind mode;
|
||||
int command=0;
|
||||
unsigned char suffix=0x0;
|
||||
availableBands band=bandGen;
|
||||
mode_kind mode=modeLSB;
|
||||
};
|
||||
|
||||
struct BUTTON {
|
||||
|
|
91
wfmain.cpp
91
wfmain.cpp
|
@ -167,12 +167,8 @@ wfmain::wfmain(const QString settingsFile, const QString logFile, bool debugMode
|
|||
|
||||
amTransmitting = false;
|
||||
|
||||
#if defined(USB_CONTROLLER)
|
||||
// Setup USB Controller
|
||||
setupUsbControllerDevice();
|
||||
emit sendUsbControllerCommands(&usbCommands);
|
||||
emit sendUsbControllerButtons(&usbButtons);
|
||||
#else
|
||||
#if !defined(USB_CONTROLLER)
|
||||
ui->enableUsbChk->setVisible(false);
|
||||
ui->usbControllerBtn->setVisible(false);
|
||||
#endif
|
||||
|
||||
|
@ -1698,7 +1694,7 @@ void wfmain::buttonControl(const COMMAND* cmd)
|
|||
{
|
||||
switch (cmd->command) {
|
||||
case cmdGetBandStackReg:
|
||||
issueCmd((cmds)cmd->command, cmd->band.band);
|
||||
issueCmd((cmds)cmd->command, cmd->band);
|
||||
break;
|
||||
case cmdSetBandUp:
|
||||
for (size_t i = 0; i < rigCaps.bands.size(); i++) {
|
||||
|
@ -1857,6 +1853,7 @@ void wfmain::setDefPrefs()
|
|||
defPrefs.tcpPort = 0;
|
||||
defPrefs.waterfallFormat = 0;
|
||||
defPrefs.audioSystem = qtAudio;
|
||||
defPrefs.enableUSBControllers = false;
|
||||
|
||||
udpDefPrefs.ipAddress = QString("");
|
||||
udpDefPrefs.controlLANPort = 50001;
|
||||
|
@ -2397,8 +2394,20 @@ void wfmain::loadSettings()
|
|||
settings->endGroup();
|
||||
|
||||
#if defined (USB_CONTROLLER)
|
||||
/* Load USB buttons*/
|
||||
settings->beginGroup("USB");
|
||||
/* Load USB buttons*/
|
||||
prefs.enableUSBControllers = settings->value("EnableUSBControllers", defPrefs.enableUSBControllers).toBool();
|
||||
ui->enableUsbChk->blockSignals(true);
|
||||
ui->enableUsbChk->setChecked(prefs.enableUSBControllers);
|
||||
ui->enableUsbChk->blockSignals(false);
|
||||
ui->usbControllerBtn->setEnabled(prefs.enableUSBControllers);
|
||||
if (prefs.enableUSBControllers) {
|
||||
// Setup USB Controller
|
||||
setupUsbControllerDevice();
|
||||
emit sendUsbControllerCommands(&usbCommands);
|
||||
emit sendUsbControllerButtons(&usbButtons);
|
||||
}
|
||||
|
||||
int numCommands = settings->beginReadArray("Commands");
|
||||
// This is the last time the commands were changed (v1.58)
|
||||
if (numCommands == 0 || priorVersionFloat < 1.58) {
|
||||
|
@ -2459,32 +2468,6 @@ void wfmain::loadSettings()
|
|||
usbCommands.append(COMMAND(51, "Split On", cmdNone, 0x01));
|
||||
usbCommands.append(COMMAND(52, "Split Off", cmdNone, 0x0));
|
||||
|
||||
|
||||
/*
|
||||
modeLSB = 0x00,
|
||||
modeUSB = 0x01,
|
||||
modeAM = 0x02,
|
||||
modeCW = 0x03,
|
||||
modeRTTY = 0x04,
|
||||
modeFM = 0x05,
|
||||
modeCW_R = 0x07,
|
||||
modeRTTY_R = 0x08,
|
||||
modeLSB_D = 0x80,
|
||||
modeUSB_D = 0x81,
|
||||
modeDV = 0x17,
|
||||
modeDD = 0x27,
|
||||
modeWFM,
|
||||
modeS_AMD,
|
||||
modeS_AML,
|
||||
modeS_AMU,
|
||||
modeP25,
|
||||
modedPMR,
|
||||
modeNXDN_VN,
|
||||
modeNXDN_N,
|
||||
modeDCR,
|
||||
modePSK,
|
||||
modePSK_R
|
||||
*/
|
||||
}
|
||||
else {
|
||||
for (int nc = 0; nc < numCommands; nc++)
|
||||
|
@ -2494,7 +2477,9 @@ void wfmain::loadSettings()
|
|||
comm.index = settings->value("Num", 0).toInt();
|
||||
comm.text = settings->value("Text", "").toString();
|
||||
comm.command = settings->value("Command", 0).toInt();
|
||||
//comm.band = (bandType)settings->value("Band", 0).toInt(); // Needs fixing!
|
||||
comm.band = (availableBands)settings->value("Band", 0).toInt();
|
||||
comm.mode = (mode_kind)settings->value("Mode", 0).toInt();
|
||||
comm.suffix = (unsigned char)settings->value("Suffix", 0).toInt();
|
||||
usbCommands.append(comm);
|
||||
}
|
||||
settings->endArray();
|
||||
|
@ -2986,6 +2971,7 @@ void wfmain::saveSettings()
|
|||
#if defined(USB_CONTROLLER)
|
||||
settings->beginGroup("USB");
|
||||
// Store USB Controller
|
||||
settings->setValue("EnableUSBControllers", prefs.enableUSBControllers);
|
||||
|
||||
settings->beginWriteArray("Buttons");
|
||||
for (int nb = 0; nb < usbButtons.count(); nb++)
|
||||
|
@ -3007,6 +2993,21 @@ void wfmain::saveSettings()
|
|||
|
||||
settings->endArray();
|
||||
|
||||
settings->beginWriteArray("Commands");
|
||||
for (int nc = 0; nc < usbCommands.count(); nc++)
|
||||
{
|
||||
settings->setArrayIndex(nc);
|
||||
|
||||
settings->setValue("Num", usbCommands[nc].index);
|
||||
settings->setValue("Text", usbCommands[nc].text);
|
||||
settings->setValue("Command", usbCommands[nc].command);
|
||||
settings->setValue("Band", usbCommands[nc].band);
|
||||
settings->setValue("Mode", usbCommands[nc].mode);
|
||||
settings->setValue("Suffix", usbCommands[nc].suffix);
|
||||
}
|
||||
|
||||
settings->endArray();
|
||||
|
||||
settings->endGroup();
|
||||
#endif
|
||||
|
||||
|
@ -9006,6 +9007,26 @@ void wfmain::on_clickDragTuningEnableChk_clicked(bool checked)
|
|||
prefs.clickDragTuningEnable = checked;
|
||||
}
|
||||
|
||||
void wfmain::on_enableUsbChk_clicked(bool checked)
|
||||
{
|
||||
prefs.enableUSBControllers = checked;
|
||||
ui->usbControllerBtn->setEnabled(checked);
|
||||
|
||||
#if defined (USB_CONTROLLER)
|
||||
if (usbControllerThread != Q_NULLPTR) {
|
||||
usbControllerThread->quit();
|
||||
usbControllerThread->wait();
|
||||
usbControllerThread = Q_NULLPTR;
|
||||
}
|
||||
if (checked) {
|
||||
// Setup USB Controller
|
||||
setupUsbControllerDevice();
|
||||
emit sendUsbControllerCommands(&usbCommands);
|
||||
emit sendUsbControllerButtons(&usbButtons);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void wfmain::on_usbControllerBtn_clicked()
|
||||
{
|
||||
if (shut != Q_NULLPTR) {
|
||||
|
|
1
wfmain.h
1
wfmain.h
|
@ -391,6 +391,7 @@ private slots:
|
|||
|
||||
void on_fEnterBtn_clicked();
|
||||
void on_usbControllerBtn_clicked();
|
||||
void on_enableUsbChk_clicked(bool checked);
|
||||
|
||||
void on_scopeBWCombo_currentIndexChanged(int index);
|
||||
|
||||
|
|
56
wfmain.ui
56
wfmain.ui
|
@ -6,7 +6,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1063</width>
|
||||
<width>1012</width>
|
||||
<height>660</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -18,7 +18,7 @@
|
|||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>3</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="mainTab">
|
||||
<attribute name="title">
|
||||
|
@ -1808,7 +1808,6 @@
|
|||
<font>
|
||||
<family>DejaVu Sans Mono</family>
|
||||
<pointsize>14</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
|
@ -2233,7 +2232,7 @@
|
|||
<item>
|
||||
<widget class="QStackedWidget" name="settingsStack">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>4</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="radioAccess">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_21">
|
||||
|
@ -3431,8 +3430,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>570</width>
|
||||
<height>224</height>
|
||||
<width>790</width>
|
||||
<height>302</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
|
@ -4951,6 +4950,37 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_46">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="enableUsbChk">
|
||||
<property name="text">
|
||||
<string>Enable USB Controllers</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="usbControllerBtn">
|
||||
<property name="text">
|
||||
<string>Setup USB Controllers</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_38">
|
||||
<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>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_4">
|
||||
<property name="orientation">
|
||||
|
@ -5255,13 +5285,6 @@
|
|||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_45">
|
||||
<item>
|
||||
<widget class="QPushButton" name="usbControllerBtn">
|
||||
<property name="text">
|
||||
<string>Setup USB Controller</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_361">
|
||||
<property name="orientation">
|
||||
|
@ -5381,7 +5404,6 @@
|
|||
<widget class="QPushButton" name="exitBtn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
|
@ -5400,8 +5422,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1063</width>
|
||||
<height>21</height>
|
||||
<width>1012</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
|
@ -5429,7 +5451,7 @@
|
|||
<connections/>
|
||||
<buttongroups>
|
||||
<buttongroup name="buttonGroup"/>
|
||||
<buttongroup name="underlayButtonGroup"/>
|
||||
<buttongroup name="pollingButtonGroup"/>
|
||||
<buttongroup name="underlayButtonGroup"/>
|
||||
</buttongroups>
|
||||
</ui>
|
||||
|
|
Ładowanie…
Reference in New Issue