Query RC-28 for version

failbranch
Phil Taylor 2023-02-02 00:03:13 +00:00
rodzic a192e6643b
commit e20900dbcf
2 zmienionych plików z 16 dodań i 0 usunięć

Wyświetl plik

@ -196,6 +196,7 @@ void usbController::run()
}
else {
usbDevice = RC28;
getVersion();
}
}
else {
@ -336,6 +337,9 @@ void usbController::runTimer()
else if ((res > 31) && usbDevice == RC28)
{
// This is a response from the Icom RC28
if (data[0] == 0x02) {
qInfo(logUsbControl()) << QString("Received RC-28 Firmware Version: %0").arg(data.mid(1,data.indexOf(" ")-1));
}
data.resize(8); // Might as well get rid of the unused data.
@ -494,6 +498,17 @@ void usbController::ledControl(bool on, unsigned char num)
}
}
void usbController::getVersion()
{
QByteArray data(9, 0x0);
data[0] = 8;
data[1] = 0x02;
int res = hid_write(handle, (const unsigned char*)data.constData(), 8);
if (res < 0) {
qDebug(logUsbControl()) << "Unable to write(), Error:" << hid_error(handle);
}
}
void usbController::buttonState(QString name, bool val)
{
for (BUTTON* but = buttonList->begin(); but != buttonList->end(); but++) {

Wyświetl plik

@ -94,6 +94,7 @@ public slots:
void ledControl(bool on, unsigned char num);
void receiveCommands(QVector<COMMAND>*);
void receiveButtons(QVector<BUTTON>*);
void getVersion();
signals:
void jogPlus();