Skip to content

cleanScreen prevents multiple objects to be displayed #1

@ybaeri

Description

@ybaeri

When I repeatedly draw lots of lines and use lcd.cleanScreen(); to get rid of everything, the display eventually fails to display multiple lines.

After just a couple lcd.cleanScreen(); there is always just one line drawn. As soon as another line is drawn, the previous one disappears.

It appears that the object amount is limited per object category. After failing, it is able to display one shape, string, line etc. at a time but not two objects of the same type at the same time.

I have not done much investigation. In my test setup, I am using an Arduino UNO R4 Wifi. I draw 256 lines before a lcd.cleanScreen();. After the second lcd.cleanScreen();, only one line is visible at a time.

When always deleting the lines with lcd.deleteLine( id ); there is no failure, at least after over 15 minutes of testing. The program using lcd.cleanScreen(); fails after about 30 seconds.

The library seems well written, maybe it's a fault happening on the display.

Code using lcd.cleanScreen();:

#include "DFRobot_LcdDisplay.h"

DFRobot_Lcd_IIC lcd(&Wire, 0x2C);

void setup() {
  Serial.begin(9600);
  lcd.begin();
  delay(5000);
  lcd.setBackgroundColor(BLACK);

}

void loop() {
  for (int i = 0; i < 16; i++) {
    for (int j = 0; j < 16; j++) {
      lcd.drawLine(i, j, i + 1, j + 1, 1, RED);
    }
  }

  lcd.cleanScreen();

}

Code using lcd.deleteLine( id );:

#include "DFRobot_LcdDisplay.h"

struct data {
  int64_t id;
};

struct data data_id[350];

DFRobot_Lcd_IIC lcd(&Wire, 0x2C);

void setup() {
  Serial.begin(9600);
  lcd.begin();
  delay(5000);
  lcd.setBackgroundColor(BLACK);

}

void loop() {
  for (int i = 0; i < 16; i++) {
    for (int j = 0; j < 16; j++) {
      data_id[i + 20 * j].id = lcd.drawLine(i, j, i + 1, j + 1, 1, RED);
    }
  }

  for (int i = 0; i < 16; i++) {
    for (int j = 0; j < 16; j++) {
      lcd.deleteLine(data_id[i + 20 * j].id);
    }
  }

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions