Skip to content

Commit

Permalink
Merge branch 'master' into v20rc1
Browse files Browse the repository at this point in the history
  • Loading branch information
awawa-dev committed Jan 19, 2024
2 parents cd082dd + fd90a20 commit 2046fa4
Show file tree
Hide file tree
Showing 26 changed files with 255 additions and 60 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/image-builder-from-repo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ jobs:
run: |
mkdir -p CustomPiOS/HyperHDR/src/image
cd CustomPiOS/HyperHDR/src/image
wget -c --trust-server-names 'https://downloads.raspberrypi.org/raspios_lite_armhf_latest'
wget -c --trust-server-names 'https://downloads.raspberrypi.org/raspios_lite_armhf/images/raspios_lite_armhf-2023-05-03/2023-05-03-raspios-bullseye-armhf-lite.img.xz'
echo "workspace_dir=CustomPiOS/HyperHDR/src/workspace" >> $GITHUB_ENV
- name: Download Raspbian Image (64-bits)
if: github.event.inputs.architecture == 'aarch64'
run: |
mkdir -p CustomPiOS/HyperHDR/src/image-raspios_lite_arm64
cd CustomPiOS/HyperHDR/src/image-raspios_lite_arm64
wget -c --trust-server-names 'https://downloads.raspberrypi.org/raspios_lite_arm64_latest'
wget -c --trust-server-names 'https://downloads.raspberrypi.org/raspios_lite_arm64/images/raspios_lite_arm64-2023-05-03/2023-05-03-raspios-bullseye-arm64-lite.img.xz'
echo "workspace_dir=CustomPiOS/HyperHDR/src/workspace-raspios_lite_arm64" >> $GITHUB_ENV
echo "workspace_variant=raspios_lite_arm64" >> $GITHUB_ENV
Expand All @@ -77,6 +77,7 @@ jobs:
echo '&& chmod go+r /usr/share/keyrings/hyperhdr.public.apt.gpg.key \' >> start_chroot_script
echo '&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/hyperhdr.public.apt.gpg.key] https://awawa-dev.github.io $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/hyperhdr.list > /dev/null \' >> start_chroot_script
echo '&& apt update \' >> start_chroot_script
echo '&& apt install --only-upgrade udev -y \' >> start_chroot_script
echo '&& apt install hyperhdr -y' >> start_chroot_script
echo 'touch /boot/ssh' >> start_chroot_script
echo "echo -n 'pi:' > /boot/userconf" >> start_chroot_script
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/push-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: HyperHDR CI Build

on:
push:
pull_request:

env:
USE_CACHE: "0"
Expand Down Expand Up @@ -40,6 +41,10 @@ jobs:
linuxVersion: mantic
dockerName: Ubuntu 23.10 (x86_64)
platform: linux
- dockerImage: x86_64
linuxVersion: noble
dockerName: Ubuntu 24.04 LTS (x86_64)
platform: linux
- dockerImage: arm-32bit-armv6l
linuxVersion: bullseye
dockerName: Debian Bullseye (ARM 32-bit Raspberry Pi OS)
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/upload-to-github-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ jobs:
arch: amd64
platform: linux
niceName: Ubuntu 23.10
- dockerImage: x86_64
linuxVersion: noble
dockerName: Ubuntu 24.04 LTS (x86_64)
arch: amd64
platform: linux
niceName: Ubuntu 24.04 LTS
- dockerImage: x86_64
linuxVersion: Fedora_39
dockerName: Fedora 39 (x86_64)
Expand Down
3 changes: 2 additions & 1 deletion include/base/ComponentController.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ComponentController : public QObject
Q_OBJECT

public:
ComponentController(HyperHdrInstance* hyperhdr);
ComponentController(HyperHdrInstance* hyperhdr, bool disableOnStartup);
virtual ~ComponentController();

int isComponentEnabled(hyperhdr::Components comp) const;
Expand All @@ -35,4 +35,5 @@ private slots:
Logger* _log;
std::map<hyperhdr::Components, bool> _componentStates;
std::map<hyperhdr::Components, bool> _prevComponentStates;
bool _disableOnStartup;
};
3 changes: 2 additions & 1 deletion include/base/HyperHdrInstance.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class HyperHdrInstance : public QObject
Q_OBJECT

public:
HyperHdrInstance(quint8 instance, bool readonlyMode, QString name);
HyperHdrInstance(quint8 instance, bool readonlyMode, bool disableOnstartup, QString name);
~HyperHdrInstance();

quint8 getInstanceIndex() const { return _instIndex; }
Expand Down Expand Up @@ -158,6 +158,7 @@ private slots:
QString _name;

bool _readOnlyMode;
bool _disableOnStartup;

static std::atomic<bool> _signalTerminate;
static std::atomic<int> _totalRunningCount;
Expand Down
4 changes: 2 additions & 2 deletions include/base/HyperHdrManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public slots:

QVector<QVariantMap> getInstanceData() const;

bool startInstance(quint8 inst, QObject* caller = nullptr, int tan = 0);
bool startInstance(quint8 inst, QObject* caller = nullptr, int tan = 0, bool disableOnStartup = false);

bool stopInstance(quint8 inst);

Expand Down Expand Up @@ -97,7 +97,7 @@ private slots:

HyperHdrManager(const QString& rootPath, bool readonlyMode);

void startAll();
void startAll(bool disableOnStartup);

void stopAllonExit();

Expand Down
2 changes: 2 additions & 0 deletions include/leddevice/LedDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public slots:
void blinking(QJsonObject params);
void smoothingRestarted(int newSmoothingInterval);
int hasLedClock();
void pauseRetryTimer(bool mode);

signals:
void SignalEnableStateChanged(bool newState);
Expand Down Expand Up @@ -155,4 +156,5 @@ protected slots:
int _blinkIndex;
qint64 _blinkTime;
int _instanceIndex;
int _pauseRetryTimer;
};
2 changes: 1 addition & 1 deletion include/leddevice/LedDeviceWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class LedDeviceWrapper : public QObject
explicit LedDeviceWrapper(HyperHdrInstance* ownerInstance);
virtual ~LedDeviceWrapper();

void createLedDevice(QJsonObject config, int smoothingInterval);
void createLedDevice(QJsonObject config, int smoothingInterval, bool disableOnStartup);
static QJsonObject getLedDeviceSchemas();
static int addToDeviceMap(QString name, LedDeviceCreateFuncType funcPtr);
static const LedDeviceRegistry& getDeviceMap();
Expand Down
15 changes: 11 additions & 4 deletions sources/base/ComponentController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@

using namespace hyperhdr;

ComponentController::ComponentController(HyperHdrInstance* hyperhdr)
: _log(Logger::getInstance(QString("COMPONENTCTRL%1").arg(hyperhdr->getInstanceIndex())))
ComponentController::ComponentController(HyperHdrInstance* hyperhdr, bool disableOnStartup):
_log(Logger::getInstance(QString("COMPONENTCTRL%1").arg(hyperhdr->getInstanceIndex()))),
_disableOnStartup(disableOnStartup)
{
// init all comps to false
QVector<hyperhdr::Components> vect;
Expand All @@ -27,7 +28,7 @@ ComponentController::ComponentController(HyperHdrInstance* hyperhdr)

connect(this, &ComponentController::SignalRequestComponent, hyperhdr, &HyperHdrInstance::SignalRequestComponent);
connect(hyperhdr, &HyperHdrInstance::SignalRequestComponent, this, &ComponentController::handleCompStateChangeRequest);
Debug(_log, "ComponentController is initialized");
Debug(_log, "ComponentController is initialized. Components are %s", (_disableOnStartup) ? "DISABLED" : "ENABLED");
}

ComponentController::~ComponentController()
Expand All @@ -41,11 +42,17 @@ void ComponentController::handleCompStateChangeRequest(hyperhdr::Components comp
{
if (!activated && _prevComponentStates.empty())
{
bool disableLeds = _disableOnStartup && !isComponentEnabled(COMP_ALL) && _prevComponentStates.empty();

Debug(_log, "Disabling HyperHDR instance: saving current component states first");
for (const auto& comp : _componentStates)
if (comp.first != COMP_ALL)
{
_prevComponentStates.emplace(comp.first, comp.second);
if (disableLeds && comp.first == COMP_LEDDEVICE)
_prevComponentStates.emplace(comp.first, true);
else
_prevComponentStates.emplace(comp.first, comp.second);

if (comp.second)
{
emit SignalRequestComponent(comp.first, false);
Expand Down
29 changes: 20 additions & 9 deletions sources/base/HyperHdrInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
std::atomic<bool> HyperHdrInstance::_signalTerminate(false);
std::atomic<int> HyperHdrInstance::_totalRunningCount(0);

HyperHdrInstance::HyperHdrInstance(quint8 instance, bool readonlyMode, QString name)
HyperHdrInstance::HyperHdrInstance(quint8 instance, bool readonlyMode, bool disableOnStartup, QString name)
: QObject()
, _instIndex(instance)
, _bootEffect(QTime::currentTime().addSecs(5))
Expand All @@ -90,6 +90,7 @@ HyperHdrInstance::HyperHdrInstance(quint8 instance, bool readonlyMode, QString n
, _currentLedColors()
, _name((name.isEmpty()) ? QString("INSTANCE%1").arg(instance) : name)
, _readOnlyMode(readonlyMode)
, _disableOnStartup(disableOnStartup)
{
_totalRunningCount++;
}
Expand Down Expand Up @@ -142,7 +143,7 @@ void HyperHdrInstance::start()
Info(_log, "Starting the instance");

_instanceConfig = std::unique_ptr<InstanceConfig>(new InstanceConfig(false, _instIndex, this, _readOnlyMode));
_componentController = std::unique_ptr<ComponentController>(new ComponentController(this));
_componentController = std::unique_ptr<ComponentController>(new ComponentController(this, _disableOnStartup));
connect(_componentController.get(), &ComponentController::SignalComponentStateChanged, this, &HyperHdrInstance::SignalComponentStateChanged);
_ledString = LedString::createLedString(getSetting(settings::type::LEDS).array(), LedString::createColorOrder(getSetting(settings::type::DEVICE).object()));
_muxer = std::unique_ptr<Muxer>(new Muxer(_instIndex, static_cast<int>(_ledString.leds().size()), this));
Expand Down Expand Up @@ -184,7 +185,7 @@ void HyperHdrInstance::start()

_ledDeviceWrapper = std::unique_ptr<LedDeviceWrapper>(new LedDeviceWrapper(this));
connect(this, &HyperHdrInstance::SignalRequestComponent, _ledDeviceWrapper.get(), &LedDeviceWrapper::handleComponentState);
_ledDeviceWrapper->createLedDevice(ledDevice, _smoothing->GetSuggestedInterval());
_ledDeviceWrapper->createLedDevice(ledDevice, _smoothing->GetSuggestedInterval(), _disableOnStartup);

// create the effect engine; needs to be initialized after smoothing!
_effectEngine = std::unique_ptr<EffectEngine>(new EffectEngine(this));
Expand Down Expand Up @@ -222,6 +223,12 @@ void HyperHdrInstance::start()
// instance initiated, enter thread event loop
emit SignalInstanceJustStarted();

if (_disableOnStartup)
{
_componentController->setNewComponentState(hyperhdr::COMP_ALL, false);
Warning(_log, "The user has disabled LEDs auto-start in the configuration (interface: 'General' tab)");
}

// exit
Info(_log, "The instance is running");
}
Expand Down Expand Up @@ -295,9 +302,7 @@ void HyperHdrInstance::handleSettingsUpdate(settings::type type, const QJsonDocu

// do always reinit until the led devices can handle dynamic changes
dev["currentLedCount"] = _hwLedCount; // Inject led count info
_ledDeviceWrapper->createLedDevice(dev, _smoothing->GetSuggestedInterval());

// TODO: Check, if framegrabber frequency is lower than latchtime..., if yes, stop
_ledDeviceWrapper->createLedDevice(dev, _smoothing->GetSuggestedInterval(), false);
}
else if (type == settings::type::BGEFFECT || type == settings::type::FGEFFECT)
{
Expand Down Expand Up @@ -684,9 +689,15 @@ void HyperHdrInstance::handlePriorityChangedLedDevice(const quint8& priority)
if (previousPriority == Muxer::LOWEST_PRIORITY)
{
Info(_log, "New source available -> switch LED-Device on");

emit SignalRequestComponent(hyperhdr::COMP_LEDDEVICE, true);
emit GlobalSignals::getInstance()->SignalPerformanceStateChanged(true, hyperhdr::PerformanceReportType::INSTANCE, getInstanceIndex(), _name);
if (!isComponentEnabled(hyperhdr::Components::COMP_ALL))
{
Warning(_log, "Components are disabled: ignoring switching LED-Device on");
}
else
{
emit SignalRequestComponent(hyperhdr::COMP_LEDDEVICE, true);
emit GlobalSignals::getInstance()->SignalPerformanceStateChanged(true, hyperhdr::PerformanceReportType::INSTANCE, getInstanceIndex(), _name);
}
}
}
}
Expand Down
7 changes: 4 additions & 3 deletions sources/base/HyperHdrManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,15 @@ bool HyperHdrManager::areInstancesReady()
return (--_fireStarter == 0);
}

void HyperHdrManager::startAll()
void HyperHdrManager::startAll(bool disableOnStartup)
{
auto instanceList = _instanceTable->getAllInstances(true);

_fireStarter = instanceList.count();

for (const auto& entry : instanceList)
{
startInstance(entry["instance"].toInt());
startInstance(entry["instance"].toInt(), nullptr, 0, disableOnStartup);
}
}

Expand Down Expand Up @@ -179,7 +179,7 @@ void HyperHdrManager::hibernate(bool wakeUp)
}
}

bool HyperHdrManager::startInstance(quint8 inst, QObject* caller, int tan)
bool HyperHdrManager::startInstance(quint8 inst, QObject* caller, int tan, bool disableOnStartup)
{
if (_instanceTable->instanceExist(inst))
{
Expand All @@ -191,6 +191,7 @@ bool HyperHdrManager::startInstance(quint8 inst, QObject* caller, int tan)
auto hyperhdr = std::shared_ptr<HyperHdrInstance>(
new HyperHdrInstance(inst,
_readonlyMode,
disableOnStartup,
_instanceTable->getNamebyIndex(inst)),
[](HyperHdrInstance* oldInstance) {
THREAD_REMOVER(QString("HyperHDR instance at index = %1").arg(oldInstance->getInstanceIndex()),
Expand Down
18 changes: 18 additions & 0 deletions sources/base/schema/schema-general.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,24 @@
"hidden":true
},
"propertyOrder" : 4
},
"disableOnLocked" :
{
"type" : "boolean",
"format": "checkbox",
"title" : "edt_conf_gen_disableOnLocked_title",
"default" : false,
"required" : true,
"propertyOrder" : 5
},
"disableLedsStartup" :
{
"type" : "boolean",
"format": "checkbox",
"title" : "edt_conf_gen_disableLedsStartup_title",
"default" : false,
"required" : true,
"propertyOrder" : 6
}

},
Expand Down
2 changes: 2 additions & 0 deletions sources/grabber/DX/DxGrabber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,8 @@ void DxGrabber::stop()
_timer->stop();
Info(_log, "Stopped");
}

_retryTimer->stop();
}

bool DxGrabber::initDirectX(QString selectedDeviceName)
Expand Down
Loading

0 comments on commit 2046fa4

Please sign in to comment.