feat: Add configurable color order to WledClient
This commit is contained in:
parent
9cb3fe0a72
commit
8b35c5f58c
4
main.cpp
4
main.cpp
@ -181,10 +181,12 @@ int main(int argc, char *argv[])
|
||||
processorConfig["blackborderdetector"] = blackBorderDetectorConfig;
|
||||
processorConfig["smoothing"] = smoothingConfig;
|
||||
|
||||
QString wledColorOrder = qgetenv("HYPERION_GRABBER_WLED_COLOR_ORDER").isEmpty() ? QString("GRB") : QString(qgetenv("HYPERION_GRABBER_WLED_COLOR_ORDER"));
|
||||
|
||||
// Instantiate components
|
||||
grabber = new HyperionGrabber(grabberOpts);
|
||||
processor = new HyperionProcessor(layout, processorConfig);
|
||||
wledClient = new WledClient(wledAddress, wledPort);
|
||||
wledClient = new WledClient(wledAddress, wledPort, wledColorOrder);
|
||||
|
||||
// Connect grabber to image receiver slot
|
||||
QObject::connect(grabber, &HyperionGrabber::imageReady, &onImageReady);
|
||||
|
||||
@ -12,13 +12,14 @@ const quint8 DDP_PROTOCOL_DNRGB = 4;
|
||||
// 4 bytes for DDP header, so 504 bytes for LED data
|
||||
const int MAX_LED_DATA_PER_PACKET = 504; // 504 bytes / 3 bytes per LED = 168 LEDs
|
||||
|
||||
WledClient::WledClient(QString host, ushort port, QObject *parent) :
|
||||
WledClient::WledClient(QString host, ushort port, QString colorOrder, QObject *parent) :
|
||||
QObject(parent),
|
||||
_wledHost(host),
|
||||
_wledPort(port)
|
||||
_wledPort(port),
|
||||
_colorOrder(colorOrder)
|
||||
{
|
||||
_udpSocket = new QUdpSocket(this);
|
||||
qDebug() << "WledClient initialized for host:" << _wledHost.toString() << "port:" << _wledPort;
|
||||
qDebug() << "WledClient initialized for host:" << _wledHost.toString() << "port:" << _wledPort << "color order:" << _colorOrder;
|
||||
}
|
||||
|
||||
WledClient::~WledClient()
|
||||
|
||||
@ -11,7 +11,7 @@ class WledClient : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit WledClient(QString host, ushort port, QObject *parent = nullptr);
|
||||
explicit WledClient(QString host, ushort port, QString colorOrder = "GRB", QObject *parent = nullptr);
|
||||
~WledClient();
|
||||
|
||||
void sendImage(const QImage &image);
|
||||
@ -22,6 +22,7 @@ private:
|
||||
QUdpSocket *_udpSocket;
|
||||
QHostAddress _wledHost;
|
||||
ushort _wledPort;
|
||||
QString _colorOrder;
|
||||
|
||||
signals:
|
||||
void error(QString message);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user