MajicDesigns / MD_Parola

Library for modular scrolling LED matrix text displays
GNU Lesser General Public License v2.1
438 stars 135 forks source link

Animations behaving incorrectly in zones #78

Closed MajicDesigns closed 3 years ago

MajicDesigns commented 3 years ago

IMPORTANT

Before submitting this issue [ x] Have you tried using the latest version of the library? [ x] Have you checked this has not already been submitted and/or resolved? [ x] If you are requesting help a better choice may be the Arduino forum

This issue raised by user nath_159 on the arduino.cc forum. https://forum.arduino.cc/index.php?topic=171056.1665, #1679

Subject of the issue

It appears that the in and out animations of different zones are applying to every zone or the whole panel and they conflict with each other.

I am using the code below and both zones are active when trying to both scroll up and scroll down during the in and out animations. Another way to illustrate the problem is setting one of the zone's output animations to PA_NO_EFFECT, it will still leave animating with the other zone's effect.

Your Environment

Library Version: 3.5.4 Arduino IDE version: Host OS and Version: CPU Hardware model/type: esp8266 (nodemcu dev board) with 4 FW-16 matrix displays Matrix hardware model/type: [ ] Parola [ ] Generic [ ] ICStation [ x] FC-16 [ ] Custom (describe how wired)

Expected Behaviour

Zones should work independently.

Actual Behaviour

Zones are shoehow linked.

Code Demonstrating the Issue

#include <MD_MAX72xx.h>
#include <MD_Parola.h>

 // Parola display settings //
#define HARDWARE_TYPE MD_MAX72XX::FC16_HW // type of device hardware https://majicdesigns.github.io/MD_MAX72XX/page_hardware.html
#define MAX_DEVICES  16                   // number of device segments
  // Display pinout //
#define DATA_PIN  D7
#define CS_PIN    D6
#define CLK_PIN   D5

uint8_t frameDelay = 25;  // default frame delay value

MD_Parola P = MD_Parola(HARDWARE_TYPE, DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);

#define SPEED_TIME  50
#define PAUSE_TIME  5000

char zone0Text[32] = "Zone 0";
char zone0Text1[32] = "zone0Text1";
char zone0Text2[32] = "zone0Text2";
bool zone0Swapper = true;

char zone1Text[32] = "Zone 1";
char zone1Text1[32] = "zone1Text1";
char zone1Text2[32] = "zone1Text2";
bool zone1Swapper = true;

void setup() {
  P.begin(2);

  P.setZone(0, 0, (MAX_DEVICES/2) - 1);
  P.setZone(1, MAX_DEVICES/2, MAX_DEVICES - 1);

  // All zones
  P.setInvert(false);
  P.setIntensity(4);

  P.displayZoneText(0, zone0Text, PA_RIGHT, SPEED_TIME, PAUSE_TIME, PA_SCROLL_UP , PA_SCROLL_UP);
  P.displayZoneText(1, zone1Text, PA_LEFT, SPEED_TIME, PAUSE_TIME, PA_SCROLL_DOWN, PA_SCROLL_DOWN);// , PA_SCROLL_DOWN);

}

void loop() {
  if (P.displayAnimate())
  {
    if (P.getZoneStatus(0))
    {
      if (zone0Swapper)
      {
        strcpy(zone0Text, zone0Text1);
      }
      else
      {
        strcpy(zone0Text, zone0Text2);
      }
      zone0Swapper = !zone0Swapper;
      P.displayReset(0);
    }

    if (P.getZoneStatus(1))
    {
      if (zone1Swapper)
      {
        strcpy(zone1Text, zone1Text1);
      }
      else
      {
        strcpy(zone1Text, zone1Text2);
      }
      zone1Swapper = !zone1Swapper;
      P.displayReset(1);
    }
  }
}
MajicDesigns commented 3 years ago

I have tested your code and it only happens with the vertical (UP/DOWN) and diagonal (UL, UR, DL, DR) scrolling animations. The problem was introduced with the changes in version 3.5.3. This issue is fixed in release 3.5.5.