board707 / DMD_STM32

STM32Duino library for RGB, Monochrome and Two-color led matrix panels
GNU General Public License v3.0
54 stars 18 forks source link

Multiline scrolling possible #99

Closed maxmurugan closed 2 months ago

maxmurugan commented 2 months ago

hi sir

Currently Now multiline Fixed text and one scrolling text working fine

how to add multiline Scrolling text?

board707 commented 2 months ago

It could be done the same way as "fixed text and one scrolling text'. Outputs the "fixed text" on a new position on each step - and you will get it as a scrolling.

maxmurugan commented 2 months ago

give some sample code please

board707 commented 2 months ago

Please show your code for "fixed text and one scrolling text'.

maxmurugan commented 2 months ago

void loop(void) { dmd.selectFont(&UkrRusArial_F); uint16_t bg = 0; // background - black uint16_t interval = 32; long prev_step = millis(); while (1) { / if ((millis() - prev_step) > interval) { dmd.setTextColor(col[R1], bg); // --red color if (dmd.stepMarquee(-1, 0) & 1) { // if text is reached screen bounds dmd.clearScreen(true); Refresh =0; dmd.drawMarquee(Final_Message, strlen(Final_Message) , dmd.width() - 5, (dmd.height() > 0) ? 0 : 0, 0); } dmd.swapBuffers(true); prev_step = millis(); }/

if ((millis() - prev_step) > interval)
  {
    prev_step = millis();
    dmd.setTextColor(col[0], bg); // --red color
    if (dmd.stepMarquee(-1, 0) & 1) { // if text is reached screen bounds
    dmd.clearScreen(true);
    dmd.drawMarquee(Final_Message, strlen(Final_Message) , dmd.width() - 5, (dmd.height() > 0) ? 8 : 0, 0);
    }
    dmd.drawStringX(0, 0, "FIXED TEXT", col[1]); //- fixed messAGE USED FOR CLOCK OR DATE USING DS3231
    dmd.swapBuffers(true);
 }

} }

https://github.com/board707/DMD_STM32/assets/4962604/8e8ac2a0-ce60-46e0-9e45-03ee6668235f

board707 commented 2 months ago

Thank you. Could you try this?

if ((millis() - prev_step) > interval)
  {
    static uint8_t i =0;
    prev_step = millis();
    dmd.setTextColor(col[0], bg); // --red color
    if (dmd.stepMarquee(-1, 0) & 1) { // if text is reached screen bounds
    dmd.clearScreen(true);
    dmd.drawMarquee(Final_Message, strlen(Final_Message) , dmd.width() - 5, (dmd.height() > 0) ? 8 : 0, 0);
    }

      dmd.drawStringX(i, 0, "FIXED TEXT", col[1]); //- fixed messAGE USED FOR CLOCK OR DATE USING DS3231
      i++;
      if (i >= dmd.width() ) i =0;

    dmd.swapBuffers(true);
 }
maxmurugan commented 2 months ago

https://github.com/board707/DMD_STM32/assets/4962604/140bd247-c084-46d9-950a-22cb62b983c2

maxmurugan commented 2 months ago

please check

maxmurugan commented 2 months ago

from left need full scrolling ,like bottom line

maxmurugan commented 2 months ago

change to left scrolling please check

if ((millis() - prev_step) > interval) { static int8_t i = dmd.width(); prev_step = millis(); dmd.setTextColor(col[0], bg); // --red color if (dmd.stepMarquee(-1, 0) & 1) { // if text is reached screen bounds dmd.clearScreen(true); dmd.drawMarquee(Final_Message, strlen(Final_Message) , dmd.width() - 5, (dmd.height() > 0) ? 8 : 0, 0); }

  dmd.drawStringX(i, 0, "FIXED TEXT", col[1]); //- fixed messAGE USED FOR CLOCK OR DATE USING DS3231
  i--;
  if (i <= -dmd.width() ) 
  {
    i = dmd.width();
  }

dmd.swapBuffers(true);

}

https://github.com/board707/DMD_STM32/assets/4962604/fcc683fa-c64f-4905-a27f-8405f9a13903

board707 commented 2 months ago

full scrolling from right

if ((millis() - prev_step) > interval)
  {
    static int16_t i =0;
    prev_step = millis();
    dmd.setTextColor(col[0], bg); // --red color
    if (dmd.stepMarquee(-1, 0) & 1) { // if text is reached screen bounds
    dmd.clearScreen(true);
    dmd.drawMarquee(Final_Message, strlen(Final_Message) , dmd.width() - 5, (dmd.height() > 0) ? 8 : 0, 0);
    }

      dmd.drawStringX(i, 0, "FIXED TEXT", col[1]); //- fixed messAGE USED FOR CLOCK OR DATE USING DS3231
      i++;
      if (i >= dmd.width() ) i = -1 * (stringWidth("FIXED TEXT"));

    dmd.swapBuffers(true);
 }
maxmurugan commented 2 months ago

please check video

https://github.com/board707/DMD_STM32/assets/4962604/0bfde3e1-e997-43c6-831f-fda656e417f3

maxmurugan commented 2 months ago

wow nice working thanks a lot

maxmurugan commented 2 months ago

Top line right side end of text not clear how to clear?

board707 commented 2 months ago

may be it helps:

if ((millis() - prev_step) > interval)
  {
    static int16_t i =0;
    prev_step = millis();
    dmd.setTextColor(col[0], bg); // --red color
    if (dmd.stepMarquee(-1, 0) & 1) { // if text is reached screen bounds
    dmd.clearScreen(true);
    dmd.drawMarquee(Final_Message, strlen(Final_Message) , dmd.width() - 5, (dmd.height() > 0) ? 8 : 0, 0);
    }

      dmd.drawStringX(i, 0, "FIXED TEXT", col[1]); //- fixed messAGE USED FOR CLOCK OR DATE USING DS3231
      i++;
      if (i >= (dmd.width() +2) ) i = -1 * (stringWidth("FIXED TEXT"));

    dmd.swapBuffers(true);
 }
maxmurugan commented 2 months ago

same issue will happened

board707 commented 2 months ago

ok, I will to see at the evening because it should be tested on hardware

board707 commented 2 months ago

It is seems to work:

const char Fixed[] = "FIXED TEXT";
int16_t fixed_w = 0;
int16_t min_y, max_y;
dmd.stringBounds(Fixed, 0, &fixed_w, &min_y, &max_y);
while (1)
{

if ((millis() - prev_step) > interval)
  {
    static int16_t i =0;
    prev_step = millis();
    dmd.setTextColor(col[0], bg); // --red color
    if (dmd.stepMarquee(-1, 0) & 1) { // if text is reached screen bounds
    dmd.clearScreen(true);
    dmd.drawMarquee(Final_Message, strlen(Final_Message) , dmd.width() - 5, 16, 0);
    }
      dmd.drawFilledBox(i-2, min_y, i-1, max_y, bg);  // clear artefacts after moving the text
      dmd.drawStringX(i, 0, Fixed, col[1]); //- fixed messAGE USED FOR CLOCK OR DATE USING DS3231
      i++;
      if (i >= (dmd.width()+2) ) i = -1 * fixed_w;

    dmd.swapBuffers(true);
 }

}
maxmurugan commented 2 months ago

Now working fine

https://github.com/board707/DMD_STM32/assets/4962604/8db425a3-00af-49c0-8f4f-c800bcf19e9a

board707 commented 2 months ago

Thenk you Can I use your videos as illustrations for a library manual?

maxmurugan commented 2 months ago

ok sir thanks