mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
various fixes (#129)
* various fixes: - add folder for firmware known as working with hyperion - rs232: add debug message for close and do not repeat "port not found" message more than neccessary - v4l2: fix grabber started on creation when set to disabled - cmake: add new platform x86-dev - this as most code coverage and is usefull for test/development. This is not for release * add hints for effect-args
This commit is contained in:
parent
8f982f3225
commit
b1d9a041d4
@ -23,7 +23,7 @@ if [[ $TRAVIS_OS_NAME == 'linux' ]]
|
||||
then
|
||||
mkdir build || exit 1
|
||||
cd build
|
||||
cmake -DPLATFORM=x86 -DCMAKE_BUILD_TYPE=Release -DENABLE_AMLOGIC=ON -DENABLE_TESTS=ON -DENABLE_SPIDEV=ON -DENABLE_WS281XPWM=ON .. || exit 2
|
||||
cmake -DPLATFORM=x86-dev -DCMAKE_BUILD_TYPE=Release .. || exit 2
|
||||
make -j$(nproc) || exit 3
|
||||
make -j$(nproc) package || exit 4
|
||||
fi
|
||||
|
@ -27,6 +27,7 @@ SET ( DEFAULT_WS2812BPWM OFF )
|
||||
SET ( DEFAULT_WS281XPWM OFF )
|
||||
SET ( DEFAULT_V4L2 ON )
|
||||
SET ( DEFAULT_USE_SHARED_AVAHI_LIBS OFF )
|
||||
SET ( DEFAULT_TESTS OFF )
|
||||
|
||||
if (APPLE)
|
||||
SET ( DEFAULT_OSX ON )
|
||||
@ -68,6 +69,14 @@ else ()
|
||||
SET ( DEFAULT_X11 ON )
|
||||
SET ( DEFAULT_FB ON )
|
||||
SET ( DEFAULT_USE_SHARED_AVAHI_LIBS ON )
|
||||
elseif ( "${PLATFORM}" STREQUAL "x86-dev" )
|
||||
SET ( DEFAULT_X11 ON )
|
||||
SET ( DEFAULT_FB ON )
|
||||
SET ( DEFAULT_AMLOGIC ON)
|
||||
SET ( DEFAULT_SPIDEV ON )
|
||||
SET ( DEFAULT_WS281XPWM ON )
|
||||
SET ( DEFAULT_USE_SHARED_AVAHI_LIBS ON )
|
||||
SET ( DEFAULT_TESTS ON )
|
||||
elseif ( "${PLATFORM}" STREQUAL "imx6" )
|
||||
SET ( DEFAULT_FB ON )
|
||||
endif()
|
||||
@ -106,7 +115,7 @@ message(STATUS "ENABLE_X11 = " ${ENABLE_X11})
|
||||
|
||||
SET(ENABLE_QT5 ON)
|
||||
|
||||
option(ENABLE_TESTS "Compile additional test applications" OFF)
|
||||
option(ENABLE_TESTS "Compile additional test applications" ${DEFAULT_TESTS})
|
||||
message(STATUS "ENABLE_TESTS = " ${ENABLE_TESTS})
|
||||
|
||||
option(ENABLE_PROFILER "enable profiler capabilities - not for release code" OFF)
|
||||
|
102
assets/firmware/arduino/adalight/adalight.ino
Normal file
102
assets/firmware/arduino/adalight/adalight.ino
Normal file
@ -0,0 +1,102 @@
|
||||
#include "FastLED.h"
|
||||
|
||||
// How many leds in your strip?
|
||||
#define NUM_LEDS 240
|
||||
|
||||
// For led chips like Neopixels, which have a data line, ground, and power, you just
|
||||
// need to define DATA_PIN. For led chipsets that are SPI based (four wires - data, clock,
|
||||
// ground, and power), like the LPD8806 define both DATA_PIN and CLOCK_PIN
|
||||
#define DATA_PIN 6
|
||||
#define CLOCK_PIN 13
|
||||
|
||||
#define COLOR_ORDER RGB
|
||||
|
||||
// Adalight sends a "Magic Word" (defined in /etc/boblight.conf) before sending the pixel data
|
||||
uint8_t prefix[] = {'A', 'd', 'a'}, hi, lo, chk, i;
|
||||
|
||||
// Baudrate, higher rate allows faster refresh rate and more LEDs (defined in /etc/boblight.conf)
|
||||
#define serialRate 460800
|
||||
|
||||
// Define the array of leds
|
||||
CRGB leds[NUM_LEDS];
|
||||
|
||||
void setup() {
|
||||
// Uncomment/edit one of the following lines for your leds arrangement.
|
||||
// FastLED.addLeds<TM1803, DATA_PIN, RGB>(leds, NUM_LEDS);
|
||||
// FastLED.addLeds<TM1804, DATA_PIN, RGB>(leds, NUM_LEDS);
|
||||
// FastLED.addLeds<TM1809, DATA_PIN, RGB>(leds, NUM_LEDS);
|
||||
// FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, NUM_LEDS);
|
||||
// FastLED.addLeds<WS2812, DATA_PIN, RGB>(leds, NUM_LEDS);
|
||||
FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS);
|
||||
// FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
|
||||
// FastLED.addLeds<UCS1903, DATA_PIN, RGB>(leds, NUM_LEDS);
|
||||
// FastLED.addLeds<UCS1903B, DATA_PIN, RGB>(leds, NUM_LEDS);
|
||||
// FastLED.addLeds<GW6205, DATA_PIN, RGB>(leds, NUM_LEDS);
|
||||
// FastLED.addLeds<GW6205_400, DATA_PIN, RGB>(leds, NUM_LEDS);
|
||||
|
||||
// FastLED.addLeds<WS2801, RGB>(leds, NUM_LEDS);
|
||||
// FastLED.addLeds<SM16716, RGB>(leds, NUM_LEDS);
|
||||
// FastLED.addLeds<LPD8806, RGB>(leds, NUM_LEDS);
|
||||
|
||||
// FastLED.addLeds<WS2801, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
|
||||
// FastLED.addLeds<SM16716, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
|
||||
// FastLED.addLeds<LPD8806, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
|
||||
|
||||
// initial RGB flash
|
||||
LEDS.showColor(CRGB(255, 0, 0));
|
||||
delay(500);
|
||||
LEDS.showColor(CRGB(0, 255, 0));
|
||||
delay(500);
|
||||
LEDS.showColor(CRGB(0, 0, 255));
|
||||
delay(500);
|
||||
LEDS.showColor(CRGB(0, 0, 0));
|
||||
|
||||
Serial.begin(serialRate);
|
||||
Serial.print("Ada\n"); // Send "Magic Word" string to host
|
||||
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// wait for first byte of Magic Word
|
||||
for (i = 0; i < sizeof prefix; ++i) {
|
||||
waitLoop: while (!Serial.available()) ;;
|
||||
// Check next byte in Magic Word
|
||||
if (prefix[i] == Serial.read()) continue;
|
||||
// otherwise, start over
|
||||
i = 0;
|
||||
goto waitLoop;
|
||||
}
|
||||
|
||||
// Hi, Lo, Checksum
|
||||
|
||||
while (!Serial.available()) ;;
|
||||
hi = Serial.read();
|
||||
while (!Serial.available()) ;;
|
||||
lo = Serial.read();
|
||||
while (!Serial.available()) ;;
|
||||
chk = Serial.read();
|
||||
|
||||
// if checksum does not match go back to wait
|
||||
if (chk != (hi ^ lo ^ 0x55))
|
||||
{
|
||||
i = 0;
|
||||
goto waitLoop;
|
||||
}
|
||||
|
||||
memset(leds, 0, NUM_LEDS * sizeof(struct CRGB));
|
||||
// read the transmission data and set LED values
|
||||
for (uint8_t i = 0; i < NUM_LEDS; i++) {
|
||||
byte r, g, b;
|
||||
while (!Serial.available());
|
||||
r = Serial.read();
|
||||
while (!Serial.available());
|
||||
g = Serial.read();
|
||||
while (!Serial.available());
|
||||
b = Serial.read();
|
||||
leds[i].r = r;
|
||||
leds[i].g = g;
|
||||
leds[i].b = b;
|
||||
}
|
||||
// shows new values
|
||||
FastLED.show();
|
||||
}
|
@ -245,18 +245,18 @@
|
||||
|
||||
/// Initial Effect sets a "booteffect" or "color" (foreground-effect) and optional set a "effect" or "color" during inactive grabbers and network receivers (background-effect)
|
||||
/// * background-effect : 2 options: set a effect (example: "Rainbow swirl fast") or set a color (RGB) (example: [255,134,0])
|
||||
/// * background-effect-args : Set optional effect arguments (Have a look at the select effect to get the possible values)
|
||||
/// * background-effect-args : Set optional effect arguments (Have a look at the select effect to get the possible values), define it only when needed
|
||||
/// * foreground-effect : 2 options: set a effect (example: "Rainbow swirl fast") or set a color (RGB) (example: [255,134,0])
|
||||
/// * foreground-effect-args : Set optional effect arguments (Have a look at the select effect to get the possible values)
|
||||
/// * foreground-effect-args : Set optional effect arguments (Have a look at the select effect to get the possible values), define it only when needed
|
||||
/// * foreground-duration_ms : The duration of the selected foreground-effect or color (0=endless)
|
||||
/// HINT: "foreground-effect" starts always with priority 0, so it blocks all remotes and grabbers if the loop is endless
|
||||
/// HINT: Set a empty value if you want to disable a component (example: "")
|
||||
"initialEffect" :
|
||||
{
|
||||
"background-effect" : "Full color mood blobs",
|
||||
"background-effect-args" : {},
|
||||
//"background-effect-args" : {},
|
||||
"foreground-effect" : "Rainbow swirl fast",
|
||||
"foreground-effect-args" : {},
|
||||
//"foreground-effect-args" : {},
|
||||
"foreground-duration_ms" : 3000
|
||||
},
|
||||
|
||||
|
@ -77,22 +77,27 @@ void V4L2Grabber::uninit()
|
||||
|
||||
bool V4L2Grabber::init()
|
||||
{
|
||||
if ( _deviceName == "auto" )
|
||||
{
|
||||
for (auto& dev: _v4lDevices)
|
||||
{
|
||||
Debug(_log, "check v4l2 device: %s (%s)",dev.first.c_str(), dev.second.c_str());
|
||||
_deviceName = dev.first;
|
||||
if ( init() )
|
||||
{
|
||||
Info(_log, "found usable v4l2 device: %s (%s)",dev.first.c_str(), dev.second.c_str());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! _initialized)
|
||||
{
|
||||
getV4Ldevices();
|
||||
if ( _deviceName == "auto" )
|
||||
{
|
||||
for (auto& dev: _v4lDevices)
|
||||
{
|
||||
Debug(_log, "check v4l2 device: %s (%s)",dev.first.c_str(), dev.second.c_str());
|
||||
_deviceName = dev.first;
|
||||
if ( init() )
|
||||
{
|
||||
Info(_log, "found usable v4l2 device: %s (%s)",dev.first.c_str(), dev.second.c_str());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Info(_log, "configured v4l device: %s", _deviceName.c_str());
|
||||
}
|
||||
|
||||
bool opened = false;
|
||||
try
|
||||
{
|
||||
|
@ -57,7 +57,6 @@ V4L2Wrapper::V4L2Wrapper(const std::string &device,
|
||||
_timer.setInterval(500);
|
||||
_timer.setSingleShot(false);
|
||||
QObject::connect(&_timer, SIGNAL(timeout()), this, SLOT(checkSources()));
|
||||
_timer.start();
|
||||
}
|
||||
|
||||
V4L2Wrapper::~V4L2Wrapper()
|
||||
@ -67,6 +66,7 @@ V4L2Wrapper::~V4L2Wrapper()
|
||||
|
||||
bool V4L2Wrapper::start()
|
||||
{
|
||||
_timer.start();
|
||||
bool grabber_started = _grabber.start();
|
||||
if ( ! grabber_started )
|
||||
{
|
||||
|
@ -9,19 +9,23 @@
|
||||
// Local Hyperion includes
|
||||
#include "LedRs232Device.h"
|
||||
|
||||
LedRs232Device::LedRs232Device(const std::string& outputDevice, const unsigned baudrate, int delayAfterConnect_ms) :
|
||||
_deviceName(outputDevice),
|
||||
_baudRate_Hz(baudrate),
|
||||
_delayAfterConnect_ms(delayAfterConnect_ms),
|
||||
_rs232Port(this),
|
||||
_blockedForDelay(false)
|
||||
LedRs232Device::LedRs232Device(const std::string& outputDevice, const unsigned baudrate, int delayAfterConnect_ms)
|
||||
: _deviceName(outputDevice)
|
||||
, _baudRate_Hz(baudrate)
|
||||
, _delayAfterConnect_ms(delayAfterConnect_ms)
|
||||
, _rs232Port(this)
|
||||
, _blockedForDelay(false)
|
||||
, _stateChanged(true)
|
||||
{
|
||||
}
|
||||
|
||||
LedRs232Device::~LedRs232Device()
|
||||
{
|
||||
if (_rs232Port.isOpen())
|
||||
{
|
||||
_rs232Port.close();
|
||||
Debug(_log,"Close UART: %s", _deviceName.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -40,12 +44,17 @@ bool LedRs232Device::tryOpen()
|
||||
{
|
||||
if ( ! _rs232Port.open(QIODevice::WriteOnly) )
|
||||
{
|
||||
Error(_log, "Unable to open RS232 device (%s)", _deviceName.c_str());
|
||||
if ( _stateChanged )
|
||||
{
|
||||
Error(_log, "Unable to open RS232 device (%s)", _deviceName.c_str());
|
||||
_stateChanged = false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
_rs232Port.setBaudRate(_baudRate_Hz);
|
||||
_stateChanged = true;
|
||||
}
|
||||
|
||||
|
||||
if (_delayAfterConnect_ms > 0)
|
||||
{
|
||||
_blockedForDelay = true;
|
||||
|
@ -66,4 +66,6 @@ private:
|
||||
QSerialPort _rs232Port;
|
||||
|
||||
bool _blockedForDelay;
|
||||
|
||||
bool _stateChanged;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user