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:
@@ -85,11 +85,10 @@ bool LedDeviceFadeCandy::tryConnect()
|
||||
|
||||
int LedDeviceFadeCandy::write( const std::vector<ColorRgb> & ledValues )
|
||||
{
|
||||
ssize_t nrLedValues = ledValues.size();
|
||||
ssize_t led_data_size = nrLedValues * 3; // 3 color bytes
|
||||
ssize_t led_data_size = _ledCount * 3; // 3 color bytes
|
||||
ssize_t opc_data_size = led_data_size + OPC_HEADER_SIZE;
|
||||
|
||||
if (nrLedValues > MAX_NUM_LEDS)
|
||||
if (_ledCount > MAX_NUM_LEDS)
|
||||
{
|
||||
Error(_log, "fadecandy/opc: Invalid attempt to write led values. Not more than %d leds are allowed.", MAX_NUM_LEDS);
|
||||
return -1;
|
||||
@@ -122,15 +121,6 @@ int LedDeviceFadeCandy::transferData()
|
||||
return -2;
|
||||
}
|
||||
|
||||
|
||||
int LedDeviceFadeCandy::switchOff()
|
||||
{
|
||||
for ( int idx=OPC_HEADER_SIZE; idx < _opc_data.size(); idx++ )
|
||||
_opc_data[idx] = 0;
|
||||
|
||||
return ( transferData()<0 ? -1 : 0 );
|
||||
}
|
||||
|
||||
int LedDeviceFadeCandy::sendSysEx(uint8_t systemId, uint8_t commandId, QByteArray msg)
|
||||
{
|
||||
if ( isConnected() )
|
||||
|
||||
Reference in New Issue
Block a user