AaronLiddiment / RGBLEDS

Matrix, Text & Sprite libraries for use with FastLED
68 stars 28 forks source link

Dotstars Scrolling backwards, Horizontal Mirror not working. #11

Closed pmcd7686 closed 6 years ago

pmcd7686 commented 6 years ago

Hello

First off, thank you very much for the libraries. Even thou I am having an issue with the mirror scrolling, I can tell these libraries are exactly what I need using the FastLED framework.

Using TextExample1, I have everything working correctly with an 8x32 Dotstar Matrix (APA102), EXCEPT, the display is mirrored.

The code for EFFECT_SCROLL_LEFT " LEFT SCROLL " looks like: LLORCS TFEL (of course picture the letters facing the other way).

I have tried leds.HorizontalMirror() in a few different places in the sketch with no luck. Where would be the correct place to use this method? I've tried Setup & Loop.

I've deduced my 0, 0 pixel from experimenting with the Init method. Changing those values moves text off "screen". Scroll left scrolls FROM the left scrolling frames TO the right, which seems correct as well. Any other matrix type resulted in garbled text. They are definitely zig-zag.

Tl;dr: Where is the correct place for the Mirror methods to be called? And if they are not work, what should I check next?

Thank you for your help.

`#include

include

include

include

// Change the next 6 defines to match your matrix type and size

define DATA_PIN 4

define CLK_PIN 5

define COLOR_ORDER BGR

define CHIPSET APA102

define MATRIX_WIDTH 32

define MATRIX_HEIGHT 8

define MATRIX_TYPE VERTICAL_ZIGZAG_MATRIX

cLEDMatrix<MATRIX_WIDTH, MATRIX_HEIGHT, MATRIX_TYPE> leds;

cLEDText ScrollingMsg;

const unsigned char TxtDemo[] = { EFFECT_SCROLL_LEFT " LEFT SCROLL " EFFECT_SCROLL_RIGHT " LLORCS THGIR" EFFECT_SCROLL_DOWN " SCROLL DOWN SCROLL DOWN " EFFECT_FRAME_RATE "\x04" " SCROLL DOWN " EFFECT_FRAME_RATE "\x00" " " EFFECT_SCROLL_UP " SCROLL UP SCROLL UP " EFFECT_FRAME_RATE "\x04" " SCROLL UP " EFFECT_FRAME_RATE "\x00" " " EFFECT_CHAR_UP EFFECT_SCROLL_LEFT " UP" EFFECT_CHAR_RIGHT " RIGHT" EFFECT_CHAR_DOWN " DOWN" EFFECT_CHAR_LEFT " LEFT" EFFECT_HSV_CV "\x00\xff\xff\x40\xff\xff" EFFECT_CHAR_UP " HSV_CV 00-40" EFFECT_HSV_CH "\x00\xff\xff\x40\xff\xff" " HSV_CH 00-40" EFFECT_HSV_AV "\x00\xff\xff\x40\xff\xff" " HSV_AV 00-40" EFFECT_HSV_AH "\x00\xff\xff\xff\xff\xff" " HSV_AH 00-FF" " " EFFECT_HSV "\x00\xff\xff" "R" EFFECT_HSV "\x20\xff\xff" "A" EFFECT_HSV "\x40\xff\xff" "I" EFFECT_HSV "\x60\xff\xff" "N" EFFECT_HSV "\xe0\xff\xff" "B" EFFECT_HSV "\xc0\xff\xff" "O" EFFECT_HSV "\xa0\xff\xff" "W" EFFECT_HSV "\x80\xff\xff" "S " EFFECT_DELAY_FRAMES "\x00\x96" EFFECT_RGB "\xff\xff\xff" };

void setup() { FastLED.addLeds<CHIPSET, DATA_PIN, CLK_PIN, COLOR_ORDER>(leds[0], leds.Size()); FastLED.setBrightness(25); FastLED.clear(true); delay(500); FastLED.showColor(CRGB::Red); delay(1000); FastLED.showColor(CRGB::Lime); delay(1000); FastLED.showColor(CRGB::Blue); delay(1000); FastLED.show();

ScrollingMsg.SetFont(MatriseFontData); ScrollingMsg.Init(&leds, leds.Width(), ScrollingMsg.FontHeight() + 1, 0, 0); ScrollingMsg.SetText((unsigned char *)TxtDemo, sizeof(TxtDemo) - 1); ScrollingMsg.SetTextColrOptions(COLR_RGB | COLR_SINGLE, 0xff, 0x00, 0xff); }

void loop() { if (ScrollingMsg.UpdateText() == -1) ScrollingMsg.SetText((unsigned char *)TxtDemo, sizeof(TxtDemo) - 1); else FastLED.show(); delay(20); }`

pmcd7686 commented 6 years ago

Thinking a little more about the issue....

Adafruit_Dotstar_matrix Library scrolled fine, but upside down (relative to this library, I thought maybe I had the matrix physically upside down.). So I turned my head! I think flipping the matrix (physically) and a VeriticalMirror is the solution. Still can't get that method to work for me either.

AaronLiddiment commented 6 years ago

Hi, You should not be using this code, if you look at my other repositories you will find newer versions of each module as its own repository. These individual versions also have fairly good wiki's to help with their use. Here is a bit of the LEDMatrix Wiki that will solve your problem:

There are four matrix types defined at the top of the LEDMatrix header file. The type refers to led wiring order and direction. It is also possible to reverse the X and/or Y axis by using a negative (-) sign before the width/height values:-

cLEDMatrix<MATRIX_WIDTH, -MATRIX_HEIGHT, MATRIX_TYPE> leds;

In the above example this would move the Y origin to the opposite end, so would be used where the first led is at the top but you still want Y origin to be at the bottom.

pmcd7686 commented 6 years ago

Thanks! Worked great. Running out of SRAM now, unfortunately, so I need to do some tweaking.