mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
implement origin for effects (#408)
* implement rigin for efx * implement origin for effects and other components add experimental adalight firmware for arduino with upto 5 pwm channels * cleanup * origin ip now with dns lookup * fix compile * move some code
This commit is contained in:
@@ -109,27 +109,29 @@ void UDPListener::readPendingDatagrams()
|
||||
|
||||
_server->readDatagram(datagram.data(), datagram.size(), &sender, &senderPort);
|
||||
|
||||
processTheDatagram(&datagram);
|
||||
processTheDatagram(&datagram, &sender);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void UDPListener::processTheDatagram(const QByteArray * datagram)
|
||||
void UDPListener::processTheDatagram(const QByteArray * datagram, const QHostAddress * sender)
|
||||
{
|
||||
int packetLedCount = datagram->size()/3;
|
||||
int hyperionLedCount = Hyperion::getInstance()->getLedCount();
|
||||
DebugIf( (packetLedCount != hyperionLedCount), _log, "packetLedCount (%d) != hyperionLedCount (%d)", packetLedCount, hyperionLedCount);
|
||||
|
||||
std::vector<ColorRgb> _ledColors(Hyperion::getInstance()->getLedCount(), ColorRgb::BLACK);
|
||||
std::vector<ColorRgb> _ledColors(Hyperion::getInstance()->getLedCount(), ColorRgb::BLACK);
|
||||
|
||||
for (int ledIndex=0; ledIndex < std::min(packetLedCount, hyperionLedCount); ledIndex++) {
|
||||
for (int ledIndex=0; ledIndex < std::min(packetLedCount, hyperionLedCount); ledIndex++) {
|
||||
ColorRgb & rgb = _ledColors[ledIndex];
|
||||
rgb.red = datagram->at(ledIndex*3+0);
|
||||
rgb.red = datagram->at(ledIndex*3+0);
|
||||
rgb.green = datagram->at(ledIndex*3+1);
|
||||
rgb.blue = datagram->at(ledIndex*3+2);
|
||||
rgb.blue = datagram->at(ledIndex*3+2);
|
||||
}
|
||||
|
||||
_hyperion->setColors(_priority, _ledColors, _timeout, -1, hyperion::COMP_UDPLISTENER);
|
||||
|
||||
_hyperion->setColors(_priority, _ledColors, _timeout, -1, hyperion::COMP_UDPLISTENER, sender->toString());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user