@@ -272,7 +272,7 @@ bool LedDeviceNanoleaf::initLedsConfiguration()
272
272
int panelNum = jsonLayout[PANEL_NUM].toInt ();
273
273
const QJsonArray positionData = jsonLayout[PANEL_POSITIONDATA].toArray ();
274
274
275
- std::map<int , std::map<int , int >> panelMap;
275
+ std::map<int , std::map<int , std::vector< int > >> panelMap;
276
276
277
277
// Loop over all children.
278
278
for (const QJsonValue& value : positionData)
@@ -299,8 +299,14 @@ bool LedDeviceNanoleaf::initLedsConfiguration()
299
299
300
300
if (hasLEDs (static_cast <SHAPETYPES>(panelshapeType)))
301
301
{
302
- panelMap[panelY][panelX] = panelId;
303
- DebugIf (verbose, _log, " Use Panel [%d] (%d,%d) - Type: [%d]" , panelId, panelX, panelY, panelshapeType);
302
+ panelMap[panelY][panelX];
303
+ panelMap[panelY][panelX].push_back (panelId);
304
+ if (panelMap[panelY][panelX].size () > 1 ) {
305
+ DebugIf (verbose, _log, " Use Panel [%d] (%d,%d) - Type: [%d] (Ovarlapping %d other Panels)" , panelId, panelX, panelY, panelshapeType, panelMap[panelY][panelX].size () - 1 );
306
+ } else {
307
+ DebugIf (verbose, _log, " Use Panel [%d] (%d,%d) - Type: [%d]" , panelId, panelX, panelY, panelshapeType);
308
+ }
309
+
304
310
}
305
311
else
306
312
{
@@ -317,15 +323,18 @@ bool LedDeviceNanoleaf::initLedsConfiguration()
317
323
{
318
324
for (auto posX = posY->second .cbegin (); posX != posY->second .cend (); ++posX)
319
325
{
320
- DebugIf (verbose, _log, " panelMap[%d][%d]=%d" , posY->first , posX->first , posX->second );
321
-
322
- if (_topDown)
323
- {
324
- _panelIds.push_back (posX->second );
325
- }
326
- else
326
+ for (auto ledId = posX->second .cbegin (); ledId != posX->second .cend (); ++ledId)
327
327
{
328
- _panelIds.push_front (posX->second );
328
+ DebugIf (verbose, _log, " panelMap[%d][%d]=%d" , posY->first , posX->first , ledId);
329
+
330
+ if (_topDown)
331
+ {
332
+ _panelIds.push_back (*ledId);
333
+ }
334
+ else
335
+ {
336
+ _panelIds.push_front (*ledId);
337
+ }
329
338
}
330
339
}
331
340
}
@@ -334,15 +343,18 @@ bool LedDeviceNanoleaf::initLedsConfiguration()
334
343
// Sort panels right to left
335
344
for (auto posX = posY->second .crbegin (); posX != posY->second .crend (); ++posX)
336
345
{
337
- DebugIf (verbose, _log, " panelMap[%d][%d]=%d" , posY->first , posX->first , posX->second );
338
-
339
- if (_topDown)
340
- {
341
- _panelIds.push_back (posX->second );
342
- }
343
- else
346
+ for (auto ledId = posX->second .cbegin (); ledId != posX->second .cend (); ++ledId)
344
347
{
345
- _panelIds.push_front (posX->second );
348
+ DebugIf (verbose, _log, " panelMap[%d][%d]=%d" , posY->first , posX->first , ledId);
349
+
350
+ if (_topDown)
351
+ {
352
+ _panelIds.push_back (*ledId);
353
+ }
354
+ else
355
+ {
356
+ _panelIds.push_front (*ledId);
357
+ }
346
358
}
347
359
}
348
360
}
0 commit comments