MagTag has unwanted black border in Grayscale4 mode

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
TheRealElbadoo
 
Posts: 2
Joined: Tue Nov 16, 2021 1:57 am

MagTag has unwanted black border in Grayscale4 mode

Post by TheRealElbadoo »

I'm writing code in the Arduino IDE for my newly-purchased (11/2021) MagTag and I'm getting borders I don't expect to see.

Initializing the display in the THINKINK_GRAYSCALE4 mode leaves me with an unwanted black border around the display area. I had wanted to use the display for a graph, but I'm going to have to move the axes several pixels away to avoid losing them in the border box. The only way I can avoid the appearance of the border is if I use an all-black background.

I didn't include photos, but the THINKINK_MONO mode sets a white border. This could be an issue if I planned on writing white text/plot axes on a black background. I guess I'm not as worried about that, but it's odd that it's different from the Grayscale border.

I've attached a small demo program which shows the border in action. My code sets a background with some text and draws single-pixel 'pips' at the min/max coordinates of the display to show that the border is outside the addressable area. You'll likely need a magnifier to see the pips.

So: Is there a way to control/customize the appearance of the border?

Code: Select all

/***************************************************
  Adafruit invests time and resources providing this open source code,
  please support Adafruit and open-source hardware by purchasing
  products from Adafruit!

  Written by Limor Fried/Ladyada for Adafruit Industries.
  MIT license, all text above must be included in any redistribution
 ****************************************************/

#include "Adafruit_ThinkInk.h"

#define EPD_DC      7  // can be any pin, but required!
#define EPD_CS      8  // can be any pin, but required!
#define EPD_BUSY    5  // can set to -1 to not use a pin (will wait a fixed delay)
#define SRAM_CS     -1 // can set to -1 to not use a pin (uses a lot of RAM!)
#define EPD_RESET   6  // can set to -1 and share with chip Reset (can't deep sleep)

// 2.9" Grayscale Featherwing or Breakout:
ThinkInk_290_Grayscale4_T5 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);

const int BUTTON_PIN = 0;


void setup() {
  pinMode(BUTTON_PIN, INPUT_PULLUP);
}


void loop() {
  Serial.println();
  Serial.println();
  
  display.begin(THINKINK_GRAYSCALE4);
  display.clearBuffer();
  display.fillScreen(EPD_LIGHT);
  display.setTextSize(4);
  display.setTextColor(EPD_BLACK);
  display.setCursor(0, 0);
  display.print("Greyscale4\n\n Button 0\n for next");
  drawPips();;
  display.display();
  waitForButton();
  
  display.begin(THINKINK_GRAYSCALE4);
  display.clearBuffer();
  display.fillScreen(EPD_LIGHT);
  display.setTextSize(4);
  display.setTextColor(EPD_WHITE);
  display.setCursor(0, 0);
  display.print("Greyscale4\n\n Button0\n for next");
  drawPips();
  display.display();
  waitForButton();

  display.begin(THINKINK_MONO);
  display.clearBuffer();
  //display.fillScreen(EPD_WHITE);        // Don't do this in Monochrome.
  display.setTextSize(4);
  //display.setTextColor(EPD_BLACK);      // Doesn't do anything in Monochrome?
  display.setCursor(0, 0);
  display.print("Monochrome\n\n Button 0\n for next");
  drawPips();
  display.display();
  waitForButton();

  // Counterintuitively - for me - I can't do a fillScreen(EPD_BLACK) and
  // a setTextColor(EPD_WHITE) to get white text on a black background. I have to
  // do some sort of invert thing with setBlackBuffer() and setColorBuffer().
  display.begin(THINKINK_MONO);
  display.setBlackBuffer(1, false);
  display.setColorBuffer(1, false);
  display.clearBuffer();
  //display.fillScreen(EPD_WHITE);      // Don't do this in Monochrome.
  display.setTextSize(4);
  //display.setTextColor(EPD_BLACK);    // Doesn't do anything in Monochrome?
  display.setCursor(0, 0);
  display.print("Mono/invert\n\n Button 0\n to restart");
  drawPips();
  display.display();
  waitForButton();
}

void drawPips() {
  int displayHeight=display.height();
  int displayWidth=display.width();

  display.drawPixel(0,displayHeight/2,EPD_BLACK);
  display.drawPixel(displayWidth-1,displayHeight/2,EPD_BLACK);
  display.drawPixel(displayWidth/2,0,EPD_BLACK);
  display.drawPixel(displayWidth/2,displayHeight-1,EPD_BLACK);
}

void waitForButton() {
  while (digitalRead(BUTTON_PIN) == HIGH) {delay(1);}
  while (digitalRead(BUTTON_PIN) == LOW) {delay(1);}  
}
Attachments
Gray_black_text.jpg
Gray_black_text.jpg (115.65 KiB) Viewed 855 times
Gray_white_text.jpg
Gray_white_text.jpg (128.39 KiB) Viewed 855 times

User avatar
adafruit_support_carter
 
Posts: 29165
Joined: Tue Nov 29, 2016 2:45 pm

Re: MagTag has unwanted black border in Grayscale4 mode

Post by adafruit_support_carter »

Recreated and opened a new issue for this here:
https://github.com/adafruit/Adafruit_EPD/issues/55

User avatar
adafruit_support_carter
 
Posts: 29165
Joined: Tue Nov 29, 2016 2:45 pm

Re: MagTag has unwanted black border in Grayscale4 mode

Post by adafruit_support_carter »

Checkout the issue thread for more details. This appears to be a feature of the display.

User avatar
TheRealElbadoo
 
Posts: 2
Joined: Tue Nov 16, 2021 1:57 am

Re: MagTag has unwanted black border in Grayscale4 mode

Post by TheRealElbadoo »

At least it’s reproducible and somewhat explainable. And yes, there is at least one other posting out there that talks about it also happening in Circuit Python.

If the border can’t be turned off, is there any way it can be set to one of the other options (i.e., Light Gray)? For some applications (like the weather app shown in the Github thread) a dark frame makes sense, but for others it’s kind of intrusive. It would be good to have a choice.

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Arduino products from Adafruit”