mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
dd16af0df5
Former-commit-id: ef02f164eaf3c2f9dd552c1c17b525cf6eed499c
36 lines
796 B
C++
36 lines
796 B
C++
#include "AbstractBootSequence.h"
|
|
|
|
AbstractBootSequence::AbstractBootSequence(Hyperion * hyperion, const int64_t interval, const unsigned iterationCnt) :
|
|
_timer(),
|
|
_hyperion(hyperion),
|
|
_priority(0),
|
|
_iterationCounter(iterationCnt)
|
|
{
|
|
_timer.setInterval(interval);
|
|
_timer.setSingleShot(false);
|
|
QObject::connect(&_timer, SIGNAL(timeout()), this, SLOT(update()));
|
|
}
|
|
|
|
void AbstractBootSequence::start()
|
|
{
|
|
_timer.start();
|
|
}
|
|
|
|
void AbstractBootSequence::update()
|
|
{
|
|
if (_iterationCounter == 0)
|
|
{
|
|
_timer.stop();
|
|
_hyperion->clear(_priority);
|
|
return;
|
|
}
|
|
|
|
// Obtain the next led-colors from the child-class
|
|
const std::vector<ColorRgb>& colors = nextColors();
|
|
// Write the colors to hyperion
|
|
_hyperion->setColors(_priority, colors, -1);
|
|
|
|
// Decrease the loop count
|
|
--_iterationCounter;
|
|
}
|