mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
reformatted code and added the new defaults from @redpanther
This commit is contained in:
parent
da6dfc8ed4
commit
3feb905a00
@ -8,7 +8,8 @@
|
|||||||
// hyperion local includes
|
// hyperion local includes
|
||||||
#include "LedDeviceUdpH801.h"
|
#include "LedDeviceUdpH801.h"
|
||||||
|
|
||||||
LedDeviceUdpH801::LedDeviceUdpH801(const Json::Value &deviceConfig) : ProviderUdp(deviceConfig)
|
LedDeviceUdpH801::LedDeviceUdpH801(const Json::Value &deviceConfig)
|
||||||
|
: ProviderUdp(deviceConfig)
|
||||||
{
|
{
|
||||||
setConfig(deviceConfig);
|
setConfig(deviceConfig);
|
||||||
}
|
}
|
||||||
@ -16,7 +17,7 @@ LedDeviceUdpH801::LedDeviceUdpH801(const Json::Value &deviceConfig) : ProviderUd
|
|||||||
bool LedDeviceUdpH801::setConfig(const Json::Value &deviceConfig)
|
bool LedDeviceUdpH801::setConfig(const Json::Value &deviceConfig)
|
||||||
{
|
{
|
||||||
/* The H801 port is fixed */
|
/* The H801 port is fixed */
|
||||||
_port = 30977;
|
ProviderUdp::setConfig(deviceConfig, 30977, "255.255.255.255");
|
||||||
/* 10ms seems to be a safe default for the wait time */
|
/* 10ms seems to be a safe default for the wait time */
|
||||||
_LatchTime_ns = deviceConfig.get("latchtime", 10000000).asInt();
|
_LatchTime_ns = deviceConfig.get("latchtime", 10000000).asInt();
|
||||||
|
|
||||||
@ -30,13 +31,13 @@ bool LedDeviceUdpH801::setConfig(const Json::Value &deviceConfig)
|
|||||||
_message[0] = 0xFB;
|
_message[0] = 0xFB;
|
||||||
_message[1] = 0xEB;
|
_message[1] = 0xEB;
|
||||||
|
|
||||||
for(int i=0; i<_ids.length(); i++){
|
for (int i = 0; i < _ids.length(); i++) {
|
||||||
_message[_prefix_size + _colors + i * _id_size + 0] = (_ids[i] >> 0x00) & 0xFF;
|
_message[_prefix_size + _colors + i * _id_size + 0] = (_ids[i] >> 0x00) & 0xFF;
|
||||||
_message[_prefix_size + _colors + i * _id_size + 1] = (_ids[i] >> 0x08) & 0xFF;
|
_message[_prefix_size + _colors + i * _id_size + 1] = (_ids[i] >> 0x08) & 0xFF;
|
||||||
_message[_prefix_size + _colors + i * _id_size + 2] = (_ids[i] >> 0x10) & 0xFF;
|
_message[_prefix_size + _colors + i * _id_size + 2] = (_ids[i] >> 0x10) & 0xFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug( _log, "H801 using %s:%d", _address.toString().toStdString().c_str() , _port );
|
Debug(_log, "H801 using %s:%d", _address.toString().toStdString().c_str(), _port);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -58,6 +59,6 @@ int LedDeviceUdpH801::write(const std::vector<ColorRgb> &ledValues)
|
|||||||
|
|
||||||
int LedDeviceUdpH801::switchOff()
|
int LedDeviceUdpH801::switchOff()
|
||||||
{
|
{
|
||||||
return write(std::vector<ColorRgb>(_ledCount, ColorRgb{0,0,0}));
|
return write(std::vector<ColorRgb>(_ledCount, ColorRgb{0, 0, 0}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
///
|
///
|
||||||
/// Implementation of the LedDevice interface for sending led colors via udp.
|
/// Implementation of the LedDevice interface for sending led colors via udp.
|
||||||
///
|
///
|
||||||
class LedDeviceUdpH801 : public ProviderUdp
|
class LedDeviceUdpH801: public ProviderUdp
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
QList<int> _ids;
|
QList<int> _ids;
|
||||||
|
Loading…
Reference in New Issue
Block a user