Announcement

Collapse
No announcement yet.

Video Stopped Playing In The Loop After A Few Times

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Video Stopped Playing In The Loop After A Few Times

    Hi,

    I was trying to play a few video clips (Video1-Video4) on the ulcd-144-g2.

    I tried playing a few video clips one after another. It started off just fine but it got stuck at a certain point. Then, I tried just running a video clip in a loop. After the clip was played a few times, it got stuck.

    I;m using serial on Arduino.

    Code:
    #include <SoftwareSerial.h>
    #include <MemoryFree.h>
    
    #define DisplaySerial Serial1
    //SoftwareSerial DisplaySerial(12,13) ; // pin 12 = TX of display, pin 13 = RX
    #define RESETLINE 4
    
    #include "Goldelox_Serial_4DLib.h"
    #include "Goldelox_Const4D.h"
    
    enum constant {
        iVideo1H    =      0x0000,
        iVideo1L    =      0x0000,
        iVideo3H    =      0x004A,
        iVideo3L    =      0x9000,
        iVideo4H    =      0x0096,
        iVideo4L    =      0xB800,
        iVideo5H    =      0x00C9,
        iVideo5L    =      0x1800
    };
    
    Goldelox_Serial_4DLib Display(&DisplaySerial);
    
    int hndl;
    word iUserImages1H, iUserImages1L;
    void setup() {
      Serial.begin(115200);
      Serial.println(F("testing usd..."));
      tft_setup();
    }
    
    void loop()
    {
      tft_loop();
    }
    
    void tft_setup() {
      pinMode(RESETLINE, OUTPUT);
      reset_display();
      delay(5000);
      DisplaySerial.begin(9600);
      Display.gfx_ScreenMode(LANDSCAPE);
      Display.TimeLimit4D = 5000;
      Display.Callback4D = mycallback;
      Display.gfx_Cls();
    
      hndl = Display.media_Init();
      Serial.println(F("testing usd..."));
      while (!hndl)
      {
        Serial.print(F("hndl :")); Serial.println(hndl);
        hndl = Display.media_Init();
        Display.gfx_Cls();
      }
    
    //  Serial.println(F("Displaying images..."));
    
      Display.gfx_BGcolour(DEEPSKYBLUE);
      Display.gfx_Cls();
      delay(1000);
    }
    
    void tft_loop() {
      Display.media_SetAdd(iVideo1H, iVideo1L);
      Display.media_Video(8,8);
      Display.media_Flush();
      delay(500);
      Display.media_SetAdd(iVideo3H, iVideo3L);
      Display.media_Video(8,8);
      Display.media_Flush();
      delay(500);
      Display.media_SetAdd(iVideo4H, iVideo4L);
      Display.media_Video(8,8);
      Display.media_Flush();
      delay(500);
      Display.media_SetAdd(iVideo5H, iVideo5L);
      Display.media_Video(8,8);
      //Serial.println(freeMemory());
    }
    
    void reset_display() {
      digitalWrite(RESETLINE, HIGH);
      delay(100);
      digitalWrite(RESETLINE, LOW);
    }
    
    void mycallback(int errorCode, unsigned char errorByte) {
      const char *Error4DText[] = {"OK\0", "Timeout\0", "NAK\0", "Length\0", "Invalid\0"};
      Serial.print(F("Serial 4D Library reports error ")) ;
      Serial.print(Error4DText[errorCode]);
      if (errorCode == Err4D_NAK)
      {
        Serial.print(F(" returned data= "));
        Serial.println(errorByte);
      }
      else {
        Serial.println(F(""));
      }
    }

  • #2
    What baud rate are you using?
    Mark

    Comment


    • #3
      Hi Mark, I'm using 9600 for Display Serial and 115200 for Serial.

      Comment


      • #4
        How long does the video take to play?

        The Display.TimeLimit4D value needs to be a few seconds higher than the time taken to play the video otherwise the Arduino library will timeout and stop sending commands to the display
        Mark

        Comment

        Working...
        X