mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
logging migration for ws281x and LedUdpDevice (#45)
This commit is contained in:
parent
33ebdcaffc
commit
b6a0b7261d
@ -6,13 +6,13 @@
|
||||
LedDeviceWS281x::LedDeviceWS281x(const int gpio, const int leds, const uint32_t freq, const int dmanum, const int pwmchannel, const int invert, const int rgbw, const std::string& whiteAlgorithm)
|
||||
{
|
||||
_whiteAlgorithm = whiteAlgorithm;
|
||||
std::cout << "whiteAlgorithm :" << whiteAlgorithm << ":\n";
|
||||
Debug( Logger::getInstance("LedDevice"), "whiteAlgorithm : %s", whiteAlgorithm.c_str());
|
||||
|
||||
initialized = false;
|
||||
led_string.freq = freq;
|
||||
led_string.dmanum = dmanum;
|
||||
if (pwmchannel != 0 && pwmchannel != 1) {
|
||||
std::cout << "WS281x: invalid PWM channel; must be 0 or 1." << std::endl;
|
||||
Error( Logger::getInstance("LedDevice"), "WS281x: invalid PWM channel; must be 0 or 1.");
|
||||
throw -1;
|
||||
}
|
||||
chan = pwmchannel;
|
||||
@ -32,7 +32,7 @@ std::cout << "whiteAlgorithm :" << whiteAlgorithm << ":\n";
|
||||
led_string.channel[!chan].brightness = 0;
|
||||
led_string.channel[!chan].strip_type = WS2811_STRIP_RGB;
|
||||
if (ws2811_init(&led_string) < 0) {
|
||||
std::cout << "Unable to initialize ws281x library." << std::endl;
|
||||
Error( Logger::getInstance("LedDevice"), "Unable to initialize ws281x library.");
|
||||
throw -1;
|
||||
}
|
||||
initialized = true;
|
||||
@ -95,7 +95,6 @@ LedDeviceWS281x::~LedDeviceWS281x()
|
||||
{
|
||||
if (initialized)
|
||||
{
|
||||
std::cout << "Shutdown WS281x PWM and DMA channel" << std::endl;
|
||||
ws2811_fini(&led_string);
|
||||
}
|
||||
initialized = false;
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
#include <leddevice/LedDevice.h>
|
||||
#include <ws2811.h>
|
||||
#include <utils/Logger.h>
|
||||
|
||||
class LedDeviceWS281x : public LedDevice
|
||||
{
|
||||
|
@ -15,7 +15,6 @@
|
||||
// Local Hyperion includes
|
||||
#include "LedUdpDevice.h"
|
||||
|
||||
|
||||
LedUdpDevice::LedUdpDevice(const std::string& outputDevice, const unsigned baudrate, const int latchTime_ns) :
|
||||
mDeviceName(outputDevice),
|
||||
mBaudRate_Hz(baudrate),
|
||||
@ -26,7 +25,7 @@ LedUdpDevice::LedUdpDevice(const std::string& outputDevice, const unsigned baudr
|
||||
QString str = QString::fromStdString(mDeviceName);
|
||||
QStringList _list = str.split(":");
|
||||
if (_list.size() != 2) {
|
||||
printf ("ERROR: LedUdpDevice: Error parsing hostname:port\n");
|
||||
Error( Logger::getInstance("LedDevice"), "LedUdpDevice: Error parsing hostname:port");
|
||||
exit (-1);
|
||||
}
|
||||
QHostInfo info = QHostInfo::fromName(_list.at(0));
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
// Hyperion includes
|
||||
#include <leddevice/LedDevice.h>
|
||||
#include <utils/Logger.h>
|
||||
|
||||
///
|
||||
/// The LedUdpDevice implements an abstract base-class for LedDevices using the SPI-device.
|
||||
|
Loading…
Reference in New Issue
Block a user