From 19cee6a0d6bafa256b9c41091a42c16d20909802 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20L=C3=B8vbr=C3=B8tte=20Olsen?= Date: Mon, 8 May 2017 11:43:06 +0200 Subject: [PATCH] Fix led selection to be side independant would only rotate the first side of the cube before! --- School/vg2/borg/borg.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/School/vg2/borg/borg.h b/School/vg2/borg/borg.h index 1b204b4..a58848b 100644 --- a/School/vg2/borg/borg.h +++ b/School/vg2/borg/borg.h @@ -357,15 +357,16 @@ void translate(LEDSelect src, LEDSelect dst, CRGB* leds){ void rotate(byte side, bool direction, byte n, CRGB* leds) { + firstLED = decodeLED({side, 0, 0}); byte cyclus[8]; = {0, 3, 6, 7, 8, 5, 2, 1}; for (byte i = 0; i < n; i++) { - CRGB Saved = leds[cyclus[7 * direction]]; + CRGB Saved = leds[cyclus[7 * direction] + firstLED]; for(byte j = 8; j > 0; j--) { - leds[cyclus[j - (8 * !direction)]] = - leds[cyclus[j - (8 * !direction) + (1 * -direction)]]; + leds[cyclus[j - (8 * !direction)] + firstLED] = + leds[cyclus[j - (8 * !direction) + (1 * -direction)] + firstLED]; } - leds[cyclus[7 - (4 * direction)]] = Saved; + leds[cyclus[7 - (4 * direction)] + firstLED] = Saved; } }