Add some button mapping

half-duplex
Phil Taylor 2022-10-23 00:02:44 +01:00
rodzic 6255542ee1
commit 6a0997017e
2 zmienionych plików z 20 dodań i 0 usunięć

Wyświetl plik

@ -399,4 +399,23 @@ void usbController::ledControl(bool on, unsigned char num)
qDebug(logUsbControl()) << "write() success";
}
}
void usbController::buttonState(char num, bool val)
{
for (BUTTON* but = buttonList->begin(); but != buttonList->end(); but++) {
if (but->dev == usbDevice && but->num == num) {
if (val && but->onCommand->index > 0) {
qInfo(logUsbControl()) << "On Button event:" << but->onCommand->text;
emit button(but->onCommand);
}
if (!val && but->offCommand->index > 0) {
qInfo(logUsbControl()) << "Off Button event:" << but->offCommand->text;
emit button(but->offCommand);
}
}
}
}

Wyświetl plik

@ -116,6 +116,7 @@ private:
QString manufacturer="";
QString serial="<none>";
QGamepad* gamepad=Q_NULLPTR;
void buttonState(char but, bool val);
protected:
};