mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Add SIGUSR1 and SIGUSR2 signals to disable/enable the LEDs
Fixed enable on LedDeviceWrapper constructor.
This commit is contained in:
parent
48aee89032
commit
0e756beae4
@ -98,6 +98,8 @@ int LinearColorSmoothing::switchOff()
|
|||||||
_outputQueue.pop_front();
|
_outputQueue.pop_front();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
emit _hyperion->ledDeviceData(std::vector<ColorRgb>(_ledCount, ColorRgb::BLACK));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ LedDeviceWrapper::LedDeviceWrapper(Hyperion* hyperion)
|
|||||||
: QObject(hyperion)
|
: QObject(hyperion)
|
||||||
, _hyperion(hyperion)
|
, _hyperion(hyperion)
|
||||||
, _ledDevice(nullptr)
|
, _ledDevice(nullptr)
|
||||||
|
, _enabled(true)
|
||||||
{
|
{
|
||||||
// prepare the device constrcutor map
|
// prepare the device constrcutor map
|
||||||
#define REGISTER(className) LedDeviceWrapper::addToDeviceMap(QString(#className).toLower(), LedDevice##className::construct);
|
#define REGISTER(className) LedDeviceWrapper::addToDeviceMap(QString(#className).toLower(), LedDevice##className::construct);
|
||||||
|
@ -41,12 +41,33 @@ using namespace commandline;
|
|||||||
|
|
||||||
void signal_handler(const int signum)
|
void signal_handler(const int signum)
|
||||||
{
|
{
|
||||||
|
/// Hyperion instance
|
||||||
|
Hyperion* _hyperion = Hyperion::getInstance();
|
||||||
|
|
||||||
if(signum == SIGCHLD)
|
if(signum == SIGCHLD)
|
||||||
{
|
{
|
||||||
// only quit when a registered child process is gone
|
// only quit when a registered child process is gone
|
||||||
// currently this feature is not active ...
|
// currently this feature is not active ...
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else if (signum == SIGUSR1)
|
||||||
|
{
|
||||||
|
if (_hyperion != nullptr)
|
||||||
|
{
|
||||||
|
_hyperion->setComponentState(hyperion::COMP_SMOOTHING, false);
|
||||||
|
_hyperion->setComponentState(hyperion::COMP_LEDDEVICE, false);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (signum == SIGUSR2)
|
||||||
|
{
|
||||||
|
if (_hyperion != nullptr)
|
||||||
|
{
|
||||||
|
_hyperion->setComponentState(hyperion::COMP_LEDDEVICE, true);
|
||||||
|
_hyperion->setComponentState(hyperion::COMP_SMOOTHING, true);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
QCoreApplication::quit();
|
QCoreApplication::quit();
|
||||||
|
|
||||||
// reset signal handler to default (in case this handler is not capable of stopping)
|
// reset signal handler to default (in case this handler is not capable of stopping)
|
||||||
@ -132,6 +153,8 @@ int main(int argc, char** argv)
|
|||||||
signal(SIGABRT, signal_handler);
|
signal(SIGABRT, signal_handler);
|
||||||
signal(SIGCHLD, signal_handler);
|
signal(SIGCHLD, signal_handler);
|
||||||
signal(SIGPIPE, signal_handler);
|
signal(SIGPIPE, signal_handler);
|
||||||
|
signal(SIGUSR1, signal_handler);
|
||||||
|
signal(SIGUSR2, signal_handler);
|
||||||
|
|
||||||
// force the locale
|
// force the locale
|
||||||
setlocale(LC_ALL, "C");
|
setlocale(LC_ALL, "C");
|
||||||
|
Loading…
Reference in New Issue
Block a user