Skip to content

Commit

Permalink
Fixes for HyperHDR v20beta2 (#787)
Browse files Browse the repository at this point in the history
  • Loading branch information
awawa-dev authored Mar 9, 2024
1 parent 695c6a7 commit fc83579
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 14 deletions.
8 changes: 6 additions & 2 deletions sources/base/HyperHdrManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,11 @@ void HyperHdrManager::hibernate(bool wakeUp, hyperhdr::SystemComponent source)

if (_hasEffect)
{
toggleGrabbersAllInstances(wakeUp);
if (wakeUp)
QTimer::singleShot(3000, this, [this, wakeUp]() { toggleGrabbersAllInstances(wakeUp); });
else
toggleGrabbersAllInstances(wakeUp);

return;
}
}
Expand All @@ -209,7 +213,7 @@ void HyperHdrManager::hibernate(bool wakeUp, hyperhdr::SystemComponent source)
else
{
Warning(_log, "The system is going to wake up");
QTimer::singleShot(3000, [this]() { toggleStateAllInstances(true); });
QTimer::singleShot(3000, this, [this]() { toggleStateAllInstances(true); });
}
}

Expand Down
7 changes: 4 additions & 3 deletions sources/base/LedCalibration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,10 @@ void LedCalibration::setAdjustmentForLed(int index, std::shared_ptr<ColorCalibra
Debug(_log, "Calibration config '%i' for LED segment: [%d, %d]", index, startLed, endLed);

for (size_t iLed = startLed; iLed <= endLed; ++iLed)
{
_perLedConfig[iLed] = adjustment;
}
if (iLed < 0 || iLed >= _perLedConfig.size())
Error(_log, "Cannot apply calibration config because LED index '%i' does not exist", iLed);
else
_perLedConfig[iLed] = adjustment;
}

bool LedCalibration::verifyAdjustments() const
Expand Down
2 changes: 1 addition & 1 deletion sources/base/RawUdpServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ RawUdpServer::~RawUdpServer()
{
stopServer();

std::cout << "RawUdpServer exists now" << std::endl;
std::cout << "RawUdpServer exits now" << std::endl;
}

void RawUdpServer::initServer()
Expand Down
10 changes: 6 additions & 4 deletions sources/base/SystemControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ SystemControl::~SystemControl()
{
emit GlobalSignals::getInstance()->SignalRequestComponent(hyperhdr::COMP_SYSTEMGRABBER, int(_hyperhdr->getInstanceIndex()), false);

std::cout << "SystemControl exists now" << std::endl;
std::cout << "SystemControl exits now" << std::endl;
}

quint8 SystemControl::getCapturePriority()
Expand All @@ -78,10 +78,13 @@ bool SystemControl::isCEC()

void SystemControl::handleSysImage(const QString& name, const Image<ColorRgb>& image)
{
if (!_sysCaptEnabled)
return;

if (_sysCaptName != name)
{
_hyperhdr->registerInput(_sysCaptPrio, hyperhdr::COMP_SYSTEMGRABBER, "System", name);
_sysCaptName = name;
_hyperhdr->registerInput(_sysCaptPrio, hyperhdr::COMP_SYSTEMGRABBER, "System", _sysCaptName);
}

_alive = true;
Expand All @@ -98,15 +101,14 @@ void SystemControl::setSysCaptureEnable(bool enable)
{
if (enable)
{
_hyperhdr->registerInput(_sysCaptPrio, hyperhdr::COMP_SYSTEMGRABBER);
_hyperhdr->registerInput(_sysCaptPrio, hyperhdr::COMP_SYSTEMGRABBER, "System", _sysCaptName);
connect(GlobalSignals::getInstance(), &GlobalSignals::SignalNewSystemImage, this, &SystemControl::handleSysImage, Qt::UniqueConnection);
}
else
{
disconnect(GlobalSignals::getInstance(), &GlobalSignals::SignalNewSystemImage, this, &SystemControl::handleSysImage);
_hyperhdr->clear(_sysCaptPrio);
_sysInactiveTimer->stop();
_sysCaptName = "";
}

_sysCaptEnabled = enable;
Expand Down
10 changes: 6 additions & 4 deletions sources/base/VideoControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ VideoControl::~VideoControl()
emit GlobalSignals::getInstance()->SignalRequestComponent(hyperhdr::COMP_VIDEOGRABBER, int(_hyperhdr->getInstanceIndex()), false);
emit GlobalSignals::getInstance()->SignalRequestComponent(hyperhdr::COMP_CEC, int(_hyperhdr->getInstanceIndex()), false);

std::cout << "VideoControl exists now" << std::endl;
std::cout << "VideoControl exits now" << std::endl;
}

bool VideoControl::isCEC()
Expand All @@ -93,6 +93,9 @@ void VideoControl::handleUsbImage()
{
Image<ColorRgb> image;
QString name;

if (!_usbCaptEnabled)
return;

incoming.mutex.lock();
{
Expand All @@ -109,8 +112,8 @@ void VideoControl::handleUsbImage()

if (_usbCaptName != name)
{
_hyperhdr->registerInput(_usbCaptPrio, hyperhdr::COMP_VIDEOGRABBER, "System", name);
_usbCaptName = name;
_hyperhdr->registerInput(_usbCaptPrio, hyperhdr::COMP_VIDEOGRABBER, "System", _usbCaptName);
}

_alive = true;
Expand All @@ -127,15 +130,14 @@ void VideoControl::setUsbCaptureEnable(bool enable)
{
if (enable)
{
_hyperhdr->registerInput(_usbCaptPrio, hyperhdr::COMP_VIDEOGRABBER);
_hyperhdr->registerInput(_usbCaptPrio, hyperhdr::COMP_VIDEOGRABBER, "System", _usbCaptName);
connect(GlobalSignals::getInstance(), &GlobalSignals::SignalNewVideoImage, this, &VideoControl::handleIncomingUsbImage, static_cast<Qt::ConnectionType>(Qt::DirectConnection | Qt::UniqueConnection));
}
else
{
disconnect(GlobalSignals::getInstance(), &GlobalSignals::SignalNewVideoImage, this, &VideoControl::handleIncomingUsbImage);
_hyperhdr->clear(_usbCaptPrio);
_usbInactiveTimer->stop();
_usbCaptName = "";
}

_usbCaptEnabled = enable;
Expand Down
1 change: 1 addition & 0 deletions sources/leddevice/LedDeviceWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ void LedDeviceWrapper::createLedDevice(QJsonObject config, int smoothingInterval
_ledDevice = std::unique_ptr<LedDevice, void(*)(LedDevice*)>(
LedDeviceFactory::construct(config),
[](LedDevice* oldLed) {
oldLed->stop();
hyperhdr::THREAD_REMOVER(QString("LedDevice"), oldLed->thread(), oldLed);
}
);
Expand Down

0 comments on commit fc83579

Please sign in to comment.