mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Merge branch 'master' into support_for_philips_hue
Former-commit-id: ee3816fde708fa2f9f9e6ad50ec1e6d2ff552b23
This commit is contained in:
commit
32f09dcc24
@ -34,13 +34,13 @@ fi
|
||||
echo 'Downloading hyperion'
|
||||
if [ $IS_OPENELEC -eq 1 ]; then
|
||||
# OpenELEC has a readonly file system. Use alternative location
|
||||
curl --get https://raw.github.com/tvdzwan/hyperion/master/deploy/hyperion.tar.gz | tar -C /storage -xz
|
||||
curl --get https://raw.github.com/tvdzwan/hyperion/master/deploy/hyperion.deps.openelec-rpi.tar.gz | tar -C /storage/hyperion/bin -xz
|
||||
curl -L --get https://raw.githubusercontent.com/tvdzwan/hyperion/master/deploy/hyperion.tar.gz | tar -C /storage -xz
|
||||
curl -L --get https://raw.githubusercontent.com/tvdzwan/hyperion/master/deploy/hyperion.deps.openelec-rpi.tar.gz | tar -C /storage/hyperion/bin -xz
|
||||
|
||||
# modify the default config to have a correct effect path
|
||||
sed -i 's:/opt:/storage:g' /storage/hyperion/config/hyperion.config.json
|
||||
else
|
||||
wget https://raw.github.com/tvdzwan/hyperion/master/deploy/hyperion.tar.gz -O - | tar -C /opt -xz
|
||||
wget https://raw.githubusercontent.com/tvdzwan/hyperion/master/deploy/hyperion.tar.gz -O - | tar -C /opt -xz
|
||||
fi
|
||||
|
||||
# create links to the binaries
|
||||
@ -68,9 +68,9 @@ fi
|
||||
if [ $USE_INITCTL -eq 1 ]; then
|
||||
echo 'Installing initctl script'
|
||||
if [ $IS_RASPBMC -eq 1 ]; then
|
||||
wget -N https://raw.github.com/tvdzwan/hyperion/master/deploy/hyperion.conf -P /etc/init/
|
||||
wget -N https://raw.githubusercontent.com/tvdzwan/hyperion/master/deploy/hyperion.conf -P /etc/init/
|
||||
else
|
||||
wget -N https://raw.github.com/tvdzwan/hyperion/master/deploy/hyperion.xbian.conf -O /etc/init/hyperion.conf
|
||||
wget -N https://raw.githubusercontent.com/tvdzwan/hyperion/master/deploy/hyperion.xbian.conf -O /etc/init/hyperion.conf
|
||||
fi
|
||||
elif [ $USE_SERVICE -eq 1 ]; then
|
||||
echo 'Installing startup script in init.d'
|
||||
|
@ -1 +1 @@
|
||||
d61b685eca164580cb39eb5bc3cf65b89afad410
|
||||
e3e4ea5204c555e64aa909d5bbbd6ac95ebec0dc
|
@ -37,6 +37,9 @@ public:
|
||||
///
|
||||
void setSize(const unsigned width, const unsigned height);
|
||||
|
||||
/// Enable or disable the black border detector
|
||||
void enableBalckBorderDetector(bool enable);
|
||||
|
||||
///
|
||||
/// Processes the image to a list of led colors. This will update the size of the buffer-image
|
||||
/// if required and call the image-to-leds mapping to determine the mean color per led.
|
||||
@ -142,7 +145,7 @@ private:
|
||||
const LedString _ledString;
|
||||
|
||||
/// Flag the enables(true)/disabled(false) blackborder detector
|
||||
const bool _enableBlackBorderRemoval;
|
||||
bool _enableBlackBorderRemoval;
|
||||
|
||||
/// The processor for black border detection
|
||||
hyperion::BlackBorderProcessor * _borderProcessor;
|
||||
|
10
include/utils/Sleep.h
Normal file
10
include/utils/Sleep.h
Normal file
@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <QThread>
|
||||
|
||||
class Sleep : protected QThread {
|
||||
public:
|
||||
static inline void msleep(unsigned long msecs) {
|
||||
QThread::msleep(msecs);
|
||||
}
|
||||
};
|
@ -38,7 +38,7 @@ public:
|
||||
/// @param grabPhoto Whether or not to grab when the XBMC photo player is playing
|
||||
/// @param grabAudio Whether or not to grab when the XBMC audio player is playing
|
||||
/// @param grabMenu Whether or not to grab when nothing is playing (in XBMC menu)
|
||||
/// @param grabScreensaver Whether or not to grab when the XBMC screensaver is activated
|
||||
/// @param grabScreensaver Whether or not to grab when the XBMC screensaver is activated
|
||||
/// @param enable3DDetection Wheter or not to enable the detection of 3D movies playing
|
||||
///
|
||||
XBMCVideoChecker(const std::string & address, uint16_t port, bool grabVideo, bool grabPhoto, bool grabAudio, bool grabMenu, bool grabScreensaver, bool enable3DDetection);
|
||||
@ -96,6 +96,12 @@ private:
|
||||
/// The JSON-RPC message to check the screensaver
|
||||
const QString _checkScreensaverRequest;
|
||||
|
||||
/// The JSON-RPC message to check the active stereoscopicmode
|
||||
const QString _getStereoscopicMode;
|
||||
|
||||
/// The JSON-RPC message to check the xbmc version
|
||||
const QString _getXbmcVersion;
|
||||
|
||||
/// The QT TCP Socket with connection to XBMC
|
||||
QTcpSocket _socket;
|
||||
|
||||
@ -111,7 +117,7 @@ private:
|
||||
/// Flag indicating whether or not to grab when XBMC is playing nothing (in menu)
|
||||
const bool _grabMenu;
|
||||
|
||||
/// Flag inidcating whether or not to grab when the XBMC screensaver is activated
|
||||
/// Flag indicating whether or not to grab when the XBMC screensaver is activated
|
||||
const bool _grabScreensaver;
|
||||
|
||||
/// Flag indicating wheter or not to enable the detection of 3D movies playing
|
||||
@ -125,4 +131,7 @@ private:
|
||||
|
||||
/// Previous emitted video mode
|
||||
VideoMode _previousVideoMode;
|
||||
|
||||
/// XBMC version number
|
||||
int _xbmcVersion;
|
||||
};
|
||||
|
@ -64,6 +64,9 @@ Effect::Effect(PyThreadState * mainThreadState, int priority, int timeout, const
|
||||
{
|
||||
_colors.resize(_imageProcessor->getLedCount(), ColorRgb::BLACK);
|
||||
|
||||
// disable the black border detector for effects
|
||||
_imageProcessor->enableBalckBorderDetector(false);
|
||||
|
||||
// connect the finished signal
|
||||
connect(this, SIGNAL(finished()), this, SLOT(effectFinished()));
|
||||
}
|
||||
|
@ -43,6 +43,11 @@ void ImageProcessor::setSize(const unsigned width, const unsigned height)
|
||||
_imageToLeds = new ImageToLedsMap(width, height, 0, 0, _ledString.leds());
|
||||
}
|
||||
|
||||
void ImageProcessor::enableBalckBorderDetector(bool enable)
|
||||
{
|
||||
_enableBlackBorderRemoval = enable;
|
||||
}
|
||||
|
||||
bool ImageProcessor::getScanParameters(size_t led, double &hscanBegin, double &hscanEnd, double &vscanBegin, double &vscanEnd) const
|
||||
{
|
||||
if (led < _ledString.leds().size())
|
||||
|
@ -35,15 +35,16 @@ ImageToLedsMap::ImageToLedsMap(
|
||||
// skip leds without area
|
||||
if ((led.maxX_frac-led.minX_frac) < 1e-6 || (led.maxY_frac-led.minY_frac) < 1e-6)
|
||||
{
|
||||
mColorsMap.emplace_back();
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// Compute the index boundaries for this led
|
||||
unsigned minX_idx = xOffset + unsigned(std::round(actualWidth * led.minX_frac));
|
||||
unsigned maxX_idx = xOffset + unsigned(std::round(actualWidth * led.maxX_frac));
|
||||
unsigned minY_idx = yOffset + unsigned(std::round(actualHeight * led.minY_frac));
|
||||
unsigned maxY_idx = yOffset + unsigned(std::round(actualHeight * led.maxY_frac));
|
||||
|
||||
|
||||
// make sure that the area is at least a single led large
|
||||
minX_idx = std::min(minX_idx, xOffset + actualWidth - 1);
|
||||
if (minX_idx == maxX_idx)
|
||||
|
@ -13,6 +13,7 @@ include_directories(
|
||||
|
||||
# Group the headers that go through the MOC compiler
|
||||
SET(Leddevice_QT_HEADERS
|
||||
${CURRENT_SOURCE_DIR}/LedRs232Device.h
|
||||
${CURRENT_SOURCE_DIR}/LedDeviceAdalight.h
|
||||
${CURRENT_SOURCE_DIR}/LedDevicePhilipsHue.h
|
||||
)
|
||||
@ -21,8 +22,6 @@ SET(Leddevice_HEADERS
|
||||
${CURRENT_HEADER_DIR}/LedDevice.h
|
||||
${CURRENT_HEADER_DIR}/LedDeviceFactory.h
|
||||
|
||||
${CURRENT_SOURCE_DIR}/LedRs232Device.h
|
||||
|
||||
${CURRENT_SOURCE_DIR}/LedDeviceLightpack.h
|
||||
${CURRENT_SOURCE_DIR}/LedDeviceMultiLightpack.h
|
||||
${CURRENT_SOURCE_DIR}/LedDevicePaintpack.h
|
||||
|
@ -11,8 +11,8 @@
|
||||
// hyperion local includes
|
||||
#include "LedDeviceAdalight.h"
|
||||
|
||||
LedDeviceAdalight::LedDeviceAdalight(const std::string& outputDevice, const unsigned baudrate) :
|
||||
LedRs232Device(outputDevice, baudrate),
|
||||
LedDeviceAdalight::LedDeviceAdalight(const std::string& outputDevice, const unsigned baudrate, int delayAfterConnect_ms) :
|
||||
LedRs232Device(outputDevice, baudrate, delayAfterConnect_ms),
|
||||
_ledBuffer(0),
|
||||
_timer()
|
||||
{
|
||||
|
@ -12,7 +12,7 @@
|
||||
///
|
||||
/// Implementation of the LedDevice interface for writing to an Adalight led device.
|
||||
///
|
||||
class LedDeviceAdalight : public QObject, public LedRs232Device
|
||||
class LedDeviceAdalight : public LedRs232Device
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -23,7 +23,7 @@ public:
|
||||
/// @param outputDevice The name of the output device (eg '/dev/ttyS0')
|
||||
/// @param baudrate The used baudrate for writing to the output device
|
||||
///
|
||||
LedDeviceAdalight(const std::string& outputDevice, const unsigned baudrate);
|
||||
LedDeviceAdalight(const std::string& outputDevice, const unsigned baudrate, int delayAfterConnect_ms);
|
||||
|
||||
///
|
||||
/// Writes the led color values to the led-device
|
||||
|
@ -43,8 +43,9 @@ LedDevice * LedDeviceFactory::construct(const Json::Value & deviceConfig)
|
||||
{
|
||||
const std::string output = deviceConfig["output"].asString();
|
||||
const unsigned rate = deviceConfig["rate"].asInt();
|
||||
const int delay_ms = deviceConfig["delayAfterConnect"].asInt();
|
||||
|
||||
LedDeviceAdalight* deviceAdalight = new LedDeviceAdalight(output, rate);
|
||||
LedDeviceAdalight* deviceAdalight = new LedDeviceAdalight(output, rate, delay_ms);
|
||||
deviceAdalight->open();
|
||||
|
||||
device = deviceAdalight;
|
||||
|
@ -14,11 +14,13 @@
|
||||
|
||||
/**
|
||||
* Implementation for the Philips Hue system.
|
||||
*
|
||||
*
|
||||
* To use set the device to "philipshue".
|
||||
* Uses the official Philips Hue API (http://developers.meethue.com).
|
||||
* Framegrabber must be limited to 10 Hz / numer of lights to avoid rate limitation by the hue bridge.
|
||||
* Create a new API user name "newdeveloper" on the bridge (http://developers.meethue.com/gettingstarted.html)
|
||||
*
|
||||
* @author ntim (github)
|
||||
*/
|
||||
class LedDevicePhilipsHue: public QObject, public LedDevice {
|
||||
Q_OBJECT
|
||||
|
@ -4,17 +4,21 @@
|
||||
#include <cstdio>
|
||||
#include <iostream>
|
||||
|
||||
// Qt includes
|
||||
#include <QTimer>
|
||||
|
||||
// Serial includes
|
||||
#include <serial/serial.h>
|
||||
|
||||
// Local Hyperion includes
|
||||
#include "LedRs232Device.h"
|
||||
|
||||
|
||||
LedRs232Device::LedRs232Device(const std::string& outputDevice, const unsigned baudrate) :
|
||||
mDeviceName(outputDevice),
|
||||
mBaudRate_Hz(baudrate),
|
||||
_rs232Port()
|
||||
LedRs232Device::LedRs232Device(const std::string& outputDevice, const unsigned baudrate, int delayAfterConnect_ms) :
|
||||
_deviceName(outputDevice),
|
||||
_baudRate_Hz(baudrate),
|
||||
_delayAfterConnect_ms(delayAfterConnect_ms),
|
||||
_rs232Port(),
|
||||
_blockedForDelay(false)
|
||||
{
|
||||
// empty
|
||||
}
|
||||
@ -31,10 +35,17 @@ int LedRs232Device::open()
|
||||
{
|
||||
try
|
||||
{
|
||||
std::cout << "Opening UART: " << mDeviceName << std::endl;
|
||||
_rs232Port.setPort(mDeviceName);
|
||||
_rs232Port.setBaudrate(mBaudRate_Hz);
|
||||
std::cout << "Opening UART: " << _deviceName << std::endl;
|
||||
_rs232Port.setPort(_deviceName);
|
||||
_rs232Port.setBaudrate(_baudRate_Hz);
|
||||
_rs232Port.open();
|
||||
|
||||
if (_delayAfterConnect_ms > 0)
|
||||
{
|
||||
_blockedForDelay = true;
|
||||
QTimer::singleShot(_delayAfterConnect_ms, this, SLOT(unblockAfterDelay()));
|
||||
std::cout << "Device blocked for " << _delayAfterConnect_ms << " ms" << std::endl;
|
||||
}
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
@ -47,6 +58,11 @@ int LedRs232Device::open()
|
||||
|
||||
int LedRs232Device::writeBytes(const unsigned size, const uint8_t * data)
|
||||
{
|
||||
if (_blockedForDelay)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!_rs232Port.isOpen())
|
||||
{
|
||||
return -1;
|
||||
@ -95,3 +111,9 @@ int LedRs232Device::writeBytes(const unsigned size, const uint8_t * data)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void LedRs232Device::unblockAfterDelay()
|
||||
{
|
||||
std::cout << "Device unblocked" << std::endl;
|
||||
_blockedForDelay = false;
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
|
||||
// Serial includes
|
||||
#include <serial/serial.h>
|
||||
|
||||
@ -9,8 +11,10 @@
|
||||
///
|
||||
/// The LedRs232Device implements an abstract base-class for LedDevices using a RS232-device.
|
||||
///
|
||||
class LedRs232Device : public LedDevice
|
||||
class LedRs232Device : public QObject, public LedDevice
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
///
|
||||
/// Constructs the LedDevice attached to a RS232-device
|
||||
@ -18,7 +22,7 @@ public:
|
||||
/// @param[in] outputDevice The name of the output device (eg '/etc/ttyS0')
|
||||
/// @param[in] baudrate The used baudrate for writing to the output device
|
||||
///
|
||||
LedRs232Device(const std::string& outputDevice, const unsigned baudrate);
|
||||
LedRs232Device(const std::string& outputDevice, const unsigned baudrate, int delayAfterConnect_ms = 0);
|
||||
|
||||
///
|
||||
/// Destructor of the LedDevice; closes the output device if it is open
|
||||
@ -43,12 +47,22 @@ protected:
|
||||
*/
|
||||
int writeBytes(const unsigned size, const uint8_t *data);
|
||||
|
||||
private slots:
|
||||
/// Unblock the device after a connection delay
|
||||
void unblockAfterDelay();
|
||||
|
||||
private:
|
||||
/// The name of the output device
|
||||
const std::string mDeviceName;
|
||||
const std::string _deviceName;
|
||||
|
||||
/// The used baudrate of the output device
|
||||
const int mBaudRate_Hz;
|
||||
const int _baudRate_Hz;
|
||||
|
||||
/// Sleep after the connect before continuing
|
||||
const int _delayAfterConnect_ms;
|
||||
|
||||
/// The RS232 serial-device
|
||||
serial::Serial _rs232Port;
|
||||
|
||||
bool _blockedForDelay;
|
||||
};
|
||||
|
@ -11,6 +11,7 @@ add_library(hyperion-utils
|
||||
${CURRENT_HEADER_DIR}/ColorRgba.h
|
||||
${CURRENT_SOURCE_DIR}/ColorRgba.cpp
|
||||
${CURRENT_HEADER_DIR}/Image.h
|
||||
${CURRENT_HEADER_DIR}/Sleep.h
|
||||
|
||||
${CURRENT_HEADER_DIR}/HsvTransform.h
|
||||
${CURRENT_SOURCE_DIR}/HsvTransform.cpp
|
||||
|
@ -17,6 +17,10 @@
|
||||
// {"id":668,"jsonrpc":"2.0","method":"XBMC.GetInfoBooleans","params":{"booleans":["System.ScreenSaverActive"]}}
|
||||
// {"id":668,"jsonrpc":"2.0","result":{"System.ScreenSaverActive":false}}
|
||||
|
||||
// Request stereoscopicmode example:
|
||||
// {"jsonrpc":"2.0","method":"GUI.GetProperties","params":{"properties":["stereoscopicmode"]},"id":669}
|
||||
// {"id":669,"jsonrpc":"2.0","result":{"stereoscopicmode":{"label":"Nebeneinander","mode":"split_vertical"}}}
|
||||
|
||||
XBMCVideoChecker::XBMCVideoChecker(const std::string & address, uint16_t port, bool grabVideo, bool grabPhoto, bool grabAudio, bool grabMenu, bool grabScreensaver, bool enable3DDetection) :
|
||||
QObject(),
|
||||
_address(QString::fromStdString(address)),
|
||||
@ -24,6 +28,8 @@ XBMCVideoChecker::XBMCVideoChecker(const std::string & address, uint16_t port, b
|
||||
_activePlayerRequest(R"({"id":666,"jsonrpc":"2.0","method":"Player.GetActivePlayers"})"),
|
||||
_currentPlayingItemRequest(R"({"id":667,"jsonrpc":"2.0","method":"Player.GetItem","params":{"playerid":%1,"properties":["file"]}})"),
|
||||
_checkScreensaverRequest(R"({"id":668,"jsonrpc":"2.0","method":"XBMC.GetInfoBooleans","params":{"booleans":["System.ScreenSaverActive"]}})"),
|
||||
_getStereoscopicMode(R"({"jsonrpc":"2.0","method":"GUI.GetProperties","params":{"properties":["stereoscopicmode"]},"id":669})"),
|
||||
_getXbmcVersion(R"({"jsonrpc":"2.0","method":"Application.GetProperties","params":{"properties":["version"]},"id":670})"),
|
||||
_socket(),
|
||||
_grabVideo(grabVideo),
|
||||
_grabPhoto(grabPhoto),
|
||||
@ -33,7 +39,8 @@ XBMCVideoChecker::XBMCVideoChecker(const std::string & address, uint16_t port, b
|
||||
_enable3DDetection(enable3DDetection),
|
||||
_previousScreensaverMode(false),
|
||||
_previousGrabbingMode(GRABBINGMODE_INVALID),
|
||||
_previousVideoMode(VIDEO_2D)
|
||||
_previousVideoMode(VIDEO_2D),
|
||||
_xbmcVersion(0)
|
||||
{
|
||||
// setup socket
|
||||
connect(&_socket, SIGNAL(readyRead()), this, SLOT(receiveReply()));
|
||||
@ -116,24 +123,32 @@ void XBMCVideoChecker::receiveReply()
|
||||
}
|
||||
else if (reply.contains("\"id\":667"))
|
||||
{
|
||||
// result of Player.GetItem
|
||||
// TODO: what if the filename contains a '"'. In Json this should have been escaped
|
||||
QRegExp regex("\"file\":\"((?!\").)*\"");
|
||||
int pos = regex.indexIn(reply);
|
||||
if (pos > 0)
|
||||
if (_xbmcVersion >= 13)
|
||||
{
|
||||
QStringRef filename = QStringRef(&reply, pos+8, regex.matchedLength()-9);
|
||||
if (filename.contains("3DSBS", Qt::CaseInsensitive) || filename.contains("HSBS", Qt::CaseInsensitive))
|
||||
// check of active stereoscopicmode
|
||||
_socket.write(_getStereoscopicMode.toUtf8());
|
||||
}
|
||||
else
|
||||
{
|
||||
// result of Player.GetItem
|
||||
// TODO: what if the filename contains a '"'. In Json this should have been escaped
|
||||
QRegExp regex("\"file\":\"((?!\").)*\"");
|
||||
int pos = regex.indexIn(reply);
|
||||
if (pos > 0)
|
||||
{
|
||||
setVideoMode(VIDEO_3DSBS);
|
||||
}
|
||||
else if (filename.contains("3DTAB", Qt::CaseInsensitive) || filename.contains("HTAB", Qt::CaseInsensitive))
|
||||
{
|
||||
setVideoMode(VIDEO_3DTAB);
|
||||
}
|
||||
else
|
||||
{
|
||||
setVideoMode(VIDEO_2D);
|
||||
QStringRef filename = QStringRef(&reply, pos+8, regex.matchedLength()-9);
|
||||
if (filename.contains("3DSBS", Qt::CaseInsensitive) || filename.contains("HSBS", Qt::CaseInsensitive))
|
||||
{
|
||||
setVideoMode(VIDEO_3DSBS);
|
||||
}
|
||||
else if (filename.contains("3DTAB", Qt::CaseInsensitive) || filename.contains("HTAB", Qt::CaseInsensitive))
|
||||
{
|
||||
setVideoMode(VIDEO_3DTAB);
|
||||
}
|
||||
else
|
||||
{
|
||||
setVideoMode(VIDEO_2D);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -142,6 +157,41 @@ void XBMCVideoChecker::receiveReply()
|
||||
// result of System.ScreenSaverActive
|
||||
bool active = reply.contains("\"System.ScreenSaverActive\":true");
|
||||
setScreensaverMode(!_grabScreensaver && active);
|
||||
|
||||
// check here xbmc version
|
||||
if (_socket.state() == QTcpSocket::ConnectedState)
|
||||
{
|
||||
if (_xbmcVersion == 0)
|
||||
{
|
||||
_socket.write(_getXbmcVersion.toUtf8());
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (reply.contains("\"id\":669"))
|
||||
{
|
||||
QRegExp regex("\"mode\":\"(split_vertical|split_horizontal)\"");
|
||||
int pos = regex.indexIn(reply);
|
||||
if (pos > 0)
|
||||
{
|
||||
QString sMode = regex.cap(1);
|
||||
if (sMode == "split_vertical")
|
||||
{
|
||||
setVideoMode(VIDEO_3DSBS);
|
||||
}
|
||||
else if (sMode == "split_horizontal")
|
||||
{
|
||||
setVideoMode(VIDEO_3DTAB);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (reply.contains("\"id\":670"))
|
||||
{
|
||||
QRegExp regex("\"major\":(\\d+)");
|
||||
int pos = regex.indexIn(reply);
|
||||
if (pos > 0)
|
||||
{
|
||||
_xbmcVersion = regex.cap(1).toInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -112,14 +112,31 @@ int main(int argc, char** argv)
|
||||
const std::string effectName = effectConfig["effect"].asString();
|
||||
const unsigned duration_ms = effectConfig["duration_ms"].asUInt();
|
||||
const int priority = 0;
|
||||
|
||||
if (hyperion.setEffect(effectName, priority, duration_ms) == 0)
|
||||
|
||||
if (effectConfig.isMember("args"))
|
||||
{
|
||||
std::cout << "Boot sequence(" << effectName << ") created and started" << std::endl;
|
||||
const Json::Value effectConfigArgs = effectConfig["args"];
|
||||
if (hyperion.setEffect(effectName, effectConfigArgs, priority, duration_ms) == 0)
|
||||
{
|
||||
std::cout << "Boot sequence(" << effectName << ") with user-defined arguments created and started" << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Failed to start boot sequence: " << effectName << " with user-defined arguments" << std::endl;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Failed to start boot sequence: " << effectName << std::endl;
|
||||
|
||||
if (hyperion.setEffect(effectName, priority, duration_ms) == 0)
|
||||
{
|
||||
std::cout << "Boot sequence(" << effectName << ") created and started" << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Failed to start boot sequence: " << effectName << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user