Skip to content
This repository was archived by the owner on May 6, 2021. It is now read-only.

Commit 72e6031

Browse files
author
Tim Niggemann
committed
Removed saving of model ids. Save the corresponding color triangles instead for speedup.
1 parent dbde663 commit 72e6031

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

libsrc/leddevice/LedDevicePhilipsHue.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ CGTriangle LedDevicePhilipsHue::getTriangle(QString modelId) {
122122
void LedDevicePhilipsHue::saveStates(unsigned int nLights) {
123123
// Clear saved light states.
124124
states.clear();
125+
triangles.clear();
125126
// Use json parser to parse reponse.
126127
Json::Reader reader;
127128
Json::FastWriter writer;
@@ -142,12 +143,11 @@ void LedDevicePhilipsHue::saveStates(unsigned int nLights) {
142143
state["xy"] = json["state"]["xy"];
143144
state["bri"] = json["state"]["bri"];
144145
}
145-
// Save id.
146-
ids.push_back(QString(writer.write(json["modelid"]).c_str()).trimmed().replace("\"", ""));
147146
// Save state object.
148147
states.push_back(QString(writer.write(state).c_str()).trimmed());
149148
// Determine triangle.
150-
triangles.push_back(getTriangle(ids.back()));
149+
QString modelId = QString(writer.write(json["modelid"]).c_str()).trimmed().replace("\"", "");
150+
triangles.push_back(getTriangle(modelId));
151151
}
152152
}
153153

@@ -165,6 +165,7 @@ void LedDevicePhilipsHue::restoreStates() {
165165
}
166166
// Clear saved light states.
167167
states.clear();
168+
triangles.clear();
168169
}
169170

170171
bool LedDevicePhilipsHue::areStatesSaved() {

libsrc/leddevice/LedDevicePhilipsHue.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ private slots:
6565
private:
6666
/// Array to save the light states.
6767
std::vector<QString> states;
68-
/// Array to save model ids.
69-
std::vector<QString> ids;
7068
/// Color triangles.
7169
std::vector<CGTriangle> triangles;
7270
/// Ip address of the bridge

0 commit comments

Comments
 (0)