kopia lustrzana https://gitlab.com/eliggett/wfview
Shuttle button commands now working (mostly)
rodzic
41c5637c30
commit
7f003c588e
|
@ -214,28 +214,15 @@ void usbController::runTimer()
|
|||
{
|
||||
if (i < buttonList.size()) {
|
||||
qDebug() << "On Button event:" << buttonList[i].onCommand.text;
|
||||
if (buttonList[i].onCommand.bandswitch)
|
||||
{
|
||||
//emit setBand(buttonList[i].onCommand.index - 13);
|
||||
}
|
||||
else {
|
||||
emit button(true, i);
|
||||
}
|
||||
emit button(&buttonList[i].onCommand);
|
||||
}
|
||||
}
|
||||
else if ((buttons >> i & 1) && !(tempButtons >> i & 1))
|
||||
{
|
||||
if (i < buttonList.size()) {
|
||||
qDebug() << "Off Button event:" << buttonList[i].offCommand.text;
|
||||
if (buttonList[i].offCommand.bandswitch)
|
||||
{
|
||||
//emit setBand(buttonList[i].onCommand.index - 13);
|
||||
}
|
||||
else {
|
||||
emit button(false, i);
|
||||
}
|
||||
emit button(&buttonList[i].offCommand);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -256,27 +243,27 @@ void usbController::runTimer()
|
|||
|
||||
if (((unsigned char)data[5] == 0x06) && ((unsigned char)lastData[5] != 0x06))
|
||||
{
|
||||
emit button(true, 6);
|
||||
//emit button(true, 6);
|
||||
}
|
||||
else if (((unsigned char)data[5] != 0x06) && ((unsigned char)lastData[5] == 0x06))
|
||||
{
|
||||
emit button(false, 6);
|
||||
//emit button(false, 6);
|
||||
}
|
||||
else if (((unsigned char)data[5] == 0x03) && ((unsigned char)lastData[5] != 0x03))
|
||||
{
|
||||
emit button(true, 7);
|
||||
//emit button(true, 7);
|
||||
}
|
||||
else if (((unsigned char)data[5] != 0x03) && ((unsigned char)lastData[5] == 0x03))
|
||||
{
|
||||
emit button(false, 7);
|
||||
//emit button(false, 7);
|
||||
}
|
||||
else if (((unsigned char)data[5] == 0x7d) && ((unsigned char)lastData[5] != 0x7d))
|
||||
{
|
||||
emit button(true, 5);
|
||||
//emit button(true, 5);
|
||||
}
|
||||
else if (((unsigned char)data[5] != 0x7d) && ((unsigned char)lastData[5] == 0x7d))
|
||||
{
|
||||
emit button(false, 5);
|
||||
//emit button(false, 5);
|
||||
}
|
||||
|
||||
if ((unsigned char)data[5] == 0x07)
|
||||
|
|
|
@ -64,7 +64,7 @@ struct COMMAND {
|
|||
int index;
|
||||
QString text;
|
||||
cmds command;
|
||||
char suffix;
|
||||
unsigned char suffix;
|
||||
bandType band;
|
||||
bool bandswitch;
|
||||
};
|
||||
|
@ -108,7 +108,7 @@ signals:
|
|||
void doShuttle(bool plus, quint8 level);
|
||||
void setBand(int band);
|
||||
|
||||
void button(bool,unsigned char num);
|
||||
void button(COMMAND* cmd);
|
||||
void newDevice(unsigned char devType, QVector<BUTTON>* but,QVector<COMMAND>* cmd);
|
||||
private:
|
||||
hid_device* handle;
|
||||
|
|
27
wfmain.cpp
27
wfmain.cpp
|
@ -1291,7 +1291,7 @@ void wfmain::setupUsbControllerDevice()
|
|||
connect(usbControllerThread, SIGNAL(finished()), usbControllerDev, SLOT(deleteLater()));
|
||||
connect(usbControllerDev, SIGNAL(sendJog(int)), this, SLOT(changeFrequency(int)));
|
||||
connect(usbControllerDev, SIGNAL(doShuttle(bool, unsigned char)), this, SLOT(doShuttle(bool, unsigned char)));
|
||||
connect(usbControllerDev, SIGNAL(button(bool, unsigned char)), this, SLOT(buttonControl(bool, unsigned char)));
|
||||
connect(usbControllerDev, SIGNAL(button(COMMAND*)), this, SLOT(buttonControl(COMMAND*)));
|
||||
connect(usbControllerDev, SIGNAL(setBand(int)), this, SLOT(setBand(int)));
|
||||
connect(this, SIGNAL(shuttleLed(bool, unsigned char)), usbControllerDev, SLOT(ledControl(bool, unsigned char)));
|
||||
connect(usbControllerDev, SIGNAL(newDevice(unsigned char, QVector<BUTTON>*, QVector<COMMAND>*)), shut, SLOT(newDevice(unsigned char, QVector<BUTTON>*,QVector<COMMAND>*)));
|
||||
|
@ -1337,24 +1337,15 @@ void wfmain::doShuttle(bool up, unsigned char level)
|
|||
shortcutControlMinus();
|
||||
}
|
||||
|
||||
void wfmain::buttonControl(bool on, unsigned char button)
|
||||
void wfmain::buttonControl(COMMAND* cmd)
|
||||
{
|
||||
//qInfo() << "buttonControl()" << on << button;
|
||||
switch (button)
|
||||
{
|
||||
case(5):
|
||||
if(on)
|
||||
stepDown();
|
||||
break;
|
||||
case(6):
|
||||
pttToggle(on);
|
||||
break;
|
||||
case(7):
|
||||
if (on)
|
||||
stepUp();
|
||||
break;
|
||||
default:
|
||||
qInfo() << "Unknown button pressed:" << button;
|
||||
if (!cmd->bandswitch) {
|
||||
qDebug() << "Other command";
|
||||
issueCmdUniquePriority((cmds)cmd->command, cmd->suffix);
|
||||
}
|
||||
else {
|
||||
qDebug() << "Bandswitch";
|
||||
issueCmdUniquePriority((cmds)cmd->command, (char)cmd->band);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
2
wfmain.h
2
wfmain.h
|
@ -294,7 +294,7 @@ private slots:
|
|||
|
||||
void setRadioTimeDateSend();
|
||||
|
||||
void buttonControl(bool on, unsigned char button);
|
||||
void buttonControl(COMMAND* cmd);
|
||||
|
||||
// void on_getFreqBtn_clicked();
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue