mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
common ledbuffer for color transform (#77)
* common ledbuffer for color transform hyperion class uses a common buffer for all operations on ledColors got from muxer all color transforms uses new ledBuffer instead of making copies of ledbuffer other fixes: fix compile bug in profiler update doxygen config * migrate logging for color transform classes * prepare new logger in hyperion class * implement hwledcount * Update Hyperion.cpp Fix off color * remove ledscount equivalent from apa102 migrate logging in hyperion.cpp remove unused and duuplicate colorcorrection - but same is available through tempertature * remove colorcorrection completly fix compile * set colororder back to static * in remote: using correction is the same as using temperature - correction is obsolete, command not delete atm for compat reasons
This commit is contained in:
@@ -12,20 +12,18 @@
|
||||
// hyperion local includes
|
||||
#include "LedDeviceAPA102.h"
|
||||
|
||||
LedDeviceAPA102::LedDeviceAPA102(const std::string& outputDevice, const unsigned baudrate, const unsigned ledcount) :
|
||||
LedSpiDevice(outputDevice, baudrate, 500000),
|
||||
_ledBuffer(0)
|
||||
LedDeviceAPA102::LedDeviceAPA102(const std::string& outputDevice, const unsigned baudrate)
|
||||
: LedSpiDevice(outputDevice, baudrate, 500000)
|
||||
, _ledBuffer(0)
|
||||
{
|
||||
_HW_ledcount = ledcount;
|
||||
}
|
||||
|
||||
int LedDeviceAPA102::write(const std::vector<ColorRgb> &ledValues)
|
||||
{
|
||||
_mLedCount = ledValues.size();
|
||||
const unsigned int max_leds = std::max(_mLedCount, _HW_ledcount);
|
||||
const unsigned int startFrameSize = 4;
|
||||
const unsigned int endFrameSize = std::max<unsigned int>(((max_leds + 15) / 16), 4);
|
||||
const unsigned int APAbufferSize = (max_leds * 4) + startFrameSize + endFrameSize;
|
||||
const unsigned int endFrameSize = std::max<unsigned int>(((_mLedCount + 15) / 16), 4);
|
||||
const unsigned int APAbufferSize = (_mLedCount * 4) + startFrameSize + endFrameSize;
|
||||
|
||||
if(_ledBuffer.size() != APAbufferSize){
|
||||
_ledBuffer.resize(APAbufferSize, 0xFF);
|
||||
@@ -35,8 +33,7 @@ int LedDeviceAPA102::write(const std::vector<ColorRgb> &ledValues)
|
||||
_ledBuffer[3] = 0x00;
|
||||
}
|
||||
|
||||
unsigned iLed=0;
|
||||
for (iLed=0; iLed < _mLedCount; ++iLed) {
|
||||
for (unsigned iLed=0; iLed < _mLedCount; ++iLed) {
|
||||
const ColorRgb& rgb = ledValues[iLed];
|
||||
_ledBuffer[4+iLed*4] = 0xFF;
|
||||
_ledBuffer[4+iLed*4+1] = rgb.red;
|
||||
@@ -44,13 +41,6 @@ int LedDeviceAPA102::write(const std::vector<ColorRgb> &ledValues)
|
||||
_ledBuffer[4+iLed*4+3] = rgb.blue;
|
||||
}
|
||||
|
||||
for ( ; iLed < max_leds; ++iLed) {
|
||||
_ledBuffer[4+iLed*4] = 0xFF;
|
||||
_ledBuffer[4+iLed*4+1] = 0x00;
|
||||
_ledBuffer[4+iLed*4+2] = 0x00;
|
||||
_ledBuffer[4+iLed*4+3] = 0x00;
|
||||
}
|
||||
|
||||
return writeBytes(_ledBuffer.size(), _ledBuffer.data());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user