2013-09-09 17:24:36 +02:00
|
|
|
#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
|
2013-11-11 10:00:37 +01:00
|
|
|
const std::vector<ColorRgb>& colors = nextColors();
|
2013-09-09 17:24:36 +02:00
|
|
|
// Write the colors to hyperion
|
|
|
|
_hyperion->setColors(_priority, colors, -1);
|
|
|
|
|
|
|
|
// Decrease the loop count
|
|
|
|
--_iterationCounter;
|
|
|
|
}
|