2013-09-09 17:24:36 +02:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
// Bootsequence includes
|
|
|
|
#include "AbstractBootSequence.h"
|
|
|
|
|
|
|
|
// Hyperion includes
|
|
|
|
#include <hyperion/Hyperion.h>
|
|
|
|
#include <hyperion/ImageProcessor.h>
|
|
|
|
|
2013-09-09 19:14:49 +02:00
|
|
|
///
|
|
|
|
/// The KITT BootSequence is a boot sequence inspired by the Knight Rider car: Knight Industries Two
|
|
|
|
/// Thousand (aka KITT)
|
|
|
|
///
|
2013-09-09 17:24:36 +02:00
|
|
|
class KittBootSequence : public AbstractBootSequence
|
|
|
|
{
|
|
|
|
public:
|
2013-09-09 19:14:49 +02:00
|
|
|
///
|
|
|
|
/// Constructs the KITT BootSequence
|
|
|
|
///
|
|
|
|
/// @param[in] hyperion The Hyperion instance
|
|
|
|
/// @param[in] duration_ms The length of the sequence [ms]
|
|
|
|
///
|
2013-09-09 17:24:36 +02:00
|
|
|
KittBootSequence(Hyperion * hyperion, const unsigned duration_ms);
|
|
|
|
|
2013-09-09 19:14:49 +02:00
|
|
|
///
|
|
|
|
/// Destructor, deletes the processor
|
|
|
|
///
|
2013-09-09 17:24:36 +02:00
|
|
|
virtual ~KittBootSequence();
|
|
|
|
|
2013-09-09 19:14:49 +02:00
|
|
|
///
|
|
|
|
/// Returns the next led color sequence
|
|
|
|
///
|
|
|
|
/// @return The next colors for the leds
|
|
|
|
///
|
2013-11-11 10:00:37 +01:00
|
|
|
virtual const std::vector<ColorRgb>& nextColors();
|
2013-09-09 17:24:36 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
/// Image processor to compute led-colors from the image
|
|
|
|
ImageProcessor * _processor;
|
|
|
|
|
|
|
|
/// 1D-Image of the KITT-grill contains a single red pixel and the rest black
|
2013-11-11 10:00:37 +01:00
|
|
|
Image<ColorRgb> _image;
|
2013-09-09 17:24:36 +02:00
|
|
|
|
|
|
|
/// The vector with led-colors
|
2013-11-11 10:00:37 +01:00
|
|
|
std::vector<ColorRgb> _ledColors;
|
2013-09-09 17:24:36 +02:00
|
|
|
|
2013-09-09 19:14:49 +02:00
|
|
|
/// Direction the red-light is currently moving
|
2013-09-09 17:24:36 +02:00
|
|
|
bool _forwardMove = true;
|
2013-09-09 19:14:49 +02:00
|
|
|
/// The location of the current red-light
|
2013-09-09 17:24:36 +02:00
|
|
|
unsigned _currentLight = 0;
|
|
|
|
|
2013-09-09 19:14:49 +02:00
|
|
|
/// Moves the current light to the next (increase or decrease depending on direction)
|
2013-09-09 17:24:36 +02:00
|
|
|
void moveNextLight();
|
|
|
|
};
|
|
|
|
|