RA8876LiteTeensy For Teensy T36 and T40

@KurtE
I just ran FontTest4 and something strange going on with screen rotation as well as GFX fonts not working with the existing library. Don't know if its me and messed something up or not. Can you give it a try when you get a chance and let me know if you are having problems.

I did re-run the screen rotate sketch and that seemed to work without an issue.
 
Good question. I only have an ER-TFT074. I was hoping somebody here could give it a shot.

I'll change the graphics.ino back to defaulting to the original display. I'll also add a separate ER-TFT074 example.
 
Good question. I only have an ER-TFT074. I was hoping somebody here could give it a shot.

I'll change the graphics.ino back to defaulting to the original display. I'll also add a separate ER-TFT074 example.

I did test the graphics.ino sketch from you updated library and while it works it looks like when it goes into Rotation 2 it clipping the text in the status bar. It looks like the screen in that rotation is being shifted down and to the left (using the new orientation). Thats how I noticed the issue with the FontTest4
 
I did test the graphics.ino sketch from you updated library and while it works it looks like when it goes into Rotation 2 it clipping the text in the status bar. It looks like the screen in that rotation is being shifted down and to the left (using the new orientation). Thats how I noticed the issue with the FontTest4

Thanks Which display did you see this behavior on? How is it different than before? (A pic might be helpful to me...)
 
@KurtE
I just ran FontTest4 and something strange going on with screen rotation as well as GFX fonts not working with the existing library. Don't know if its me and messed something up or not. Can you give it a try when you get a chance and let me know if you are having problems.

I did re-run the screen rotate sketch and that seemed to work without an issue.

Yes it looks like some stuff is busted! Like you mention GFX Fonts are not working.

I am pretty sure it has to do with GFX font file format changing... LadyAda mentioned that it could be undone as the person who did it was trying to get the stuff to work for extended fonts or the like and then went a different way. But I think I fixed it for some drivers... Need to look again, what I did and where.

Then once screwed up, some of the rotation look bad as well.
 
EDIT: Found where I fixed in ST7735...
Code:
 // Lets see about supporting Adafruit fonts as well?
#if __has_include(<gfxfont.h>)
  #include <gfxfont.h>
#endif
Will see about it in this library.

EDIT: So far NOT :( need to dig deeper!
 
Last edited:
EDIT: Found where I fixed in ST7735...
Code:
 // Lets see about supporting Adafruit fonts as well?
#if __has_include(<gfxfont.h>)
  #include <gfxfont.h>
#endif
Will see about it in this library.

EDIT: So far NOT :( need to dig deeper!

Ok you lost me - that fix? is in the RA8876 library? Needed - not needed? Change?
 
Thanks Which display did you see this behavior on? How is it different than before? (A pic might be helpful to me...)

Using the 7in RA8876 display (1024x600) from BuyDisplay.

This is with the existing library:
IMG-0254.jpg
and this is what i am seeing with your mods:
IMG-0255.jpg
See the clipping at the bottom of the display?
 
Ok you lost me - that fix? is in the RA8876 library? Needed - not needed? Change?

Yep it was there... And I was pulling out my last few strands of hair. I then resorted to adding a #warning in the adafruit gfxfont.h file that said I was included...

And the definitions were not included :( ... SO I searched my libraries folder and thought maybe another older file was included... There was one... But it was not included.
(Getting more bald ;) )

Then finally did search in my libraries folder (sublime text global search:
Code:
Searching 10447 files for "#define _GFXFONT_H_" (regex)
...

C:\Users\kurte\Documents\Arduino\libraries\Ra8876LiteTeensy\src\RA8876Registers.h:
  849  // Lets see about supporting Adafruit fonts as well?
  850  #ifndef _GFXFONT_H_
  851: #define _GFXFONT_H_
  852  /// Font data stored PER GLYPH
  853  typedef struct {
And found that we also had the gfxfont defined in this header file which is one of the first things included by RA8875_t3.h...
So we were using the old format out of that file and as the define _GFXFONT_H_
was defined, our include of the font file did nothing. ...

So I removed the font definition out of this file and that part of the code was much happier.
 
@KurtE
Yep = Saw that but it didn't register as usual. Also downloaded the changes and it works with the single rotation. Now to work on the other rotations Which i could have sworn we had working.
 
Me too... I know that at least at one point they were working.

WIll take another quick look. My guess is one of our internal variables is not properly.
 
Me too... I know that at least at one point they were working.

WIll take another quick look. My guess is one of our internal variables is not properly.

Yep = my guess too. Looking at it now but cant spot it that quickly
 
@mjs513 and ...

Ok,

My fix in PR #6 appears to fix the GFX problem.

Rotation: works and does not work.

That is if you run the rotation test (RA8876Rotate) it appears to be working.

If you run the released ILI_Ada_FontTest4 it goes bonkers (I think that is the technical name for it ;) )

However if you comment out the line in the list:
Code:
const ili_fonts_test_t font_test_list[] = {
[COLOR="#FF0000"]//  {nullptr, nullptr,  "Internal Font", RED, YELLOW},[/COLOR]
  {&Arial_14, nullptr,  "Arial_14", WHITE, WHITE},
i.e. don't use the system font.

Then it appears to work.

At least for me.

So for now I will punt :D
 
@KurtE
Went all through the code and couldn’t find it either. Was going to start commenting things out in the sketch in the morning. Was too hot and tired this evening. Your find does give me an idea on something to check in the morning though. If still can’t find it going to punt as well since not planning on using system fonts either.
 
@KurtE and others
Going through the code again for "Internal Font" remembered something very critical - we can't rotate internal fonts - they are not set up as graphic fonts. Does this make sense.
 
@mjs513 - Totally! Which is why I punted ;) Was thinking about

a) having our test program not use this font in any other rotation than 0 and see if it still works.

b)If not, is there something we need to do when we switch to a new rotation that if the system font was used to reset something....

Or tell people don't do that!
 
@KurtE - Think we should just tell people if they want to do rotations just don't use internal fonts. We could put a test in the lib but then things may start getting confusing when we switch fonts automatically to the user. Think a warning would be better and modify the example. Thoughts?
 
@KurtE
Ok. Played with the example sketch and fixed Internal Font to just for only rotation 0 and it works no problem. I changed the one line where it defaults to setFontDef to:
Code:
    else if(tft.getRotation() == 0 && font_test_list[font_index].font_name == "Internal Font") tft.setFontDef();
    else {
      tft.setFont(Chancery_24_Italic);
      tft.setTextColor(GREEN);
    }
 
@mjs513 - I hacked mine slightly different, not sure which way is better.
Code:
void loop()
{
  Serial.printf("\nRotation: %d\n", test_screen_rotation);
  tft.setRotation(test_screen_rotation);
  tft.fillScreen(RED);
  tft.setCursor(tft.width() / 2, tft.height() / 2, true);
  tft.printf("Rotation: %d", test_screen_rotation);
  test_screen_rotation = (test_screen_rotation + 1) & 0x3;
  tft.setCursor(200, 300);
  Serial.printf("  Set cursor(200, 300), retrieved(%d %d)",
                tft.getCursorX(), tft.getCursorY());
  tft.setCursor(50, 50);
  tft.write('0');
  tft.setCursor(tft.width() - 50, 50);
  tft.write('1');
  tft.setCursor(50, tft.height() - 50);
  tft.write('2');
  tft.setCursor(tft.width() - 50, tft.height() - 50);
  tft.write('3');

  nextPage();
  for (uint8_t font_index = 0; font_index < (sizeof(font_test_list) / sizeof(font_test_list[0])); font_index++) {
    if (font_test_list[font_index].font_fg_color != font_test_list[font_index].font_bg_color)
      tft.setTextColor(font_test_list[font_index].font_fg_color, font_test_list[font_index].font_bg_color);
    else
      tft.setTextColor(font_test_list[font_index].font_fg_color);
    if (font_test_list[font_index].ili_font) tft.setFont(*font_test_list[font_index].ili_font);
    else if (font_test_list[font_index].gfx_font)  tft.setFont(font_test_list[font_index].gfx_font);
    else if (test_screen_rotation != 1) continue;  // only on Page 0
    else  tft.setFontDef();
    tft.println(font_test_list[font_index].font_name);
    displayStuff1();
    nextPage();
  }
}
I started off changing the code that if we were not setting ILI or GFX and we were not rotation 0 (checked for 1 as we already incremented) than do a continue to bypass the rest... But this ended up with a blank page so then had to move around where I did the nextPage calls...
 
@mjs513 and ...

I pushed up a version to my branch with the PR that is sort of a combination between our two fixes.

That is I do what you did and display something, I use the font you mentioned, but instead of drawing the text page, I draw centered text telling user that the system font is only usable in rotation 0...



Code:
void loop()
{
  Serial.printf("\nRotation: %d\n", test_screen_rotation);
  tft.setRotation(test_screen_rotation);
  tft.fillScreen(RED);
  tft.setCursor(tft.width() / 2, tft.height() / 2, true);
  tft.printf("Rotation: %d", test_screen_rotation);
  test_screen_rotation = (test_screen_rotation + 1) & 0x3;
  tft.setCursor(200, 300);
  Serial.printf("  Set cursor(200, 300), retrieved(%d %d)",
                tft.getCursorX(), tft.getCursorY());
  tft.setCursor(50, 50);
  tft.write('0');
  tft.setCursor(tft.width() - 50, 50);
  tft.write('1');
  tft.setCursor(50, tft.height() - 50);
  tft.write('2');
  tft.setCursor(tft.width() - 50, tft.height() - 50);
  tft.write('3');

  for (uint8_t font_index = 0; font_index < (sizeof(font_test_list) / sizeof(font_test_list[0])); font_index++) {
    nextPage();
    if (font_test_list[font_index].font_fg_color != font_test_list[font_index].font_bg_color)
      tft.setTextColor(font_test_list[font_index].font_fg_color, font_test_list[font_index].font_bg_color);
    else
      tft.setTextColor(font_test_list[font_index].font_fg_color);
    if (font_test_list[font_index].ili_font) tft.setFont(*font_test_list[font_index].ili_font);
    else if (font_test_list[font_index].gfx_font)  tft.setFont(font_test_list[font_index].gfx_font);
    else if (test_screen_rotation != 1) {
      tft.setFont(Chancery_24_Italic);
      tft.setTextColor(GREEN);
      tft.println(font_test_list[font_index].font_name);
      tft.setCursor(CENTER, CENTER);
      tft.println("*** Only works in Rotation 0 ***");
      continue;  // only on Page 0
    }
    else  tft.setFontDef();
    tft.println(font_test_list[font_index].font_name);
    displayStuff1();
  }
  nextPage();
}
See what you think
 
@kurtE, @mjs513, @blakketter - I did the pull requests. I have not had the time to test yet. I have to back up the original library locally because of the the issues with the scroll function that I fixed and a couple of other issues that I cannot remember now. Then I can download and test the PR's. Running "ILI_GFX_FontTest.ino" did not work to completion with Ardunio 8.13 and TD 1.53. It worked with Arduino 8.12 and TD 1.52 to completion. This was before the latest PR's. Things at this point are not working well but will will test withe latest PR's.
 
@mjs513 and ...

I pushed up a version to my branch with the PR that is sort of a combination between our two fixes.

That is I do what you did and display something, I use the font you mentioned, but instead of drawing the text page, I draw centered text telling user that the system font is only usable in rotation 0...


...See what you think

Sorry didn't get back to you yesterday was kind of out of - think the heat got to me. Any will give it a try but from what I can see not a issue. Glad you did the PR.

@wwatson - going to go through the other examples today as well. To be honest that LI_GFX_FontTest.ino sketch should probably be deleted it was an original debug test sketch.
 
@wwatson - @KurtE - @blakketter

@wwatson = looks like you incorporated @blakketter PR after @KurtE's PR. Since some of the GFX font fixes were not captured correctly.
@blakketter = @wwatson = was testing the new changes with PipTest and Scroll and there are problems. With scroll for instance, everytime it scrolls it looses a line of text and disappears completely for awhile then repeats and no status bar shows. With PipTest it doesn't seem to understand Screen_1 etc anymore so does not run. Can't really debug the issues since i dont have one of the landscape displays so for me going to revert to using the current version I have without the @blakketter changes.
 
@wwatson - @KurtE - @blakketter

@wwatson = looks like you incorporated @blakketter PR after @KurtE's PR. Since some of the GFX font fixes were not captured correctly.
@blakketter = @wwatson = was testing the new changes with PipTest and Scroll and there are problems. With scroll for instance, everytime it scrolls it looses a line of text and disappears completely for awhile then repeats and no status bar shows. With PipTest it doesn't seem to understand Screen_1 etc anymore so does not run. Can't really debug the issues since i dont have one of the landscape displays so for me going to revert to using the current version I have without the @blakketter changes.

I done a bad thing again didn't I? Can I revert back to my original library through GitHub or do I need to upload my working version of it and then go from there?
Sorry for any inconvenience I probably caused:(
Thanks
 
Decided to upload my working version. Please let me know if things are working correctly. Then I will do pull requests. Everything you guys have done is working on my display with all examples. No lockups or problems😀
 
Back
Top