Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Font Test Examples Broken #37

Closed
paynterf opened this issue Mar 9, 2021 · 10 comments
Closed

Font Test Examples Broken #37

paynterf opened this issue Mar 9, 2021 · 10 comments

Comments

@paynterf
Copy link

paynterf commented Mar 9, 2021

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
Copy link
Owner

KurtE commented Mar 11, 2021

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
Copy link
Contributor

mjs513 commented Mar 11, 2021

@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
Copy link
Author

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 ili9341_t3n_ 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
Copy link
Contributor

mjs513 commented Mar 12, 2021

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
Copy link
Owner

KurtE commented Mar 12, 2021

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.

@KurtE KurtE closed this as completed Mar 12, 2021
@KurtE KurtE reopened this Mar 12, 2021
@paynterf
Copy link
Author

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

@paynterf
Copy link
Author

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

@KurtE
Copy link
Owner

KurtE commented Mar 12, 2021 via email

@paynterf
Copy link
Author

Just read it - very nice!

@KurtE
Copy link
Owner

KurtE commented Mar 13, 2021

I will go ahead and close for now

@KurtE KurtE closed this as completed Mar 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants