From e5a3b4c0b9cf279488b13b4058b3f68fb5c36013 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Frakn=C3=B3i=20Tam=C3=A1s?= <fraknoitamas@gmail.com>
Date: Sat, 12 Jun 2021 22:05:52 +0200
Subject: [PATCH] Update universes

---
 test_anim/ola_receiver.cpp | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/test_anim/ola_receiver.cpp b/test_anim/ola_receiver.cpp
index 9c88eb2..054d589 100644
--- a/test_anim/ola_receiver.cpp
+++ b/test_anim/ola_receiver.cpp
@@ -4,10 +4,10 @@
 #include <ola/client/ClientWrapper.h>
 #include "spisender.h"
 
-// Important to go from zero.
+// Important to go from one.
 // Else modify the NewDmx callback
-static unsigned int universes[6] = {0, 1, 2, 3, 4, 5};
-// The 'n'th universe goes from (rows[n]) to (rows[n+1]-1) inclusive
+static unsigned int universes[6] = {1, 2, 3, 4, 5, 6};
+// The 'n'th universe (n: 1-6) goes from (rows[n-1]) to (rows[n]-1) inclusive
 static int universe_rows[7] = {0, 5, 10, 15, 20, 25, 26};
 
 static void RegisterComplete(const ola::client::Result &result);
@@ -64,10 +64,8 @@ static void NewDmx(const ola::client::DMXMetadata &metadata,
             const ola::DmxBuffer &data)
 {
     MxFrame frame;
-    if (metadata.universe > 5) return;
-    //printf("New Frame on universe %d\n", metadata.universe);
-    int startY = universe_rows[metadata.universe];
-    int endY = universe_rows[metadata.universe+1]-1;
+    int startY = universe_rows[metadata.universe-1];
+    int endY = universe_rows[metadata.universe]-1;
     const uint8_t* arr = data.GetRaw();
     int k = 0;
     for (size_t y = startY; y <= endY; y++)
-- 
GitLab