Skip to content

Commit

Permalink
Allow different Nanoleaf panel numbering sequence (Feature req.hyperi…
Browse files Browse the repository at this point in the history
  • Loading branch information
Lord-Grey committed Jun 12, 2020
1 parent 96cc580 commit 771f7bd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 42 deletions.
9 changes: 5 additions & 4 deletions libsrc/leddevice/dev_net/LedDeviceNanoleaf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ bool LedDeviceNanoleaf::init(const QJsonObject &deviceConfig)
Debug(_log, "LatchTime : %d", this->getLatchTime());

// Read panel organisation configuration

if ( deviceConfig[ CONFIG_PANEL_ORDER_TOP_DOWN ].isString() )
_topDown = deviceConfig[ CONFIG_PANEL_ORDER_TOP_DOWN ].toString().toInt() == 0 ? true : false;
else
Expand Down Expand Up @@ -325,8 +324,6 @@ bool LedDeviceNanoleaf::initLedsConfiguration()
}
Debug(_log, "[%d]", isInitOK);

isInitOK = false;

return isInitOK;
}

Expand Down Expand Up @@ -555,6 +552,9 @@ int LedDeviceNanoleaf::write(const std::vector<ColorRgb> & ledValues)
udpbuffer[i++] = lowByte;

ColorRgb color;

//Maintain LED counter independent from PanelCounter
uint ledCounter = 0;
for ( uint panelCounter=0; panelCounter < _panelLedCount; panelCounter++ )
{
uint panelID = _panelIds[panelCounter];
Expand All @@ -564,7 +564,8 @@ int LedDeviceNanoleaf::write(const std::vector<ColorRgb> & ledValues)

// Set panels configured
if( panelCounter >= _startPos && panelCounter <= _endPos ) {
color = static_cast<ColorRgb>(ledValues.at(panelCounter));
color = static_cast<ColorRgb>(ledValues.at(ledCounter));
++ledCounter;
}
else
{
Expand Down
38 changes: 0 additions & 38 deletions libsrc/leddevice/dev_net/LedDeviceNanoleaf.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,42 +159,6 @@ class LedDeviceNanoleaf : public ProviderUdp
///
QString getOnOffRequest (bool isOn ) const;

// ///
// /// @brief Get command as url
// ///
// /// @param host Hostname or IP
// /// @param port IP-Port
// /// @param authToken Authorization token
// /// @param Endpoint command for request
// /// @return Url to execute endpoint/command
// ///
// QString buildUrl(const QString &host, const QString &port, const QString &authToken, const QString &endpoint) const;

// ///
// /// @brief Execute GET request
// ///
// /// @param url GET request for url
// /// @return Response from device
// ///
// QJsonDocument getJson(QString url);

// ///
// /// @brief Execute PUT request
// ///
// /// @param Url for PUT request
// /// @param json Command for request
// /// @return Response from device
// ///
// QJsonDocument putJson(QString url, QString json);

// ///
// /// @brief Handle replys for GET and PUT requests
// ///
// /// @param reply Network reply
// /// @return Response for request, if no error
// ///
// QJsonDocument handleReply(QNetworkReply* const &reply );

///
/// @brief Convert vector to hex string
///
Expand Down Expand Up @@ -225,8 +189,6 @@ class LedDeviceNanoleaf : public ProviderUdp
/// Array of the panel ids.
QVector<uint> _panelIds;



};

#endif // LEDEVICENANOLEAF_H

0 comments on commit 771f7bd

Please sign in to comment.