update adalight sketch (#299)

* rename platform rpi-pwm to rpi. remove original rpi platform
install symlink to bin folder
create effects folder for custom effects

* fix osx jobs evaluation

* - add rewrite time to serial leds
- rework adalight sketch

* add analog output

* adalight: add analog mode: last led

* tune adalight sketch to final state
move refresh code to leddevice base class, so every leddevice can use it
This commit is contained in:
redPanther
2016-11-29 23:14:15 +01:00
committed by GitHub
parent 6b3f0e42b5
commit 81dea1583d
12 changed files with 297 additions and 120 deletions

View File

@@ -17,9 +17,14 @@ LedDevice::LedDevice()
, _log(Logger::getInstance("LedDevice"))
, _ledBuffer(0)
, _deviceReady(true)
, _refresh_timer()
{
LedDevice::getLedDeviceSchemas();
// setup timer
_refresh_timer.setSingleShot(false);
_refresh_timer.setInterval(0);
connect(&_refresh_timer, SIGNAL(timeout()), this, SLOT(rewriteLeds()));
}
// dummy implemention
@@ -103,7 +108,17 @@ QJsonObject LedDevice::getLedDeviceSchemas()
int LedDevice::setLedValues(const std::vector<ColorRgb>& ledValues)
{
return _deviceReady ? write(ledValues) : -1;
if (!_deviceReady)
return -1;
_ledValues = ledValues;
// restart the timer
if (_refresh_timer.interval() > 0)
{
_refresh_timer.start();
}
return write(ledValues);
}
int LedDevice::switchOff()
@@ -118,3 +133,8 @@ void LedDevice::setLedCount(int ledCount)
_ledRGBCount = _ledCount * sizeof(ColorRgb);
_ledRGBWCount = _ledCount * sizeof(ColorRgbw);
}
int LedDevice::rewriteLeds()
{
return write(_ledValues);
}