KurtE / ILI9341_t3n

Extended ILI9341_T3 library (Teensy) including all SPI buses, Frame buffer, plus
MIT License
50 stars 23 forks source link

Font Test Examples Broken #37

Closed paynterf closed 3 years ago

paynterf commented 3 years ago

It appears that the ILI_Ada_FontTest3, ILI_Ada_FontTest4 (at least) are completely broken. I was able to make a very rudimentary example work by modifying

#include "font_Arial.h"

to

#include "ili9341_t3n_font_Arial.h"

Here's my code for a one-font example:

#include <Adafruit_GFX.h>

#include <SPI.h>
#include <ILI9341_t3n.h>

#include "ili9341_t3n_font_Arial.h"

#define CENTER ILI9341_t3n::CENTER

// *************** Change to your Pin numbers ***************
#define TFT_DC  9
#define TFT_CS 10
#define TFT_RST 7
#define TFT_SCK 13
#define TFT_MISO 12
#define TFT_MOSI 11
#define TOUCH_CS  6

ILI9341_t3n tft = ILI9341_t3n(TFT_CS, TFT_DC, TFT_RST, TFT_MOSI, TFT_SCK, TFT_MISO);

uint8_t test_screen_rotation = 0;

void setup() {
  Serial.begin(38400);
  long unsigned debug_start = millis();
  while (!Serial && ((millis() - debug_start) <= 5000));
  Serial.println("Setup");
  tft.begin();

  tft.fillWindow(ILI9341_BLACK);
  tft.setRotation(1);

  tft.setTextColor(ILI9341_WHITE);
  tft.setFont(Arial_20);
  tft.println("Arial_20");
  displayStuff();

}

void loop()
{
}

uint32_t displayStuff()
{
  elapsedMillis elapsed_time = 0;
  tft.println("ABCDEFGHIJKLM");
  tft.println("nopqrstuvwxyz");
  tft.println("0123456789");
  tft.println("!@#$%^ &*()-");
  tft.println(); tft.println();
  return (uint32_t)elapsed_time;
}

I'd be happy to modify the examples as required and submit pull requests if you are OK with that

Frank

KurtE commented 3 years ago

Hi @paynterf (and @mjs513 )

Not sure what the font example is broken means? Does not work? Does not Compile?

That is I just tried the Fonttest4 on my machine with just editing the pin number for CS...

Again not sure if the issue is it does not build?

If so may depend on what other libraries you have or don't have installed.

I believe with these tests we were setup using the font library: https://github.com/mjs513/ILI9341_fonts

We were trying to setup this code to be able to use font files from different places. Problem is that each one defines their own header files which bring in their code base as well.

But I could be forgetting something.

mjs513 commented 3 years ago

@paynterf (and @KurtE) I just ran both fonttest3 and font_test4. Both are working for me with one exception. Think the font sizes in font_test3 are probably too large. But it is displaying text correctly.

@KurtE is correct you will need to download the font library: https://github.com/mjs513/ILI9341_fonts for the examples to work properly. Otherwise you will have to change the font names as you discovered.

@KurtE's explanation is correct. The font library is set up so you can use it with any of the display libraries - ILI9341, ILI9488 and HX8357 for example.

paynterf commented 3 years ago

Hmm,

It wouldn't compile for me at all with the ili9341_t3n library loaded; the font libraries weren't found. When I modified the code to use the ili9341t3n font libraries like this::

#include <Adafruit_GFX.h>

#include <SPI.h>
#include <ILI9341_t3n.h>

#include "ili9341_t3n_font_Arial.h"
#include "ili9341_t3n_font_ArialBold.h"
#include "ili9341_t3n_font_ComicSansMS.h"
#include "ili9341_t3n_font_OpenSans.h"

Then it would work. After making these changes (and removing the fonts that weren't available), I got this display

IMG_4079

Which looks a bit strange, but maybe that's what you were after?

Frank

mjs513 commented 3 years ago

Did you download the fonts library (https://github.com/mjs513/ILI9341_fonts) and put it in your arduino libraries folder?

Almost - should see the over writing of fonts with the boxes - its suppose to clear screen after you hit return.

KurtE commented 3 years ago

What were the compile errors?

Are you using the latest released other libraries like ili9341_t3 or for example do you have an older one in your /libraries folder.

Why this might matter. Is some of these libraries were updated, for the compiler to generate an archive which gets included with the build instead of individual binaries. This can help as only those things in the archive which have been referenced will be included, which can help reduce the number of duplicate symbols or the like.

paynterf commented 3 years ago

Might want to put a note in the ReadMe to the effect that the extra font library is required?

paynterf commented 3 years ago

ILI_Ada_FontTest3.ino compiles and runs fine after installing the extra fonts library

KurtE commented 3 years ago

Thanks,

I put int a quick note in the Readme, in the font section.

From: Frank Paynter @.> Sent: Friday, March 12, 2021 11:10 AM To: KurtE/ILI9341_t3n @.> Cc: KurtE @.>; State change @.> Subject: Re: [KurtE/ILI9341_t3n] Font Test Examples Broken (#37)

Might want to put a note in the ReadMe to the effect that the extra font library is required?

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/KurtE/ILI9341_t3n/issues/37#issuecomment-797692720 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AAL4MQGCJXJREG3GYD3CPXTTDJKF7ANCNFSM4Y4D6L7A . https://github.com/notifications/beacon/AAL4MQGUY7ACFD25PKNXM43TDJKF7A5CNFSM4Y4D6L7KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOF6F5GMA.gif

paynterf commented 3 years ago

Just read it - very nice!

KurtE commented 3 years ago

I will go ahead and close for now