kopia lustrzana https://gitlab.com/eliggett/wfview
Various shuttle fixes incorporating #54
rodzic
5db5f40ed4
commit
7e7dceaa99
Plik binarny nie jest wyświetlany.
Przed Szerokość: | Wysokość: | Rozmiar: 428 KiB Po Szerokość: | Wysokość: | Rozmiar: 428 KiB |
|
@ -307,14 +307,14 @@ void usbController::runTimer()
|
|||
{
|
||||
|
||||
|
||||
|
||||
// Step through all buttons and emit ones that have been pressed.
|
||||
for (unsigned char i = 0; i < 16; i++)
|
||||
{
|
||||
|
||||
for (BUTTON* but = buttonList->begin(); but != buttonList->end(); but++) {
|
||||
if (but->dev == usbDevice && but->num == i) {
|
||||
|
||||
if ((tempButtons >> i & 1) && !(buttons >> i & 1))
|
||||
qInfo(logUsbControl) << "Button on" << i;
|
||||
if ((tempButtons >> i & 1) && !(buttons >> i & 1) && but->onCommand->index > 0)
|
||||
{
|
||||
qInfo(logUsbControl()) << "On Button event:" << but->onCommand->text;
|
||||
|
@ -421,33 +421,20 @@ void usbController::runTimer()
|
|||
|
||||
if ((unsigned char)data[5] == 0x07)
|
||||
{
|
||||
// TODO: change of frequency should be multiplied by data[1] or data[4]
|
||||
// data[1] max value depend on rotation speed I was able to detect was 150 decimal
|
||||
// data[4] can have 3 values 0 1 or 2 it depends on rotation speed
|
||||
if ((unsigned char)data[4] > 0x00) {
|
||||
changeVFO = data[4] * data[1];
|
||||
} else {
|
||||
changeVFO = data[1];
|
||||
}
|
||||
if ((unsigned char)data[3] == 0x01)
|
||||
{
|
||||
//qDebug(logUsbControl()) << "Frequency UP";
|
||||
//emit jogPlus();
|
||||
jogCounter = jogCounter + changeVFO;
|
||||
jogCounter = jogCounter + data[1];
|
||||
}
|
||||
else if ((unsigned char)data[3] == 0x02)
|
||||
{
|
||||
//qDebug(logUsbControl()) << "Frequency DOWN";
|
||||
//emit jogMinus();
|
||||
jogCounter = jogCounter - changeVFO;
|
||||
jogCounter--;
|
||||
jogCounter = jogCounter - data[1];
|
||||
}
|
||||
}
|
||||
|
||||
lastData = data;
|
||||
}
|
||||
|
||||
if (lastusbController.msecsTo(QTime::currentTime()) >= 200 || lastusbController > QTime::currentTime())
|
||||
if (lastusbController.msecsTo(QTime::currentTime()) >= 100 || lastusbController > QTime::currentTime())
|
||||
{
|
||||
if (usbDevice == shuttleXpress || usbDevice == shuttlePro2)
|
||||
{
|
||||
|
|
27
wfmain.cpp
27
wfmain.cpp
|
@ -1685,12 +1685,11 @@ void wfmain::changeFrequency(int value) {
|
|||
if (freqLock) return;
|
||||
|
||||
freqt f;
|
||||
f.Hz = roundFrequencyWithStep(freq.Hz, value, tsKnobHz);
|
||||
|
||||
f.Hz = roundFrequencyWithStep(freq.Hz, value, tsWfScrollHz);
|
||||
f.MHzDouble = f.Hz / (double)1E6;
|
||||
setUIFreq();
|
||||
freq = f;
|
||||
issueCmdUniquePriority(cmdSetFreq, f);
|
||||
issueDelayedCommandUnique(cmdGetFreq);
|
||||
ui->freqLabel->setText(QString("%1").arg(f.MHzDouble, 0, 'f'));
|
||||
}
|
||||
|
||||
void wfmain::setDefPrefs()
|
||||
|
@ -2267,7 +2266,8 @@ void wfmain::loadSettings()
|
|||
/* Load USB buttons*/
|
||||
settings->beginGroup("USB");
|
||||
int numCommands = settings->beginReadArray("Commands");
|
||||
if (numCommands == 0) {
|
||||
// This is the last time the commands were changed (v1.58)
|
||||
if (numCommands == 0 || priorVersionFloat < 1.58) {
|
||||
settings->endArray();
|
||||
// We have no buttons so create defaults
|
||||
usbCommands.clear();
|
||||
|
@ -2353,17 +2353,18 @@ void wfmain::loadSettings()
|
|||
}
|
||||
|
||||
int numButtons = settings->beginReadArray("Buttons");
|
||||
if (numButtons == 0) {
|
||||
// This is the last time the buttons were changed, (v1.58)
|
||||
if (numButtons == 0 || priorVersionFloat < 1.58) {
|
||||
settings->endArray();
|
||||
// We have no buttons so create defaults
|
||||
usbButtons.clear();
|
||||
|
||||
// ShuttleXpress
|
||||
usbButtons.append(BUTTON(1, 0, QRect(60, 66, 40, 30), Qt::red, &usbCommands[0], &usbCommands[0]));
|
||||
usbButtons.append(BUTTON(1, 1, QRect(114, 50, 40, 30), Qt::red, &usbCommands[0], &usbCommands[0]));
|
||||
usbButtons.append(BUTTON(1, 2, QRect(169, 47, 40, 30), Qt::red, &usbCommands[0], &usbCommands[0]));
|
||||
usbButtons.append(BUTTON(1, 3, QRect(225, 59, 40, 30), Qt::red, &usbCommands[0], &usbCommands[0]));
|
||||
usbButtons.append(BUTTON(1, 4, QRect(41, 132, 40, 30), Qt::red, &usbCommands[0], &usbCommands[0]));
|
||||
usbButtons.append(BUTTON(1, 4, QRect(25, 199, 89, 169), Qt::red, &usbCommands[0], &usbCommands[0]));
|
||||
usbButtons.append(BUTTON(1, 5, QRect(101, 72, 83, 88), Qt::red, &usbCommands[0], &usbCommands[0]));
|
||||
usbButtons.append(BUTTON(1, 6, QRect(238, 26, 134, 69), Qt::red, &usbCommands[0], &usbCommands[0]));
|
||||
usbButtons.append(BUTTON(1, 7, QRect(452, 72, 77, 86), Qt::red, &usbCommands[0], &usbCommands[0]));
|
||||
usbButtons.append(BUTTON(1, 8, QRect(504, 199, 89, 169), Qt::red, &usbCommands[0], &usbCommands[0]));
|
||||
|
||||
// ShuttlePro2
|
||||
usbButtons.append(BUTTON(2, 0, QRect(60, 66, 40, 30), Qt::red, &usbCommands[0], &usbCommands[0]));
|
||||
|
@ -2404,7 +2405,6 @@ void wfmain::loadSettings()
|
|||
usbButtons.append(BUTTON(4, "LEFTY", QRect(162, 132, 50, 57), Qt::red, &usbCommands[0], &usbCommands[0]));
|
||||
usbButtons.append(BUTTON(4, "RIGHTX", QRect(430, 298, 83, 35), Qt::red, &usbCommands[0], &usbCommands[0]));
|
||||
usbButtons.append(BUTTON(4, "RIGHTY", QRect(453, 233, 50, 57), Qt::red, &usbCommands[0], &usbCommands[0]));
|
||||
//usbButtons.append(BUTTON(4, 14, QRect(280, 195, 25, 80), Qt::red, &usbCommands[0], &usbCommands[0]));
|
||||
|
||||
}
|
||||
else {
|
||||
|
@ -5232,7 +5232,8 @@ void wfmain::handleWFScroll(QWheelEvent *we)
|
|||
if ((key == Qt::ShiftModifier) && (stepsHz != 1))
|
||||
{
|
||||
stepsHz /= 10;
|
||||
} else if (key == Qt::ControlModifier)
|
||||
}
|
||||
else if (key == Qt::ControlModifier)
|
||||
{
|
||||
stepsHz *= 10;
|
||||
}
|
||||
|
|
|
@ -175,16 +175,17 @@ CONFIG(debug, release|debug) {
|
|||
}
|
||||
}
|
||||
|
||||
!win32:LIBS += -L./ -l$$QCPLIB -lopus
|
||||
win32:LIBS += -l$$QCPLIB -lopus
|
||||
|
||||
contains(DEFINES,USB_CONTROLLER){
|
||||
linux:LIBS += -L./ -l$$QCPLIB -lhidapi -libusb
|
||||
macx:LIBS += -lhidapi
|
||||
macx:LIBS += -L../hidapi/windows/x64/release -lhidapi
|
||||
win32:INCLUDEPATH += ../hidapi/hidapi
|
||||
win32:SOURCES += ../hidapi/windows/hid.c
|
||||
}
|
||||
|
||||
!win32:LIBS += -L./ -l$$QCPLIB -lopus
|
||||
win32:LIBS += -l$$QCPLIB -lopus
|
||||
|
||||
|
||||
#macx:SOURCES += ../qcustomplot/qcustomplot.cpp
|
||||
#macx:HEADERS += ../qcustomplot/qcustomplot.h
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue