From 80dc5d2df680979e406d9ccb93cdbfd0b8ee8ef0 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Thu, 2 Feb 2023 23:11:49 +0000 Subject: [PATCH] Bit of tidying --- controllersetup.h | 2 +- usbcontroller.cpp | 7 +++++-- usbcontroller.h | 3 +-- wfviewtypes.h | 2 ++ 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/controllersetup.h b/controllersetup.h index 62c81cd..1be254b 100644 --- a/controllersetup.h +++ b/controllersetup.h @@ -44,8 +44,8 @@ public slots: void offEventIndexChanged(int index); private: - enum { NONE=0, shuttleXpress, shuttlePro2, RC28, xBoxGamepad, unknownGamepad } usbDevice; + usbDeviceType usbDevice = usbNone; Ui::controllerSetup* ui; QGraphicsScene* scene; QGraphicsTextItem* textItem; diff --git a/usbcontroller.cpp b/usbcontroller.cpp index 48b6d12..93adf56 100644 --- a/usbcontroller.cpp +++ b/usbcontroller.cpp @@ -167,7 +167,7 @@ void usbController::run() if (!handle) { handle = hid_open(0x0c26, 0x001e, NULL); if (!handle) { - usbDevice = NONE; + usbDevice = usbNone; } else { usbDevice = RC28; @@ -226,7 +226,7 @@ void usbController::run() void usbController::runTimer() { int res=1; - + while (res > 0) { QByteArray data(HIDDATALENGTH, 0x0); res = hid_read(handle, (unsigned char*)data.data(), HIDDATALENGTH); @@ -329,6 +329,9 @@ void usbController::runTimer() BUTTON* butf1 = Q_NULLPTR; BUTTON* butf2 = Q_NULLPTR;; + + //delayedCmdQue.erase(std::remove_if(delayedCmdQue.begin() + 1, delayedCmdQue.end(), [cmd](const commandtype& c) { return (c.cmd == cmd); }), + for (BUTTON* but = buttonList->begin(); but != buttonList->end(); but++) { if (but->dev == usbDevice) { diff --git a/usbcontroller.h b/usbcontroller.h index e2ca78d..f30790e 100644 --- a/usbcontroller.h +++ b/usbcontroller.h @@ -106,7 +106,6 @@ signals: private: hid_device* handle; - enum { NONE=0, shuttleXpress, shuttlePro2, RC28, xBoxGamepad, unknownGamepad }usbDevice; bool isOpen=false; unsigned int buttons=0; unsigned char jogpos=0; @@ -126,7 +125,7 @@ private: #endif void buttonState(QString but, bool val); void buttonState(QString but, double val); - + usbDeviceType usbDevice = usbNone; protected: }; diff --git a/wfviewtypes.h b/wfviewtypes.h index 146f689..bd8c3e1 100644 --- a/wfviewtypes.h +++ b/wfviewtypes.h @@ -194,4 +194,6 @@ enum codecType { LPCM, PCMU, OPUS }; enum passbandActions {passbandStatic, pbtInnerMove, pbtOuterMove, pbtMoving, passbandResizing}; +enum usbDeviceType { usbNone = 0, shuttleXpress, shuttlePro2, RC28, xBoxGamepad, unknownGamepad }; + #endif // WFVIEWTYPES_H