Add more buttons

smart-pointers
Phil Taylor 2023-02-07 23:05:42 +00:00
rodzic b783f8057a
commit f4a86ac02e
3 zmienionych plików z 32 dodań i 20 usunięć

Wyświetl plik

@ -304,7 +304,7 @@ void usbController::runTimer()
<< hex << (unsigned char)data[3] << ":" << hex << (unsigned char)data[3] << ":"
<< hex << (unsigned char)data[4]; << hex << (unsigned char)data[4];
*/ */
quint16 tempButtons = ((quint8)data[4] << 8) | ((quint8)data[3] & 0xff); quint32 tempButtons = ((quint8)data[4] << 8) | ((quint8)data[3] & 0xff);
unsigned char tempJogpos = (unsigned char)data[1]; unsigned char tempJogpos = (unsigned char)data[1];
unsigned char tempShutpos = (unsigned char)data[0]; unsigned char tempShutpos = (unsigned char)data[0];
@ -477,29 +477,35 @@ void usbController::runTimer()
} }
else if (usbDevice == eCoderPlus && data.length() >= 0x0f && (quint8)data[0] == 0xff) { else if (usbDevice == eCoderPlus && data.length() >= 0x0f && (quint8)data[0] == 0xff) {
/* Button matrix: /* Button matrix:
DATA2 DATA 1 DATA3 DATA2 DATA 1
7654321076543210 765432107654321076543210
0100000000000000 = button14 001000000000000000000000 = Left CW
0010000000000000 = button13 000100000000000000000000 = Right CW
0001000000000000 = button12 000010000000000000000000 = PTT
0000100000000000 = button11 000001000000000000000000 = Knob 3 Press
0000010000000000 = button10 000000100000000000000000 = Knob 2 Press
0000001000000000 = button9 000000010000000000000000 = Knob 1 Press
0000000100000000 = button8 000000000100000000000000 = button14
0000000010000000 = button7 000000000010000000000000 = button13
0000000001000000 = button6 000000000001000000000000 = button12
0000000000100000 = button5 000000000000100000000000 = button11
0000000000010000 = button4 000000000000010000000000 = button10
0000000000001000 = button3 000000000000001000000000 = button9
0000000000000100 = button2 000000000000000100000000 = button8
0000000000000010 = button1 000000000000000010000000 = button7
000000000000000001000000 = button6
000000000000000000100000 = button5
000000000000000000010000 = button4
000000000000000000001000 = button3
000000000000000000000100 = button2
000000000000000000000010 = button1
*/ */
quint16 tempButtons = ((quint8)data[2] << 8) | ((quint8)data[1] & 0xff); quint32 tempButtons = ((quint8)data[3] << 16) | ((quint8)data[2] << 8) | ((quint8)data[1] & 0xff);
if (buttons != tempButtons) if (buttons != tempButtons)
{ {
// Step through all buttons and emit ones that have been pressed. // Step through all buttons and emit ones that have been pressed.
for (unsigned char i = 1; i < 15; i++) for (unsigned char i = 1; i < 23; i++)
{ {
for (BUTTON* but = buttonList->begin(); but != buttonList->end(); but++) { for (BUTTON* but = buttonList->begin(); but != buttonList->end(); but++) {
if (but->dev == usbDevice && but->num == i) { if (but->dev == usbDevice && but->num == i) {

Wyświetl plik

@ -126,7 +126,7 @@ private:
hid_device* handle=NULL; hid_device* handle=NULL;
int hidStatus = 1; int hidStatus = 1;
bool isOpen=false; bool isOpen=false;
quint16 buttons=0; quint32 buttons=0;
unsigned char jogpos=0; unsigned char jogpos=0;
unsigned char shutpos=0; unsigned char shutpos=0;
unsigned char shutMult = 0; unsigned char shutMult = 0;

Wyświetl plik

@ -9256,6 +9256,12 @@ void wfmain::resetUsbButtons()
usbButtons.append(BUTTON(eCoderPlus, 12, QRect(410, 351, 55, 55), Qt::red, &usbCommands[0], &usbCommands[0])); usbButtons.append(BUTTON(eCoderPlus, 12, QRect(410, 351, 55, 55), Qt::red, &usbCommands[0], &usbCommands[0]));
usbButtons.append(BUTTON(eCoderPlus, 13, QRect(87, 512, 55, 55), Qt::red, &usbCommands[0], &usbCommands[0])); usbButtons.append(BUTTON(eCoderPlus, 13, QRect(87, 512, 55, 55), Qt::red, &usbCommands[0], &usbCommands[0]));
usbButtons.append(BUTTON(eCoderPlus, 14, QRect(410, 512, 55, 55), Qt::red, &usbCommands[0], &usbCommands[0])); usbButtons.append(BUTTON(eCoderPlus, 14, QRect(410, 512, 55, 55), Qt::red, &usbCommands[0], &usbCommands[0]));
usbButtons.append(BUTTON(eCoderPlus, 16, QRect(121, 102, 68, 73), Qt::red, &usbCommands[0], &usbCommands[0]));
usbButtons.append(BUTTON(eCoderPlus, 17, QRect(242, 102, 68, 73), Qt::red, &usbCommands[0], &usbCommands[0]));
usbButtons.append(BUTTON(eCoderPlus, 18, QRect(362, 102, 68, 73), Qt::red, &usbCommands[0], &usbCommands[0]));
usbButtons.append(BUTTON(eCoderPlus, 19, QRect(124, 2, 55, 30), Qt::red, &usbCommands[1], &usbCommands[2]));
usbButtons.append(BUTTON(eCoderPlus, 20, QRect(290, 2, 55, 30), Qt::red, &usbCommands[0], &usbCommands[0]));
usbButtons.append(BUTTON(eCoderPlus, 21, QRect(404, 2, 55, 30), Qt::red, &usbCommands[0], &usbCommands[0]));
emit sendUsbControllerButtons(&usbButtons); emit sendUsbControllerButtons(&usbButtons);