mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Leddevice refactoring the next part (#253)
* add general switchOff * refactoring of leddevices regarding ledcount and switchoff * remove obsolete includes
This commit is contained in:
@@ -41,12 +41,12 @@ LedDeviceLightpack::LedDeviceLightpack(const std::string & serialNumber)
|
||||
, _serialNumber(serialNumber)
|
||||
, _firmwareVersion({-1,-1})
|
||||
, _bitsPerChannel(-1)
|
||||
, _hwLedCount(-1)
|
||||
{
|
||||
_ledCount = -1;
|
||||
}
|
||||
|
||||
LedDeviceLightpack::LedDeviceLightpack(const Json::Value &deviceConfig)
|
||||
: LedDeviceLightpack()
|
||||
: LedDevice()
|
||||
{
|
||||
setConfig(deviceConfig);
|
||||
}
|
||||
@@ -207,11 +207,11 @@ int LedDeviceLightpack::testAndOpen(libusb_device * device, const std::string &
|
||||
// determine the number of leds
|
||||
if (_firmwareVersion.majorVersion == 4)
|
||||
{
|
||||
_ledCount = 8;
|
||||
_hwLedCount = 8;
|
||||
}
|
||||
else
|
||||
{
|
||||
_ledCount = 10;
|
||||
_hwLedCount = 10;
|
||||
}
|
||||
|
||||
// determine the bits per channel
|
||||
@@ -226,7 +226,7 @@ int LedDeviceLightpack::testAndOpen(libusb_device * device, const std::string &
|
||||
}
|
||||
|
||||
// set the led buffer size (command + 6 bytes per led)
|
||||
_ledBuffer = std::vector<uint8_t>(1 + _ledCount * 6, 0);
|
||||
_ledBuffer = std::vector<uint8_t>(1 + _hwLedCount * 6, 0);
|
||||
_ledBuffer[0] = CMD_UPDATE_LEDS;
|
||||
|
||||
// return success
|
||||
@@ -251,7 +251,7 @@ int LedDeviceLightpack::write(const std::vector<ColorRgb> &ledValues)
|
||||
|
||||
int LedDeviceLightpack::write(const ColorRgb * ledValues, int size)
|
||||
{
|
||||
int count = std::min(_ledCount, size);
|
||||
int count = std::min(_hwLedCount, _ledCount);
|
||||
|
||||
for (int i = 0; i < count ; ++i)
|
||||
{
|
||||
|
Reference in New Issue
Block a user