kopia lustrzana https://gitlab.com/eliggett/wfview
First step at improving LED support
rodzic
5d897c127a
commit
8ad74ac7f6
|
@ -1889,7 +1889,7 @@ void rigCommander::parseLevels()
|
|||
state.set(COMPLEVEL, level, false);
|
||||
break;
|
||||
case '\x12':
|
||||
// NB level - ignore for now
|
||||
emit haveNB((bool)level);
|
||||
state.set(NB, level, false);
|
||||
break;
|
||||
case '\x15':
|
||||
|
@ -3075,9 +3075,11 @@ void rigCommander::parseRegister16()
|
|||
state.set(PREAMP, (quint8)payloadIn.at(2), false);
|
||||
break;
|
||||
case '\x22':
|
||||
emit haveNB(payloadIn.at(2) != 0);
|
||||
state.set(NBFUNC, payloadIn.at(2) != 0, false);
|
||||
break;
|
||||
case '\x40':
|
||||
emit haveNR(payloadIn.at(2) != 0);
|
||||
state.set(NRFUNC, payloadIn.at(2) != 0, false);
|
||||
break;
|
||||
case '\x41': // Auto notch
|
||||
|
@ -3104,12 +3106,15 @@ void rigCommander::parseRegister16()
|
|||
emit haveRptAccessMode(ra);
|
||||
break;
|
||||
case '\x44':
|
||||
emit haveComp(payloadIn.at(2) != 0);
|
||||
state.set(COMPFUNC, payloadIn.at(2) != 0, false);
|
||||
break;
|
||||
case '\x45':
|
||||
emit haveMonitor(payloadIn.at(2) != 0);
|
||||
state.set(MONFUNC, payloadIn.at(2) != 0, false);
|
||||
break;
|
||||
case '\x46':
|
||||
emit haveVox(payloadIn.at(2) != 0);
|
||||
state.set(VOXFUNC, payloadIn.at(2) != 0, false);
|
||||
break;
|
||||
case '\x47':
|
||||
|
@ -4933,26 +4938,26 @@ void rigCommander::setAntenna(unsigned char ant, bool rx)
|
|||
prepDataAndSend(payload);
|
||||
}
|
||||
|
||||
void rigCommander::setNb(bool enabled) {
|
||||
void rigCommander::setNB(bool enabled) {
|
||||
QByteArray payload("\x16\x22");
|
||||
payload.append((unsigned char)enabled);
|
||||
prepDataAndSend(payload);
|
||||
}
|
||||
|
||||
void rigCommander::getNb()
|
||||
void rigCommander::getNB()
|
||||
{
|
||||
QByteArray payload;
|
||||
payload.setRawData("\x16\x22", 2);
|
||||
prepDataAndSend(payload);
|
||||
}
|
||||
|
||||
void rigCommander::setNr(bool enabled) {
|
||||
void rigCommander::setNR(bool enabled) {
|
||||
QByteArray payload("\x16\x40");
|
||||
payload.append((unsigned char)enabled);
|
||||
prepDataAndSend(payload);
|
||||
}
|
||||
|
||||
void rigCommander::getNr()
|
||||
void rigCommander::getNR()
|
||||
{
|
||||
QByteArray payload;
|
||||
payload.setRawData("\x16\x40", 2);
|
||||
|
@ -5346,15 +5351,15 @@ void rigCommander::stateUpdated()
|
|||
break;
|
||||
case NBFUNC:
|
||||
if (i.value()._valid) {
|
||||
setNb(state.getBool(NBFUNC));
|
||||
setNB(state.getBool(NBFUNC));
|
||||
}
|
||||
getNb();
|
||||
getNB();
|
||||
break;
|
||||
case NRFUNC:
|
||||
if (i.value()._valid) {
|
||||
setNr(state.getBool(NRFUNC));
|
||||
setNR(state.getBool(NRFUNC));
|
||||
}
|
||||
getNr();
|
||||
getNR();
|
||||
break;
|
||||
case ANFFUNC:
|
||||
if (i.value()._valid) {
|
||||
|
|
|
@ -104,10 +104,10 @@ public slots:
|
|||
void setAttenuator(unsigned char att);
|
||||
void setPreamp(unsigned char pre);
|
||||
void setAntenna(unsigned char ant, bool rx);
|
||||
void setNb(bool enabled);
|
||||
void getNb();
|
||||
void setNr(bool enabled);
|
||||
void getNr();
|
||||
void setNB(bool enabled);
|
||||
void getNB();
|
||||
void setNR(bool enabled);
|
||||
void getNR();
|
||||
void setAutoNotch(bool enabled);
|
||||
void getAutoNotch();
|
||||
void setToneEnabled(bool enabled);
|
||||
|
|
|
@ -18,22 +18,22 @@ usbController::usbController()
|
|||
loadKnobs();
|
||||
|
||||
// This is a the "master" list of supported devices. Maybe move to settings at some point?
|
||||
// usbDeviceType, manufacturer, product, usage, usagePage, butons, knobs, maxPayload, iconSize
|
||||
knownDevices.append(USBTYPE(shuttleXpress,0x0b33,0x0020,0x0000,0x0000,15,2,5,0));
|
||||
knownDevices.append(USBTYPE(shuttlePro2,0x0b33,0x0030,0x0000,0x0000,15,2,5,0));
|
||||
knownDevices.append(USBTYPE(shuttlePro2,0x0b33,0x0011,0x0000,0x0000,15,2,5,0)); // Actually a ShuttlePro but hopefully will work?
|
||||
knownDevices.append(USBTYPE(RC28,0x0c26,0x001e,0x0000,0x0000,3,1,64,0));
|
||||
knownDevices.append(USBTYPE(eCoderPlus, 0x1fc9, 0x0003,0x0000,0x0000,22,4,32,0)); // Actually 20 but some bit0 and bit15 aren't used
|
||||
knownDevices.append(USBTYPE(QuickKeys, 0x28bd, 0x5202,0x0001,0xff0a,10,1,32,0));
|
||||
knownDevices.append(USBTYPE(StreamDeckMini, 0x0fd9, 0x0063, 0x0000, 0x0000,6,0,1024,80));
|
||||
knownDevices.append(USBTYPE(StreamDeckMiniV2, 0x0fd9, 0x0090, 0x0000, 0x0000,6,0,1024,80));
|
||||
knownDevices.append(USBTYPE(StreamDeckOriginal, 0x0fd9, 0x0060, 0x0000, 0x0000,15,0,8191,72));
|
||||
knownDevices.append(USBTYPE(StreamDeckOriginalV2, 0x0fd9, 0x006d, 0x0000, 0x0000,15,0,1024,72));
|
||||
knownDevices.append(USBTYPE(StreamDeckOriginalMK2, 0x0fd9, 0x0080, 0x0000, 0x0000,15,0,1024,72));
|
||||
knownDevices.append(USBTYPE(StreamDeckXL, 0x0fd9, 0x006c, 0x0000, 0x0000,32,0,1024,96));
|
||||
knownDevices.append(USBTYPE(StreamDeckXLV2, 0x0fd9, 0x008f, 0x0000, 0x0000,32,0,1024,96));
|
||||
knownDevices.append(USBTYPE(StreamDeckPedal, 0x0fd9, 0x0086, 0x0000, 0x0000,3,0,1024,0));
|
||||
knownDevices.append(USBTYPE(StreamDeckPlus, 0x0fd9, 0x0084, 0x0000, 0x0000,12,4,1024,120));
|
||||
// usbDeviceType, manufacturer, product, usage, usagePage, butons, knobs, leds, maxPayload, iconSize
|
||||
knownDevices.append(USBTYPE(shuttleXpress,0x0b33,0x0020,0x0000,0x0000,15,2,0,5,0));
|
||||
knownDevices.append(USBTYPE(shuttlePro2,0x0b33,0x0030,0x0000,0x0000,15,2,0,5,0));
|
||||
knownDevices.append(USBTYPE(shuttlePro2,0x0b33,0x0011,0x0000,0x0000,15,2,0,5,0)); // Actually a ShuttlePro but hopefully will work?
|
||||
knownDevices.append(USBTYPE(RC28,0x0c26,0x001e,0x0000,0x0000,3,1,3,64,0));
|
||||
knownDevices.append(USBTYPE(eCoderPlus, 0x1fc9, 0x0003,0x0000,0x0000,22,4,0,32,0)); // Actually 20 but some bit0 and bit15 aren't used
|
||||
knownDevices.append(USBTYPE(QuickKeys, 0x28bd, 0x5202,0x0001,0xff0a,10,1,0,32,0));
|
||||
knownDevices.append(USBTYPE(StreamDeckMini, 0x0fd9, 0x0063, 0x0000, 0x0000,6,0,0,1024,80));
|
||||
knownDevices.append(USBTYPE(StreamDeckMiniV2, 0x0fd9, 0x0090, 0x0000, 0x0000,6,0,0,1024,80));
|
||||
knownDevices.append(USBTYPE(StreamDeckOriginal, 0x0fd9, 0x0060, 0x0000, 0x0000,15,0,0,8191,72));
|
||||
knownDevices.append(USBTYPE(StreamDeckOriginalV2, 0x0fd9, 0x006d, 0x0000, 0x0000,15,0,0,1024,72));
|
||||
knownDevices.append(USBTYPE(StreamDeckOriginalMK2, 0x0fd9, 0x0080, 0x0000, 0x0000,15,0,0,1024,72));
|
||||
knownDevices.append(USBTYPE(StreamDeckXL, 0x0fd9, 0x006c, 0x0000, 0x0000,32,0,0,1024,96));
|
||||
knownDevices.append(USBTYPE(StreamDeckXLV2, 0x0fd9, 0x008f, 0x0000, 0x0000,32,0,0,1024,96));
|
||||
knownDevices.append(USBTYPE(StreamDeckPedal, 0x0fd9, 0x0086, 0x0000, 0x0000,3,0,0,1024,0));
|
||||
knownDevices.append(USBTYPE(StreamDeckPlus, 0x0fd9, 0x0084, 0x0000, 0x0000,12,4,0,1024,120));
|
||||
}
|
||||
|
||||
usbController::~usbController()
|
||||
|
@ -47,7 +47,7 @@ usbController::~usbController()
|
|||
sendRequest(dev,usbFeatureType::featureOverlay,60,"Goodbye from wfview");
|
||||
|
||||
if (dev->type.model == RC28) {
|
||||
sendRequest(dev,usbFeatureType::featureLEDControl,3,"off");
|
||||
sendRequest(dev,usbFeatureType::featureLEDControl,3,"0");
|
||||
}
|
||||
hid_close(dev->handle);
|
||||
dev->handle = NULL;
|
||||
|
@ -326,10 +326,10 @@ void usbController::run()
|
|||
|
||||
if (dev->type.model == RC28)
|
||||
{
|
||||
QTimer::singleShot(0, this, [=]() { sendRequest(dev,usbFeatureType::featureLEDControl,0,"off"); });
|
||||
QTimer::singleShot(0, this, [=]() { sendRequest(dev,usbFeatureType::featureLEDControl,1,"off"); });
|
||||
QTimer::singleShot(0, this, [=]() { sendRequest(dev,usbFeatureType::featureLEDControl,2,"off"); });
|
||||
QTimer::singleShot(0, this, [=]() { sendRequest(dev,usbFeatureType::featureLEDControl,3,"on"); });
|
||||
QTimer::singleShot(0, this, [=]() { sendRequest(dev,usbFeatureType::featureLEDControl,0,"0"); });
|
||||
QTimer::singleShot(0, this, [=]() { sendRequest(dev,usbFeatureType::featureLEDControl,1,"0"); });
|
||||
QTimer::singleShot(0, this, [=]() { sendRequest(dev,usbFeatureType::featureLEDControl,2,"0"); });
|
||||
QTimer::singleShot(0, this, [=]() { sendRequest(dev,usbFeatureType::featureLEDControl,3,"1"); });
|
||||
}
|
||||
else if (dev->type.model == QuickKeys)
|
||||
{
|
||||
|
@ -356,6 +356,7 @@ void usbController::run()
|
|||
dev->knobValues.append(KNOBVALUE());
|
||||
}
|
||||
|
||||
|
||||
// Find our defaults/knobs/buttons for this controller:
|
||||
// First see if we have any stored and add them to the list if not.
|
||||
|
||||
|
@ -807,11 +808,11 @@ void usbController::receivePTTStatus(bool on) {
|
|||
if (on && !ptt) {
|
||||
lastColour = currentColour;
|
||||
QColor newColor = QColor(255,0,0);
|
||||
sendRequest(dev,usbFeatureType::featureLEDControl,0,"on");
|
||||
sendRequest(dev,usbFeatureType::featureLEDControl,0,"1");
|
||||
sendRequest(dev,usbFeatureType::featureColor,0, "", Q_NULLPTR, &newColor);
|
||||
}
|
||||
else {
|
||||
sendRequest(dev,usbFeatureType::featureLEDControl,0,"off");
|
||||
sendRequest(dev,usbFeatureType::featureLEDControl,0,"0");
|
||||
sendRequest(dev,usbFeatureType::featureColor,0, "", Q_NULLPTR, &lastColour);
|
||||
}
|
||||
}
|
||||
|
@ -1262,10 +1263,10 @@ void usbController::sendRequest(USBDEVICE *dev, usbFeatureType feature, int val,
|
|||
break;
|
||||
case usbFeatureType::featureLEDControl:
|
||||
data[1] = 0x01;
|
||||
if (text == "on")
|
||||
dev->ledStatus &= ~(1UL << val);
|
||||
else
|
||||
if (text == "0")
|
||||
dev->ledStatus |= 1UL << val;
|
||||
else
|
||||
dev->ledStatus &= ~(1UL << val);
|
||||
data[2] = dev->ledStatus;
|
||||
break;
|
||||
default:
|
||||
|
@ -1299,7 +1300,7 @@ void usbController::programDisable(USBDEVICE* dev, bool disabled)
|
|||
sendRequest(dev,usbFeatureType::featureOverlay,60,"Goodbye from wfview");
|
||||
|
||||
if (dev->type.model == RC28) {
|
||||
sendRequest(dev,usbFeatureType::featureLEDControl,3,"off");
|
||||
sendRequest(dev,usbFeatureType::featureLEDControl,3,"0");
|
||||
}
|
||||
|
||||
QMutexLocker locker(mutex);
|
||||
|
@ -1346,9 +1347,9 @@ void usbController::loadButtons()
|
|||
defaultButtons.append(BUTTON(shuttlePro2, 14, QRect(280, 195, 25, 80), Qt::red, &commands[0], &commands[0]));
|
||||
|
||||
// RC28
|
||||
defaultButtons.append(BUTTON(RC28, 0, QRect(52, 445, 238, 64), Qt::red, &commands[1], &commands[2])); // PTT On/OFF
|
||||
defaultButtons.append(BUTTON(RC28, 1, QRect(52, 373, 98, 46), Qt::red, &commands[0], &commands[0]));
|
||||
defaultButtons.append(BUTTON(RC28, 2, QRect(193, 373, 98, 46), Qt::red, &commands[0], &commands[0]));
|
||||
defaultButtons.append(BUTTON(RC28, 0, QRect(52, 445, 238, 64), Qt::red, &commands[1], &commands[2],false,0)); // PTT On/OFF
|
||||
defaultButtons.append(BUTTON(RC28, 1, QRect(52, 373, 98, 46), Qt::red, &commands[0], &commands[0],false,1));
|
||||
defaultButtons.append(BUTTON(RC28, 2, QRect(193, 373, 98, 46), Qt::red, &commands[0], &commands[0],false,2));
|
||||
|
||||
// Xbox Gamepad
|
||||
defaultButtons.append(BUTTON(xBoxGamepad, "UP", QRect(256, 229, 50, 50), Qt::red, &commands[0], &commands[0]));
|
||||
|
@ -1584,14 +1585,14 @@ void usbController::loadCommands()
|
|||
int num = 0;
|
||||
// Important commands at the top!
|
||||
commands.append(COMMAND(num++, "None", commandAny, cmdNone, (quint8)0x0));
|
||||
commands.append(COMMAND(num++, "PTT On", commandButton, cmdSetPTT, (quint8)0x1));
|
||||
commands.append(COMMAND(num++, "PTT Off", commandButton, cmdSetPTT, (quint8)0x0));
|
||||
commands.append(COMMAND(num++, "VFOA", commandKnob, cmdSetFreq, (quint8)0x0));
|
||||
commands.append(COMMAND(num++, "VFOB", commandKnob, cmdSetFreq, (quint8)0x1));
|
||||
commands.append(COMMAND(num++, "Freq Down", commandButton, cmdSetFreq, (int)-1));
|
||||
commands.append(COMMAND(num++, "Freq Up", commandButton, cmdSetFreq, (int)1));
|
||||
commands.append(COMMAND(num++, "PTT Off", commandButton, cmdSetPTT, (quint8)0x0));
|
||||
commands.append(COMMAND(num++, "PTT Toggle", commandButton, cmdPTTToggle, (quint8)0x0));
|
||||
commands.append(COMMAND(num++, "PTT On", commandButton, cmdSetPTT, cmdGetPTT, (quint8)0x1));
|
||||
commands.append(COMMAND(num++, "PTT Off", commandButton, cmdSetPTT, cmdGetPTT, (quint8)0x0));
|
||||
commands.append(COMMAND(num++, "VFOA", commandKnob, cmdSetFreq, cmdGetFreq, (quint8)0x0));
|
||||
commands.append(COMMAND(num++, "VFOB", commandKnob, cmdSetFreq, cmdGetFreq, (quint8)0x1));
|
||||
commands.append(COMMAND(num++, "Freq Down", commandButton, cmdSetFreq, cmdGetFreq, (int)-1));
|
||||
commands.append(COMMAND(num++, "Freq Up", commandButton, cmdSetFreq, cmdGetFreq, (int)1));
|
||||
commands.append(COMMAND(num++, "PTT Off", commandButton, cmdSetPTT, cmdGetPTT, (quint8)0x0));
|
||||
commands.append(COMMAND(num++, "PTT Toggle", commandButton, cmdPTTToggle, cmdGetPTT, (quint8)0x0));
|
||||
commands.append(COMMAND(num++, "Span/Step", commandKnob, cmdSeparator, (quint8)0x0));
|
||||
commands.append(COMMAND(num++, "Tune", commandButton, cmdStartATU, (quint8)0x0));
|
||||
commands.append(COMMAND(num++, "Span/Step", commandButton, cmdSeparator, (quint8)0x0));
|
||||
|
@ -1640,19 +1641,19 @@ void usbController::loadCommands()
|
|||
commands.append(COMMAND(num++, "Band 2200m", commandButton, cmdGetBandStackReg, band2200m));
|
||||
commands.append(COMMAND(num++, "Band GEN", commandButton, cmdGetBandStackReg, bandGen));
|
||||
commands.append(COMMAND(num++, "NB/NR", commandButton, cmdSeparator, (quint8)0x0));
|
||||
commands.append(COMMAND(num++, "NR On", commandButton, cmdSetNR, (quint8)0x01));
|
||||
commands.append(COMMAND(num++, "NR Off", commandButton, cmdSetNR, (quint8)0x0));
|
||||
commands.append(COMMAND(num++, "NB On", commandButton, cmdSetNB, (quint8)0x01));
|
||||
commands.append(COMMAND(num++, "NB Off", commandButton, cmdSetNB, (quint8)0x0));
|
||||
commands.append(COMMAND(num++, "Moni On", commandButton, cmdSetMonitor, (quint8)0x01));
|
||||
commands.append(COMMAND(num++, "Moni Off", commandButton, cmdSetMonitor, (quint8)0x0));
|
||||
commands.append(COMMAND(num++, "Comp On", commandButton, cmdSetComp, (quint8)0x01));
|
||||
commands.append(COMMAND(num++, "Comp Off", commandButton, cmdSetComp, (quint8)0x0));
|
||||
commands.append(COMMAND(num++, "Vox On", commandButton, cmdSetVox, (quint8)0x01));
|
||||
commands.append(COMMAND(num++, "Vox Off", commandButton, cmdSetVox, (quint8)0x0));
|
||||
commands.append(COMMAND(num++, "NR On", commandButton, cmdSetNR, cmdGetNR, (quint8)0x01));
|
||||
commands.append(COMMAND(num++, "NR Off", commandButton, cmdSetNR, cmdGetNR, (quint8)0x0));
|
||||
commands.append(COMMAND(num++, "NB On", commandButton, cmdSetNB, cmdGetNB, (quint8)0x01));
|
||||
commands.append(COMMAND(num++, "NB Off", commandButton, cmdSetNB, cmdGetNB, (quint8)0x0));
|
||||
commands.append(COMMAND(num++, "Moni On", commandButton, cmdSetMonitor, cmdGetMonitor, (quint8)0x01));
|
||||
commands.append(COMMAND(num++, "Moni Off", commandButton, cmdSetMonitor, cmdGetMonitor, (quint8)0x0));
|
||||
commands.append(COMMAND(num++, "Comp On", commandButton, cmdSetComp, cmdGetComp, (quint8)0x01));
|
||||
commands.append(COMMAND(num++, "Comp Off", commandButton, cmdSetComp, cmdGetComp, (quint8)0x0));
|
||||
commands.append(COMMAND(num++, "Vox On", commandButton, cmdSetVox, cmdGetVox, (quint8)0x01));
|
||||
commands.append(COMMAND(num++, "Vox Off", commandButton, cmdSetVox, cmdGetVox, (quint8)0x0));
|
||||
commands.append(COMMAND(num++, "Split", commandButton, cmdNone, (quint8)0x0));
|
||||
commands.append(COMMAND(num++, "Split On", commandButton, cmdSetQuickSplit, (quint8)0x01));
|
||||
commands.append(COMMAND(num++, "Split Off", commandButton, cmdSetQuickSplit, (quint8)0x0));
|
||||
commands.append(COMMAND(num++, "Split On", commandButton, cmdSetQuickSplit, cmdGetDuplexMode, (quint8)0x01));
|
||||
commands.append(COMMAND(num++, "Split Off", commandButton, cmdSetQuickSplit, cmdGetDuplexMode, (quint8)0x0));
|
||||
commands.append(COMMAND(num++, "Swap VFO", commandButton, cmdVFOSwap, (quint8)0x0));
|
||||
commands.append(COMMAND(num++, "Scope", commandButton, cmdNone, (quint8)0x0));
|
||||
commands.append(COMMAND(num++, "Spectrum", commandButton, cmdLCDSpectrum, (quint8)0x0));
|
||||
|
@ -1828,13 +1829,19 @@ void usbController::receiveLevel(cmds cmd, unsigned char level)
|
|||
auto dev = &devIt.value();
|
||||
|
||||
auto kb = std::find_if(knobList->begin(), knobList->end(), [dev, cmd](const KNOB& k)
|
||||
{ return (k.command && dev->connected && k.path == dev->path && k.page == dev->currentPage && k.command->getCommand == cmd);});
|
||||
{ return (k.command && dev->connected && k.path == dev->path && k.page == dev->currentPage && k.command->getCommand == cmd);});
|
||||
if (kb != knobList->end() && kb->num < dev->knobValues.size()) {
|
||||
qInfo(logUsbControl()) << "Received value:" << level << "for knob" << kb->num;
|
||||
// Set both current and previous knobvalue to the received value
|
||||
dev->knobValues[kb->num].value = level/dev->sensitivity;
|
||||
dev->knobValues[kb->num].previous = level/dev->sensitivity;
|
||||
}
|
||||
auto bt = std::find_if(buttonList->begin(), buttonList->end(), [dev, cmd](const BUTTON& b)
|
||||
{ return (b.onCommand && dev->connected && b.path == dev->path && b.page == dev->currentPage && b.onCommand->getCommand == cmd && b.led != -1);});
|
||||
if (bt != buttonList->end() && bt->led < dev->type.leds) {
|
||||
qInfo(logUsbControl()) << "Received value:" << level << "for led" << bt->led;
|
||||
QTimer::singleShot(0, this, [=]() { sendRequest(dev,usbFeatureType::featureLEDControl,bt->led,QString("%1").arg(level)); });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1889,6 +1896,9 @@ void usbController::backupController(USBDEVICE* dev, QString file)
|
|||
if (b->offCommand != Q_NULLPTR)
|
||||
settings->setValue("OffCommand", b->offCommand->text);
|
||||
settings->setValue("Graphics",b->graphics);
|
||||
if (b->led > -1) {
|
||||
settings->setValue("Led", b->led);
|
||||
}
|
||||
++n;
|
||||
}
|
||||
}
|
||||
|
@ -2002,6 +2012,7 @@ void usbController::restoreController(USBDEVICE* dev, QString file)
|
|||
but.on = settings->value("OnCommand", "None").toString();
|
||||
but.off = settings->value("OffCommand", "None").toString();
|
||||
but.graphics = settings->value("Graphics",false).toBool();
|
||||
but.led = settings->value("Led", -1).toInt();
|
||||
but.path = dev->path;
|
||||
qInfo(logUsbControl()) << "Restoring button" << but.num << "On" << but.on << "Off" << but.off;
|
||||
buttonList->append(BUTTON(but));
|
||||
|
|
|
@ -70,8 +70,8 @@ using namespace std;
|
|||
|
||||
struct USBTYPE {
|
||||
USBTYPE() {}
|
||||
USBTYPE(usbDeviceType model,quint32 manufacturerId, quint32 productId , quint32 usage, quint32 usagePage, int buttons, int knobs, int maxPayload, int iconSize) :
|
||||
model(model), manufacturerId(manufacturerId), productId(productId), usage(usage), usagePage(usagePage), buttons(buttons), knobs(knobs),maxPayload(maxPayload), iconSize(iconSize) {}
|
||||
USBTYPE(usbDeviceType model,quint32 manufacturerId, quint32 productId , quint32 usage, quint32 usagePage, int buttons, int knobs, int leds, int maxPayload, int iconSize) :
|
||||
model(model), manufacturerId(manufacturerId), productId(productId), usage(usage), usagePage(usagePage), buttons(buttons), knobs(knobs), leds(leds), maxPayload(maxPayload), iconSize(iconSize) {}
|
||||
|
||||
usbDeviceType model = usbNone;
|
||||
quint32 manufacturerId=0;
|
||||
|
@ -80,6 +80,7 @@ struct USBTYPE {
|
|||
quint32 usagePage=0;
|
||||
int buttons=0;
|
||||
int knobs=0;
|
||||
int leds=0;
|
||||
int maxPayload=0;
|
||||
int iconSize=0;
|
||||
};
|
||||
|
@ -123,6 +124,7 @@ struct USBDEVICE {
|
|||
quint32 buttons = 0;
|
||||
quint32 knobs = 0;
|
||||
QList<KNOBVALUE> knobValues;
|
||||
|
||||
QTime lastusbController = QTime::currentTime();
|
||||
QByteArray lastData = QByteArray(8,0x0);
|
||||
unsigned char lastDialPos=0;
|
||||
|
@ -163,8 +165,8 @@ struct COMMAND {
|
|||
struct BUTTON {
|
||||
BUTTON() {}
|
||||
|
||||
BUTTON(usbDeviceType dev, int num, QRect pos, const QColor textColour, COMMAND* on, COMMAND* off, bool graphics=false) :
|
||||
dev(dev), num(num), name(""), pos(pos), textColour(textColour), onCommand(on), offCommand(off), on(onCommand->text), off(offCommand->text), graphics(graphics) {}
|
||||
BUTTON(usbDeviceType dev, int num, QRect pos, const QColor textColour, COMMAND* on, COMMAND* off, bool graphics=false, int led=-1) :
|
||||
dev(dev), num(num), name(""), pos(pos), textColour(textColour), onCommand(on), offCommand(off), on(onCommand->text), off(offCommand->text), graphics(graphics), led(led){}
|
||||
BUTTON(usbDeviceType dev, QString name, QRect pos, const QColor textColour, COMMAND* on, COMMAND* off) :
|
||||
dev(dev), num(-1), name(name), pos(pos), textColour(textColour), onCommand(on), offCommand(off), on(onCommand->text), off(offCommand->text) {}
|
||||
|
||||
|
@ -189,6 +191,7 @@ struct BUTTON {
|
|||
bool toggle = false;
|
||||
bool isOn = false;
|
||||
bool graphics = false;
|
||||
int led = -1;
|
||||
};
|
||||
|
||||
|
||||
|
|
56
wfmain.cpp
56
wfmain.cpp
|
@ -380,8 +380,8 @@ void wfmain::rigConnections()
|
|||
connect(this, SIGNAL(getVox()), rig, SLOT(getVox()));
|
||||
connect(this, SIGNAL(getMonitor()), rig, SLOT(getMonitor()));
|
||||
connect(this, SIGNAL(getCompressor()), rig, SLOT(getCompressor()));
|
||||
connect(this, SIGNAL(getNb()), rig, SLOT(getNb()));
|
||||
connect(this, SIGNAL(getNb()), rig, SLOT(getNr()));
|
||||
connect(this, SIGNAL(getNB()), rig, SLOT(getNB()));
|
||||
connect(this, SIGNAL(getNR()), rig, SLOT(getNR()));
|
||||
|
||||
connect(this, SIGNAL(selectVFO(vfo_t)), rig, SLOT(selectVFO(vfo_t)));
|
||||
connect(this, SIGNAL(sendVFOSwap()), rig, SLOT(exchangeVFOs()));
|
||||
|
@ -428,7 +428,11 @@ void wfmain::rigConnections()
|
|||
connect(rig, SIGNAL(haveAntiVoxGain(unsigned char)), this, SLOT(receiveAntiVoxGain(unsigned char)));
|
||||
connect(rig, SIGNAL(haveNBLevel(unsigned char)), this, SLOT(receiveNBLevel(unsigned char)));
|
||||
connect(rig, SIGNAL(haveNRLevel(unsigned char)), this, SLOT(receiveNRLevel(unsigned char)));
|
||||
connect(rig, SIGNAL(haveCompLevel(unsigned char)), this, SLOT(receiveCompLevel(unsigned char)));
|
||||
connect(rig, SIGNAL(haveNB(bool)), this, SLOT(receiveNB(bool)));
|
||||
connect(rig, SIGNAL(haveNR(bool)), this, SLOT(receiveNR(bool)));
|
||||
connect(rig, SIGNAL(haveComp(bool)), this, SLOT(receiveComp(bool)));
|
||||
connect(rig, SIGNAL(haveVox(bool)), this, SLOT(receiveVox(bool)));
|
||||
connect(rig, SIGNAL(haveMonitor(bool)), this, SLOT(receiveMonitor(bool)));
|
||||
|
||||
// Repeater, duplex, and split:
|
||||
connect(rpt, SIGNAL(getDuplexMode()), rig, SLOT(getDuplexMode()));
|
||||
|
@ -538,8 +542,8 @@ void wfmain::rigConnections()
|
|||
connect(this, SIGNAL(setVox(bool)), rig, SLOT(setVox(bool)));
|
||||
connect(this, SIGNAL(setMonitor(bool)), rig, SLOT(setMonitor(bool)));
|
||||
connect(this, SIGNAL(setCompressor(bool)), rig, SLOT(setCompressor(bool)));
|
||||
connect(this, SIGNAL(setNb(bool)), rig, SLOT(setNb(bool)));
|
||||
connect(this, SIGNAL(setNr(bool)), rig, SLOT(setNr(bool)));
|
||||
connect(this, SIGNAL(setNB(bool)), rig, SLOT(setNB(bool)));
|
||||
connect(this, SIGNAL(setNR(bool)), rig, SLOT(setNR(bool)));
|
||||
|
||||
connect(this, SIGNAL(setPassband(quint16)), rig, SLOT(setPassband(quint16)));
|
||||
|
||||
|
@ -1752,7 +1756,6 @@ void wfmain::setupUsbControllerDevice()
|
|||
connect(this, SIGNAL(sendControllerRequest(USBDEVICE*, usbFeatureType, int, QString, QImage*, QColor *)), usbControllerDev, SLOT(sendRequest(USBDEVICE*, usbFeatureType, int, QString, QImage*, QColor *)));
|
||||
connect(usbWindow, SIGNAL(programPages(USBDEVICE*,int)), usbControllerDev, SLOT(programPages(USBDEVICE*,int)));
|
||||
connect(usbWindow, SIGNAL(programDisable(USBDEVICE*,bool)), usbControllerDev, SLOT(programDisable(USBDEVICE*,bool)));
|
||||
connect(this, SIGNAL(setPTT(bool)), usbControllerDev, SLOT(receivePTTStatus(bool)));
|
||||
connect(this, SIGNAL(sendLevel(cmds,unsigned char)), usbControllerDev, SLOT(receiveLevel(cmds,unsigned char)));
|
||||
connect(this, SIGNAL(initUsbController(QMutex*,usbDevMap*,QVector<BUTTON>*,QVector<KNOB>*)), usbControllerDev, SLOT(init(QMutex*,usbDevMap*,QVector<BUTTON>*,QVector<KNOB>*)));
|
||||
connect(this, SIGNAL(usbHotplug()), usbControllerDev, SLOT(run()));
|
||||
|
@ -1765,7 +1768,6 @@ void wfmain::setupUsbControllerDevice()
|
|||
void wfmain::pttToggle(bool status)
|
||||
{
|
||||
// is it enabled?
|
||||
|
||||
if (!ui->pttEnableChk->isChecked())
|
||||
{
|
||||
showStatusBarText("PTT is disabled, not sending command. Change under Settings tab.");
|
||||
|
@ -1927,6 +1929,11 @@ void wfmain::buttonControl(const COMMAND* cmd)
|
|||
issueCmdUniquePriority((cmds)cmd->command, cmd->suffix);
|
||||
break;
|
||||
}
|
||||
|
||||
// Make sure we get status quickly
|
||||
if (cmd->getCommand != cmdNone) {
|
||||
issueDelayedCommand((cmds)cmd->getCommand);
|
||||
}
|
||||
}
|
||||
|
||||
void wfmain::stepUp()
|
||||
|
@ -2615,6 +2622,7 @@ void wfmain::loadSettings()
|
|||
butt.on = settings->value("OnCommand", "None").toString();
|
||||
butt.off = settings->value("OffCommand", "None").toString();
|
||||
butt.graphics = settings->value("Graphics", false).toBool();
|
||||
butt.led = settings->value("Led", -1).toInt();
|
||||
if (!butt.path.isEmpty())
|
||||
usbButtons.append(butt);
|
||||
}
|
||||
|
@ -3128,6 +3136,9 @@ void wfmain::saveSettings()
|
|||
if (usbButtons[nb].offCommand != Q_NULLPTR)
|
||||
settings->setValue("OffCommand", usbButtons[nb].offCommand->text);
|
||||
settings->setValue("Graphics",usbButtons[nb].graphics);
|
||||
if (usbButtons[nb].led > -1) {
|
||||
settings->setValue("Led", usbButtons[nb].led);
|
||||
}
|
||||
}
|
||||
|
||||
settings->endArray();
|
||||
|
@ -4197,13 +4208,13 @@ void wfmain::doCmd(commandtype cmddata)
|
|||
case cmdSetNB:
|
||||
{
|
||||
bool en = (*std::static_pointer_cast<bool>(data));
|
||||
emit setNb(en);
|
||||
emit setNB(en);
|
||||
break;
|
||||
}
|
||||
case cmdSetNR:
|
||||
{
|
||||
bool en = (*std::static_pointer_cast<bool>(data));
|
||||
emit setNr(en);
|
||||
emit setNR(en);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -4293,18 +4304,33 @@ void wfmain::doCmd(cmds cmd)
|
|||
case cmdGetPassband:
|
||||
emit getPassband();
|
||||
break;
|
||||
case cmdGetMonitor:
|
||||
emit getMonitor();
|
||||
break;
|
||||
case cmdGetMonitorGain:
|
||||
emit getMonitorGain();
|
||||
break;
|
||||
case cmdGetComp:
|
||||
emit getCompressor();
|
||||
break;
|
||||
case cmdGetVox:
|
||||
emit getVox();
|
||||
break;
|
||||
case cmdGetVoxGain:
|
||||
emit getVoxGain();
|
||||
break;
|
||||
case cmdGetAntiVoxGain:
|
||||
emit getAntiVoxGain();
|
||||
break;
|
||||
case cmdGetNB:
|
||||
emit getNB();
|
||||
break;
|
||||
case cmdGetNBLevel:
|
||||
emit getNBLevel();
|
||||
break;
|
||||
case cmdGetNR:
|
||||
emit getNR();
|
||||
break;
|
||||
case cmdGetNRLevel:
|
||||
emit getNRLevel();
|
||||
break;
|
||||
|
@ -5186,6 +5212,8 @@ void wfmain::receiveFreq(freqt freqStruct)
|
|||
|
||||
void wfmain::receivePTTstatus(bool pttOn)
|
||||
{
|
||||
emit sendLevel(cmdGetPTT,pttOn);
|
||||
|
||||
// This is the only place where amTransmitting and the transmit button text should be changed:
|
||||
if (pttOn && !amTransmitting)
|
||||
{
|
||||
|
@ -7397,27 +7425,27 @@ void wfmain::receiveNRLevel(unsigned char level)
|
|||
|
||||
void wfmain::receiveComp(bool en)
|
||||
{
|
||||
Q_UNUSED(en);
|
||||
emit sendLevel(cmdGetComp,en);
|
||||
}
|
||||
|
||||
void wfmain::receiveMonitor(bool en)
|
||||
{
|
||||
Q_UNUSED(en);
|
||||
emit sendLevel(cmdGetMonitor,en);
|
||||
}
|
||||
|
||||
void wfmain::receiveVox(bool en)
|
||||
{
|
||||
Q_UNUSED(en);
|
||||
emit sendLevel(cmdGetVox,en);
|
||||
}
|
||||
|
||||
void wfmain::receiveNB(bool en)
|
||||
{
|
||||
Q_UNUSED(en);
|
||||
emit sendLevel(cmdGetNB,en);
|
||||
}
|
||||
|
||||
void wfmain::receiveNR(bool en)
|
||||
{
|
||||
Q_UNUSED(en);
|
||||
emit sendLevel(cmdGetNR,en);
|
||||
}
|
||||
|
||||
void wfmain::on_txPowerSlider_valueChanged(int value)
|
||||
|
|
8
wfmain.h
8
wfmain.h
|
@ -178,8 +178,8 @@ signals:
|
|||
void getVox();
|
||||
void getMonitor();
|
||||
void getCompressor();
|
||||
void getNb();
|
||||
void getNr();
|
||||
void getNB();
|
||||
void getNR();
|
||||
|
||||
void getDashRatio();
|
||||
void getPskTone();
|
||||
|
@ -208,8 +208,8 @@ signals:
|
|||
void setVox(bool en);
|
||||
void setMonitor(bool en);
|
||||
void setCompressor(bool en);
|
||||
void setNb(bool en);
|
||||
void setNr(bool en);
|
||||
void setNB(bool en);
|
||||
void setNR(bool en);
|
||||
|
||||
void setSpectrumRefLevel(int);
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue