I have been trying to setup hyperion for a while but i cant seem to get it right.
I have a arduino connected to the leds and the slots im using on the arduino is GND and data pin 3
My script for ardiouno
C
//Original code: https://pastebin.com/V3YcmF7f&usg=ALkJrhhh61WVBqYTZmJ8CowiVl2-3Bq9BA
//Serial buffer mod: A really nice guy on youtube, can't find who it was though. Thanks man. (the mod ensure that the serial buffer on the arduino doesn't overflow thus stalling the board.
// Slightly modified Adalight protocol implementation that uses FastLED
// library (http://fastled.io) for driving WS2811/WS2812 led stripe
// Was tested only with Prismatik software from Lightpack project
#include "FastLED.h"
#define NUM_LEDS 134 // Max LED count
#define LED_PIN 3 // arduino output pin
#define GROUND_PIN 10
#define BRIGHTNESS 254 // maximum brightness
#define SPEED 115200 // virtual serial port speed, must be the same in boblight_config
CRGB leds[NUM_LEDS];
uint8_t * ledsRaw = (uint8_t *)leds;
// A 'magic word' (along with LED count & checksum) precedes each block
// of LED data; this assists the microcontroller in syncing up with the
// host-side software and properly issuing the latch (host I/O is
// likely buffered, making usleep() unreliable for latch). You may see
// an initial glitchy frame or two until the two come into alignment.
// The magic word can be whatever sequence you like, but each character
// should be unique, and frequent pixel values like 0 and 255 are
// avoided -- fewer false positives. The host software will need to
// generate a compatible header: immediately following the magic word
// are three bytes: a 16-bit count of the number of LEDs (high byte
// first) followed by a simple checksum value (high byte XOR low byte
// XOR 0x55). LED data follows, 3 bytes per LED, in order R, G, B,
// where 0 = off and 255 = max brightness.
static const uint8_t magic[] = {
'A','d','a'};
#define MAGICSIZE sizeof(magic)
#define HEADERSIZE (MAGICSIZE + 3)
#define MODE_HEADER 0
#define MODE_DATA 2
// If no serial data is received for a while, the LEDs are shut off
// automatically. This avoids the annoying "stuck pixel" look when
// quitting LED display programs on the host computer.
static const unsigned long serialTimeout = 150000; // 150 seconds
void setup()
{
pinMode(GROUND_PIN, OUTPUT);
digitalWrite(GROUND_PIN, LOW);
FastLED.addLeds<WS2812B, LED_PIN, GRB>(leds, NUM_LEDS);
// Dirty trick: the circular buffer for serial data is 256 bytes,
// and the "in" and "out" indices are unsigned 8-bit types -- this
// much simplifies the cases where in/out need to "wrap around" the
// beginning/end of the buffer. Otherwise there'd be a ton of bit-
// masking and/or conditional code every time one of these indices
// needs to change, slowing things down tremendously.
uint8_t
buffer[256],
indexIn = 0,
indexOut = 0,
mode = MODE_HEADER,
hi, lo, chk, i, spiFlag;
int16_t
bytesBuffered = 0,
hold = 0,
c;
int32_t
bytesRemaining;
unsigned long
startTime,
lastByteTime,
lastAckTime,
t;
int32_t outPos = 0;
Serial.begin(SPEED); // Teensy/32u4 disregards baud rate; is OK!
Serial.print("Ada\n"); // Send ACK string to host
startTime = micros();
lastByteTime = lastAckTime = millis();
// loop() is avoided as even that small bit of function overhead
// has a measurable impact on this code's overall throughput.
for(;;) {
// Implementation is a simple finite-state machine.
// Regardless of mode, check for serial input each time:
t = millis();
if((bytesBuffered < 256) && ((c = Serial.read()) >= 0)) {
buffer[indexIn++] = c;
bytesBuffered++;
lastByteTime = lastAckTime = t; // Reset timeout counters
}
else {
// No data received. If this persists, send an ACK packet
// to host once every second to alert it to our presence.
if((t - lastAckTime) > 1000) {
Serial.print("Ada\n"); // Send ACK string to host
lastAckTime = t; // Reset counter
}
// If no data received for an extended time, turn off all LEDs.
if((t - lastByteTime) > serialTimeout) {
memset(leds, 0, NUM_LEDS * sizeof(struct CRGB)); //filling Led array by zeroes
FastLED.show();
lastByteTime = t; // Reset counter
}
}
switch(mode) {
case MODE_HEADER:
// In header-seeking mode. Is there enough data to check?
if(bytesBuffered >= HEADERSIZE) {
// Indeed. Check for a 'magic word' match.
for(i=0; (i<MAGICSIZE) && (buffer[indexOut++] == magic[i++]););
if(i == MAGICSIZE) {
// Magic word matches. Now how about the checksum?
hi = buffer[indexOut++];
lo = buffer[indexOut++];
chk = buffer[indexOut++];
if(chk == (hi ^ lo ^ 0x55)) {
// Checksum looks valid. Get 16-bit LED count, add 1
// (# LEDs is always > 0) and multiply by 3 for R,G,B.
bytesRemaining = 3L * (256L * (long)hi + (long)lo + 1L);
bytesBuffered -= 3;
outPos = 0;
memset(leds, 0, NUM_LEDS * sizeof(struct CRGB));
mode = MODE_DATA; // Proceed to latch wait mode
}
else {
// Checksum didn't match; search resumes after magic word.
indexOut -= 3; // Rewind
}
} // else no header match. Resume at first mismatched byte.
bytesBuffered -= i;
}
break;
case MODE_DATA:
if(bytesRemaining > 0) {
if(bytesBuffered > 0) {
if (outPos < sizeof(leds))
ledsRaw[outPos++] = buffer[indexOut++]; // Issue next byte
bytesBuffered--;
bytesRemaining--;
}
// If serial buffer is threatening to underrun, start
// introducing progressively longer pauses to allow more
// data to arrive (up to a point).
}
else {
// End of data -- issue latch:
startTime = micros();
mode = MODE_HEADER; // Begin next header search
FastLED.show();
//flush serial buffer - important to avoid the arduino becoming unresponsive
while(Serial.available()) { Serial.read(); }
}
} // end switch
} // end for(;;)
}
void loop()
{
// Not used. See note in setup() function.
}
Alles anzeigen
I then struggled with hypercon but came to a thread where i got hypercon that works specifically with libreelec so i installed it
But im still missing something
There is however happening something when i start up Kodi i get fancy light flashing that looks like a xmas tree around the tv or when im in kodi in has ambient lights at the back but if u play a movie nothing happens.
I have added the hypercon json config in both config paths addon and userdata
Hypercon logs
Code
SSH Traffic:
ssh connected
ssh out: systemctl start service.hyperion.service 2>/dev/null
ssh out: journalctl -u service.hyperion.service 2>/dev/null
ssh in: -- Logs begin at Sun 2019-03-17 08:57:23 SAST, end at Sun 2019-03-17 09:04:15 SAST. --
ssh in: Mar 17 08:57:28 LibreELEC systemd[1]: Starting Hyperion service...
ssh in: Mar 17 08:57:28 LibreELEC systemd[1]: Started Hyperion service.
ssh in: Mar 17 08:57:28 LibreELEC sh[745]: hyperion-x11:
ssh in: Mar 17 08:57:28 LibreELEC sh[745]: version : 1c21232
ssh in: Mar 17 08:57:28 LibreELEC sh[745]: build time: Oct 12 2017 09:48:43
ssh in: Mar 17 08:57:28 LibreELEC sh[745]: Hyperion Ambilight Deamon (763)
ssh in: Mar 17 08:57:28 LibreELEC sh[745]: Version : 1c21232
ssh in: Mar 17 08:57:28 LibreELEC sh[745]: Build Time: Oct 12 2017 09:48:43
ssh in: Mar 17 08:57:28 LibreELEC sh[745]: PROTOCONNECTION INFO: Connecting to Hyperion: 127.0.0.1:19445
ssh in: Mar 17 08:57:28 LibreELEC sh[745]: INFO: Selected configuration file: /storage/.kodi/userdata/addon_data/service.hyperion/hyperion.config.json
ssh in: Mar 17 08:57:29 LibreELEC sh[745]: X11GRABBER INFO: Update of screen resolution: [0x0] => [1920x1080]
ssh in: Mar 17 08:57:29 LibreELEC sh[745]: X11GRABBER INFO: Using XRender for grabbing
ssh in: Mar 17 08:57:29 LibreELEC sh[745]: HYPERION INFO: ColorTransform 'default' => [0; 211]
ssh in: Mar 17 08:57:29 LibreELEC sh[745]: HYPERION INFO: ColorCorrection 'default' => [0; 211]
ssh in: Mar 17 08:57:29 LibreELEC sh[745]: HYPERION INFO: ColorAdjustment 'default' => [0; 211]
ssh in: Mar 17 08:57:29 LibreELEC sh[745]: LEDDEVICE INFO: configuration:
ssh in: Mar 17 08:57:29 LibreELEC sh[745]: {
ssh in: Mar 17 08:57:29 LibreELEC sh[745]: "colorOrder" : "rgb",
ssh in: Mar 17 08:57:29 LibreELEC sh[745]: "delayAfterConnect" : 0,
ssh in: Mar 17 08:57:29 LibreELEC sh[745]: "name" : "MyHyperionConfig",
ssh in: Mar 17 08:57:29 LibreELEC sh[745]: "output" : "/dev/ttyACM0",
ssh in: Mar 17 08:57:29 LibreELEC sh[745]: "rate" : 115200,
ssh in: Mar 17 08:57:29 LibreELEC sh[745]: "type" : "adalight"
ssh in: Mar 17 08:57:29 LibreELEC sh[745]: }
ssh in: Mar 17 08:57:29 LibreELEC sh[745]: Opening UART: /dev/ttyACM0
ssh in: Mar 17 08:57:29 LibreELEC sh[745]: INFO: Creating linear smoothing
ssh in: Mar 17 08:57:29 LibreELEC sh[745]: HYPERION (CS) INFO: Created linear-smoothing(interval_ms=50;settlingTime_ms=200;updateDelay=0
ssh in: Mar 17 08:57:29 LibreELEC sh[745]: EFFECTENGINE INFO: 27 effects loaded from directory /storage/.kodi/addons/service.hyperion/effects
ssh in: Mar 17 08:57:29 LibreELEC sh[745]: EFFECTENGINE INFO: Initializing Python interpreter
ssh in: Mar 17 08:57:29 LibreELEC sh[745]: INFO: Hyperion started and initialised
ssh in: Mar 17 08:57:29 LibreELEC sh[745]: INFO: Boot sequence 'Rainbow swirl fast' EFFECTENGINE INFO: run effect Rainbow swirl fast on channel 0
ssh in: Mar 17 08:57:29 LibreELEC sh[745]: BLACKBORDER INFO: threshold set to 0 (0)
ssh in: Mar 17 08:57:29 LibreELEC sh[745]: BLACKBORDER INFO: mode:default
ssh in: Mar 17 08:57:29 LibreELEC sh[745]: started
ssh in: Mar 17 08:57:29 LibreELEC sh[745]: INFO: Kodi checker created and started
ssh in: Mar 17 08:57:29 LibreELEC sh[745]: INFO: Json server created and started on port 19444
ssh in: Mar 17 08:57:29 LibreELEC sh[745]: INFO: Proto server created and started on port 19445
ssh in: Mar 17 08:57:29 LibreELEC sh[745]: QtHttpServer started on port 8099 "Qt Static HTTP File Server"
ssh in: Mar 17 08:57:29 LibreELEC sh[745]: FRAMEBUFFERGRABBER INFO: opened with resolution: 1920x1080@32bit
ssh in: Mar 17 08:57:29 LibreELEC sh[745]: BLACKBORDER INFO: threshold set to 0 (0)
ssh in: Mar 17 08:57:29 LibreELEC sh[745]: BLACKBORDER INFO: mode:default
ssh in: Mar 17 08:57:29 LibreELEC sh[745]: INFO: Framebuffer grabber created and started
ssh in: Mar 17 08:57:29 LibreELEC sh[745]: KODICHECK ERROR: Kodi Connection error (0)
ssh in: Mar 17 08:57:29 LibreELEC sh[745]: BORDER SWITCH REQUIRED!!
ssh in: Mar 17 08:57:29 LibreELEC sh[745]: CURRENT BORDER TYPE: unknown=0 hor.size=0 vert.size=0
ssh in: Mar 17 08:57:32 LibreELEC sh[745]: EFFECTENGINE INFO: effect finished
ssh in: Mar 17 08:57:33 LibreELEC sh[745]: PROTOSERVER INFO: New connection
ssh in: Mar 17 08:57:33 LibreELEC sh[745]: BLACKBORDER INFO: threshold set to 0 (0)
ssh in: Mar 17 08:57:33 LibreELEC sh[745]: BLACKBORDER INFO: mode:default
ssh in: Mar 17 08:57:33 LibreELEC sh[745]: PROTOCONNECTION INFO: Connected to Hyperion: 127.0.0.1:19445
ssh in: Mar 17 08:57:33 LibreELEC sh[745]: BORDER SWITCH REQUIRED!!
ssh in: Mar 17 08:57:33 LibreELEC sh[745]: CURRENT BORDER TYPE: unknown=0 hor.size=0 vert.size=0
ssh in: Mar 17 08:57:39 LibreELEC sh[745]: KODICHECK INFO: Kodi Connected
ssh in: Mar 17 08:57:39 LibreELEC sh[745]: KODICHECK INFO: switching to MENU mode
ssh in: Mar 17 08:59:28 LibreELEC sh[745]: KODICHECK INFO: switching to VIDEO mode
ssh in: Mar 17 08:59:32 LibreELEC sh[745]: KODICHECK INFO: switching to MENU mode
Alles anzeigen