Ws2812spi and sk6812rgbw have wrong default rate (#221)

* Changed default baud rate in schema for ws2812spi and sk6812spi

* now sets the default baud_rate speed to 2800000 if omitted.
Previously it used the ProviderSPI default which was 1000000 and guaranteed not to work

* Added warnings if the SPI baud rate is likely out of range
Added some debug statements to ProviderSpi
This commit is contained in:
penfold42
2016-09-04 22:28:06 +10:00
committed by redPanther
parent 4968a11816
commit 49d3d35de1
6 changed files with 34 additions and 3 deletions

View File

@@ -33,6 +33,13 @@ LedDevice* LedDeviceSk6812SPI::construct(const Json::Value &deviceConfig)
bool LedDeviceSk6812SPI::setConfig(const Json::Value &deviceConfig)
{
ProviderSpi::setConfig(deviceConfig);
_baudRate_Hz = deviceConfig.get("rate",3000000).asInt();
if ( (_baudRate_Hz < 2050000) || (_baudRate_Hz > 4000000) )
{
Warning(_log, "SPI rate %d outside recommended range (2050000 -> 4000000)", _baudRate_Hz);
}
_whiteAlgorithm = deviceConfig.get("white_algorithm","").asString();
return true;