mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
trigger muxer on color changes
Signed-off-by: Paulchen-Panther <Paulchen-Panter@protonmail.com>
This commit is contained in:
parent
6e6d6f5892
commit
a3b326a18d
@ -300,6 +300,7 @@ $(document).ready(function() {
|
|||||||
rgb = rgbT;
|
rgb = rgbT;
|
||||||
sendColor();
|
sendColor();
|
||||||
setStorage('rmcpcolor', hex);
|
setStorage('rmcpcolor', hex);
|
||||||
|
updateInputSelect();
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#reset_color").off().on("click", function(){
|
$("#reset_color").off().on("click", function(){
|
||||||
|
@ -37,7 +37,7 @@ public:
|
|||||||
/// @param inst The instance to check
|
/// @param inst The instance to check
|
||||||
/// @return True when running else false
|
/// @return True when running else false
|
||||||
///
|
///
|
||||||
const bool IsInstanceRunning(const quint8& inst) { return _runningInstances.contains(inst); };
|
bool IsInstanceRunning(const quint8& inst) { return _runningInstances.contains(inst); };
|
||||||
|
|
||||||
///
|
///
|
||||||
/// @brief Get a Hyperion instance by index
|
/// @brief Get a Hyperion instance by index
|
||||||
|
@ -182,6 +182,11 @@ public:
|
|||||||
///
|
///
|
||||||
void clearAll(bool forceClearAll=false);
|
void clearAll(bool forceClearAll=false);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// @brief Queue a manual push where muxer doesn't recognize them (e.g. continous single color pushes)
|
||||||
|
///
|
||||||
|
void queuePush(void){ emit timeRunner(); };
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
///
|
///
|
||||||
/// @brief Signal which emits when a effect or color with timeout > -1 is running, once per second
|
/// @brief Signal which emits when a effect or color with timeout > -1 is running, once per second
|
||||||
|
@ -210,35 +210,13 @@ void JsonAPI::handleColorCommand(const QJsonObject& message, const QString& comm
|
|||||||
// extract parameters
|
// extract parameters
|
||||||
int priority = message["priority"].toInt();
|
int priority = message["priority"].toInt();
|
||||||
int duration = message["duration"].toInt(-1);
|
int duration = message["duration"].toInt(-1);
|
||||||
QString origin = message["origin"].toString("Empty") + "@"+_peerAddress;
|
const QString origin = message["origin"].toString("Empty") + "@"+_peerAddress;
|
||||||
|
|
||||||
std::vector<ColorRgb> colorData(_hyperion->getLedCount());
|
|
||||||
const QJsonArray & jsonColor = message["color"].toArray();
|
const QJsonArray & jsonColor = message["color"].toArray();
|
||||||
unsigned int i = 0;
|
const ColorRgb color = {uint8_t(jsonColor.at(0).toInt()),uint8_t(jsonColor.at(1).toInt()),uint8_t(jsonColor.at(2).toInt())};
|
||||||
for (; i < unsigned(jsonColor.size()/3) && i < _hyperion->getLedCount(); ++i)
|
|
||||||
{
|
|
||||||
colorData[i].red = uint8_t(jsonColor.at(3u*i).toInt());
|
|
||||||
colorData[i].green = uint8_t(jsonColor.at(3u*i+1u).toInt());
|
|
||||||
colorData[i].blue = uint8_t(jsonColor.at(3u*i+2u).toInt());
|
|
||||||
}
|
|
||||||
|
|
||||||
// copy full blocks of led colors
|
// set color
|
||||||
unsigned size = i;
|
_hyperion->setColor(priority, color, duration, origin);
|
||||||
while (i + size < _hyperion->getLedCount())
|
|
||||||
{
|
|
||||||
memcpy(&(colorData[i]), colorData.data(), size * sizeof(ColorRgb));
|
|
||||||
i += size;
|
|
||||||
}
|
|
||||||
|
|
||||||
// copy remaining block of led colors
|
|
||||||
if (i < _hyperion->getLedCount())
|
|
||||||
{
|
|
||||||
memcpy(&(colorData[i]), colorData.data(), (_hyperion->getLedCount()-i) * sizeof(ColorRgb));
|
|
||||||
}
|
|
||||||
|
|
||||||
// register and set color
|
|
||||||
_hyperion->registerInput(priority, hyperion::COMP_COLOR, origin);
|
|
||||||
_hyperion->setInput(priority, colorData, duration);
|
|
||||||
|
|
||||||
// send reply
|
// send reply
|
||||||
sendSuccessReply(command, tan);
|
sendSuccessReply(command, tan);
|
||||||
|
@ -357,8 +357,10 @@ void Hyperion::setColor(int priority, const ColorRgb &color, const int timeout_m
|
|||||||
// register color
|
// register color
|
||||||
registerInput(priority, hyperion::COMP_COLOR, origin);
|
registerInput(priority, hyperion::COMP_COLOR, origin);
|
||||||
|
|
||||||
// write color to muxer
|
// write color to muxer & queuePush
|
||||||
setInput(priority, ledColors, timeout_ms);
|
setInput(priority, ledColors, timeout_ms);
|
||||||
|
if(timeout_ms <= 0)
|
||||||
|
_muxer.queuePush();
|
||||||
}
|
}
|
||||||
|
|
||||||
const QStringList & Hyperion::getAdjustmentIds() const
|
const QStringList & Hyperion::getAdjustmentIds() const
|
||||||
|
@ -155,8 +155,8 @@ bool HyperionIManager::deleteInstance(const quint8& inst)
|
|||||||
if(!isInstAllowed(inst))
|
if(!isInstAllowed(inst))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// stop it if required as blocking
|
// stop it if required as blocking and wait
|
||||||
stopInstance(inst, true);
|
if (stopInstance(inst, true));
|
||||||
|
|
||||||
if(_instanceTable->deleteInstance(inst))
|
if(_instanceTable->deleteInstance(inst))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user