fixed only single led working

This commit is contained in:
2020-04-20 00:20:41 +02:00
parent 65700e07d8
commit 2d4c6f33e8
2 changed files with 13 additions and 9 deletions

View File

@@ -15,7 +15,7 @@ LEDHandler::LEDHandler(QUdpSocket* sock, TS3Functions ts3Functions)
void LEDHandler::talkingStarted() void LEDHandler::talkingStarted()
{ {
printf("started\n"); printf("started\n");
sendColor(0, 0, 125, 0, 255); sendColor(0, 0, 255, 0, 255);
} }
void LEDHandler::talkingEnded() void LEDHandler::talkingEnded()
@@ -33,15 +33,14 @@ void LEDHandler::poked()
void LEDHandler::sendColor(int R, int G, int B, int W, int t) void LEDHandler::sendColor(int R, int G, int B, int W, int t)
{ {
QByteArray msg; QByteArray msg;
msg.append(2); msg.append(3);
msg.append(t); msg.append(t);
for (int n = 0; n < cLEDNUM; n++) {
msg.append(R); msg.append(R);
msg.append(G); msg.append(G);
msg.append(B); msg.append(B);
msg.append(W); msg.append(W);
}
printf(msg.toStdString().c_str());
printf("\n");
mSock->writeDatagram(msg, QHostAddress(cURL), cPORT); mSock->writeDatagram(msg, QHostAddress(cURL), cPORT);
} }
@@ -62,8 +61,10 @@ void LEDHandler::hostFound()
{ {
mTs3Functions.logMessage("HOST FOUND", LogLevel_INFO, "Plugin", 0); mTs3Functions.logMessage("HOST FOUND", LogLevel_INFO, "Plugin", 0);
printf("HOST FOUND\n"); printf("HOST FOUND\n");
succesful = true;
} }
//const char* LED_URL_SAVE = "http://10.0.0.222/win&PS=16&NN"; //const char* LED_URL_SAVE = "http://10.0.0.222/win&PS=16&NN";
//const char* LED_URL_ON = "http://10.0.0.222/win&T=1&FX=0&R=0&B=255&G=0&W=0&A=255&NN"; //const char* LED_URL_ON = "http://10.0.0.222/win&T=1&FX=0&R=0&B=255&G=0&W=0&A=255&NN";
//const char* LED_URL_OFF= "http://10.0.0.222/win&PL=16&NN"; //const char* LED_URL_OFF= "http://10.0.0.222/win&PL=16&NN";

View File

@@ -10,6 +10,7 @@ class LEDHandler : public QObject
public: public:
QString cURL = "10.0.0.222"; QString cURL = "10.0.0.222";
int cPORT = 21324; int cPORT = 21324;
int cLEDNUM = 26;
LEDHandler(QUdpSocket* sock, TS3Functions ts3Functions); LEDHandler(QUdpSocket* sock, TS3Functions ts3Functions);
@@ -25,6 +26,8 @@ public slots:
private: private:
QUdpSocket* mSock; QUdpSocket* mSock;
TS3Functions mTs3Functions; TS3Functions mTs3Functions;
bool succesful = false;
void sendColor(int R, int G, int B, int W, int t); void sendColor(int R, int G, int B, int W, int t);
}; };