Try to get RC-28 LEDs working

failbranch
Phil Taylor 2023-02-01 12:16:04 +00:00
rodzic 180b7b0095
commit 5fa14d13e1
3 zmienionych plików z 28 dodań i 25 usunięć

Wyświetl plik

@ -373,6 +373,7 @@ void usbController::runTimer()
// TRANSMIT key down only (no other keys down)
qDebug(logUsbControl()) << "PTT key down";
qInfo(logUsbControl()) << "On Button event:" << butptt->onCommand->text;
ledControl(true,0);
emit button(butptt->onCommand);
}
@ -382,40 +383,45 @@ void usbController::runTimer()
//emit button(false, 6);
qDebug(logUsbControl()) << "PTT key up";
qInfo(logUsbControl()) << "Off Button event:" << butptt->offCommand->text;
ledControl(false,0);
emit button(butptt->offCommand);
}
else if (butf1 != Q_NULLPTR && ((unsigned char)data[5] == 0x7d) && ((unsigned char)lastData[5] != 0x7d))
{
// F-1 key up only (no other keys down)
//emit button(true, 5);
qDebug(logUsbControl()) << "F-1 key down";
qInfo(logUsbControl()) << "On Button event:" << butf1->onCommand->text;
ledControl(true,1);
emit button(butf1->onCommand);
}
else if (butf1 != Q_NULLPTR && ((unsigned char)data[5] != 0x7d) && ((unsigned char)lastData[5] == 0x7d))
{
// F-1 key down only (no other keys down)
//emit button(false, 5);
qDebug(logUsbControl()) << "F-1 key up";
qInfo(logUsbControl()) << "Off Button event:" << butf1->offCommand->text;
ledControl(false,1);
emit button(butf1->offCommand);
}
else if (butf2 != Q_NULLPTR && ((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";
qDebug(logUsbControl()) << "F-2 key down";
qInfo(logUsbControl()) << "On Button event:" << butf2->onCommand->text;
ledControl(true,2);
emit button(butf2->onCommand);
}
else if (butf2 != Q_NULLPTR && ((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";
qDebug(logUsbControl()) << "F-2 key up";
qInfo(logUsbControl()) << "Off Button event:" << butf2->offCommand->text;
ledControl(false,2);
emit button(butf2->offCommand);
}
else if (butf1 != Q_NULLPTR && ((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";
qInfo(logUsbControl()) << "On Button event:" << butf1->onCommand->text;
emit button(butf1->onCommand);
}
else if (butf1 != Q_NULLPTR && ((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";
qInfo(logUsbControl()) << "Off Button event:" << butf1->offCommand->text;
emit button(butf1->offCommand);
}
if ((unsigned char)data[5] == 0x07)
{
@ -469,9 +475,11 @@ void usbController::ledControl(bool on, unsigned char num)
QByteArray data(9, 0x0);
data[0] = 8;
data[1] = 0x01;
unsigned char ledNum = 0x07;
static unsigned char ledNum = 0xff;
if (on)
ledNum &= ~(1ULL << (num - 1));
ledNum &= ~(1UL << num);
else
ledNum |= 1UL << num;
data[2] = ledNum;

Wyświetl plik

@ -1676,7 +1676,6 @@ void wfmain::setupUsbControllerDevice()
connect(usbControllerDev, SIGNAL(doShuttle(bool, unsigned char)), this, SLOT(doShuttle(bool, unsigned char)));
connect(usbControllerDev, SIGNAL(button(const COMMAND*)), this, SLOT(buttonControl(const COMMAND*)));
connect(usbControllerDev, SIGNAL(setBand(int)), this, SLOT(setBand(int)));
connect(this, SIGNAL(controllerLed(bool, unsigned char)), usbControllerDev, SLOT(ledControl(bool, unsigned char)));
connect(usbControllerDev, SIGNAL(newDevice(unsigned char, QVector<BUTTON>*, QVector<COMMAND>*)), shut, SLOT(newDevice(unsigned char, QVector<BUTTON>*, QVector<COMMAND>*)));
usbControllerThread->start(QThread::LowestPriority);
@ -1696,7 +1695,6 @@ void wfmain::pttToggle(bool status)
}
emit setPTT(status);
emit controllerLed(status, 1);
// Start 3 minute timer
if (status)
pttTimer->start();
@ -3829,7 +3827,6 @@ void wfmain::doCmd(commandtype cmddata)
{
bool pttrequest = (*std::static_pointer_cast<bool>(data));
emit setPTT(pttrequest);
emit controllerLed(pttrequest, 1);
ui->meter2Widget->clearMeterOnPTTtoggle();
if (pttrequest)
@ -3845,7 +3842,6 @@ void wfmain::doCmd(commandtype cmddata)
{
bool pttrequest = !amTransmitting;
emit setPTT(pttrequest);
emit controllerLed(pttrequest, 1);
ui->meter2Widget->clearMeterOnPTTtoggle();
if (pttrequest)
{

Wyświetl plik

@ -222,7 +222,6 @@ signals:
void openShuttle();
void requestRigState();
void stateUpdated();
void controllerLed(bool, unsigned char);
void sendUsbControllerCommands(QVector<COMMAND>* cmds);
void sendUsbControllerButtons(QVector<BUTTON>* buts);
void setClusterUdpPort(int port);