@@ -272,7 +272,7 @@ bool LedDeviceNanoleaf::initLedsConfiguration()
272272 int panelNum = jsonLayout[PANEL_NUM].toInt ();
273273 const QJsonArray positionData = jsonLayout[PANEL_POSITIONDATA].toArray ();
274274
275- std::map<int , std::map<int , int >> panelMap;
275+ std::map<int , std::map<int , std::vector< int > >> panelMap;
276276
277277 // Loop over all children.
278278 for (const QJsonValue& value : positionData)
@@ -299,8 +299,14 @@ bool LedDeviceNanoleaf::initLedsConfiguration()
299299
300300 if (hasLEDs (static_cast <SHAPETYPES>(panelshapeType)))
301301 {
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+
304310 }
305311 else
306312 {
@@ -317,15 +323,18 @@ bool LedDeviceNanoleaf::initLedsConfiguration()
317323 {
318324 for (auto posX = posY->second .cbegin (); posX != posY->second .cend (); ++posX)
319325 {
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)
327327 {
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+ }
329338 }
330339 }
331340 }
@@ -334,15 +343,18 @@ bool LedDeviceNanoleaf::initLedsConfiguration()
334343 // Sort panels right to left
335344 for (auto posX = posY->second .crbegin (); posX != posY->second .crend (); ++posX)
336345 {
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)
344347 {
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+ }
346358 }
347359 }
348360 }
0 commit comments