RC28 started to work (no LED feedback yet) MVP done

half-duplex
Dawid Szymański 2022-12-28 21:38:39 +00:00 zatwierdzone przez Phil Taylor
rodzic f232ff2396
commit 3aa4375bdf
2 zmienionych plików z 40 dodań i 9 usunięć

Wyświetl plik

@ -17,6 +17,7 @@ sudo apt-get install libopus-dev
sudo apt-get install libeigen3-dev
sudo apt-get install portaudio19-dev
sudo apt-get install librtaudio-dev
sudo apt-get install libhidapi-dev libqt5gamepad5-dev
~~~
Now you need to install qcustomplot. There are two versions that are commonly found in linux distros: 1.3 and 2.0. Either will work fine. If you are not sure which version your linux install comes with, simply run both commands. One will work and the other will fail, and that's fine!
@ -127,4 +128,12 @@ When done, create a build area, clone the repo, build and install:
wfview is now installed in /usr/local/bin
# How to configure your RC-28 knob under Linux
To use RC-28 knob you need to add udev rules, please execute as root:
~~~
echo 'SUBSYSTEM=="usb", ATTRS{idVendor}=="0c26", ATTRS{idProduct}=="001e", MODE="0666"' >> /etc/udev/rules.d/99-ham-wfview.rules
udevadm control --reload-rules && udevadm trigger
~~~
---

Wyświetl plik

@ -187,7 +187,7 @@ void usbController::run()
if (!handle) {
handle = hid_open(0x0b33, 0x0030, NULL);
if (!handle) {
handle = hid_open(0x0C26, 0x001E, NULL);
handle = hid_open(0x0c26, 0x001e, NULL);
if (!handle) {
usbDevice = NONE;
}
@ -243,6 +243,7 @@ void usbController::run()
void usbController::runTimer()
{
int res=1;
int changeVFO=0;
while (res > 0) {
QByteArray data(HIDDATALENGTH, 0x0);
res = hid_read(handle, (unsigned char*)data.data(), HIDDATALENGTH);
@ -331,7 +332,7 @@ void usbController::runTimer()
shutpos = tempShutpos;
}
else if (res == 64 && usbDevice == RC28)
else if (res == 32 && usbDevice == RC28)
{
// This is a response from the Icom RC28
data.resize(8); // Might as well get rid of the unused data.
@ -342,41 +343,62 @@ void usbController::runTimer()
if (((unsigned char)data[5] == 0x06) && ((unsigned char)lastData[5] != 0x06))
{
// TRANSMIT key down only (no other keys down)
//emit button(true, 6);
qDebug(logUsbControl()) << "PTT key down";
}
else if (((unsigned char)data[5] != 0x06) && ((unsigned char)lastData[5] == 0x06))
{
// TRANSMIT key up only (no other keys down)
//emit button(false, 6);
qDebug(logUsbControl()) << "PTT key up";
}
else if (((unsigned char)data[5] == 0x03) && ((unsigned char)lastData[5] != 0x03))
{
// F-2 key up only (no other keys down)
//emit button(true, 7);
qDebug(logUsbControl()) << "F-2 key up";
}
else if (((unsigned char)data[5] != 0x03) && ((unsigned char)lastData[5] == 0x03))
{
// F-2 key down only (no other keys down)
//emit button(false, 7);
qDebug(logUsbControl()) << "F-2 key down";
}
else if (((unsigned char)data[5] == 0x7d) && ((unsigned char)lastData[5] != 0x7d))
else if (((unsigned char)data[5] == 0x05) && ((unsigned char)lastData[5] != 0x05))
{
// F-1 key up only (no other keys down)
//emit button(true, 5);
qDebug(logUsbControl()) << "F-1 key up";
}
else if (((unsigned char)data[5] != 0x7d) && ((unsigned char)lastData[5] == 0x7d))
else if (((unsigned char)data[5] != 0x05) && ((unsigned char)lastData[5] == 0x05))
{
// F-1 key down only (no other keys down)
//emit button(false, 5);
qDebug(logUsbControl()) << "F-1 key down";
}
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";
jogCounter++;
//emit jogPlus();
qDebug(logUsbControl()) << "Frequency UP";
emit jogPlus();
jogCounter = jogCounter + changeVFO;
}
else if ((unsigned char)data[3] == 0x02)
{
//qDebug(logUsbControl()) << "Frequency DOWN";
qDebug(logUsbControl()) << "Frequency DOWN";
emit jogMinus();
jogCounter = jogCounter - changeVFO;
jogCounter--;
}
}
@ -474,4 +496,4 @@ void usbController::buttonState(QString name, double val)
}
}
*/
}
}