You have 256KB available, you're using less than 1/4.
Wow, this is a very long thread and I confess not having read it in its entirety. The fonts are great and work well with both the 2.2 and 2.8 inch displays from PJRC. They do take a lot of memory though, especially when the larger ones are being used.
In my case I am using only font_LiberationSansNarrowBold and have restricted it to 4 sizes. Still the combined memory hit was about 50 K for the sizes 12, 16, 48 and 96. I am using the small ones to display some descriptions and explanations, i.e. letters are used but the big ones only display numbers - measurements and parameters. This may be the case for many applications not just mine.
Large memory saving could be achieved, if numerics (in my case just numbers and a decimal) would be available as a separate library, which could be called font_LiberationSansNarrowBoldNumbers as an example.
Thanks for your note, it is what I was referring to. That is even more memory savings than I expected. However I am using the Liberation Narrow Bold font, it fits just the right amount of digits at 96 point size. I have not tried a conversion on my Mac, but having just digits would be a good feature overall.
..............libraries/ILI9341_fonts-master/font_LiberationSansNarrow-Bold_Digits.h:1:46: warning: extra tokens at end of #ifndef directive [enabled by default]
#ifndef _ILI9341_t3_font_LiberationSansNarrow-Bold_Digits_
^
...............libraries/ILI9341_fonts-master/font_LiberationSansNarrow-Bold_Digits.h:2:46: warning: ISO C99 requires whitespace after the macro name [enabled by default]
#define _ILI9341_t3_font_LiberationSansNarrow-Bold_Digits_
I added Zach Archer's amazing DemoSauce animation to the ILI9341_t3 library.
https://github.com/PaulStoffregen/ILI9341_t3/tree/master/examples/DemoSauce
Arduino: 1.6.6 (Windows 7), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"
For Arduino Mega, you have to use Adafruit's (slow) library.
The optimized ILI9341_t3 lib only works on Teensy 3.x. It doesn't even work on Teensy LC or 2.0. The optimizations use the FIFO and chip select hardware on Teensy 3.0, 3.1, 3.2. No other boards are supported.
Thanks for the quick reply, is there any other library that supports different fonts for this controller?
I can upload the sourcecode if anyone wants it...
Hi Paul,
hopefully the code below will help.
The bug shows whether or not I add 2.2K pull up resistors to the CS lines of the TFT display and of the EEPROM in your audio shield.
The first incarnation of the bug shows up performing a simple flash_read_id(id_tab), i think this is really all you need.
You would need to pre-load the first few bytes of the EEPROM if you want to see the second manifestation of the bug - which I think is the same bug, still related to a read function.
I did not test writing to EEPROM while using ILI9341
While I am able to get going with the project, I already miss the speed of ILI9341_t3 ....
Thank you
alfa66
//#include "Adafruit_GFX.h"
//#include "Adafruit_ILI9341.h"
#include "ILI9341_t3.h"
#include "flash_spi.h"
#include "SPI.h"
#define PAGE 256 //dimension of 1 EEPROM page (in bytes)
unsigned char buf2[PAGE]; // we are using this buffer for reading from the EEPROM
unsigned char id_tab[32];
// Set DC and CS, no conflict with Paul's Audio Adapter
#define TFT_DC 20
#define TFT_CS 21
// Use hardware SPI and the above for CS/DC. Reset is tied to 3.3V, no need for a 3rd pin
ILI9341_t3 tft = ILI9341_t3(TFT_CS, TFT_DC);
//Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
void setup() {
Serial.begin(19200);
while (!Serial) {;}
// Needed when using ILI9341 with the Audio Board, also needed for reading W25Q128
SPI.setMOSI(7);
SPI.setSCK(14);
tft.begin();
// About the following line
// if not commented out and compiled with t3 library, we miss reading the id_tab correctly. Also we miss reading the first byte on the first page
// if it is commented out it works fine
// It also works if not commented out and compiled with the Adafruit version of ILI9341
//tft.drawLine( 0, 0, 100, 100, ILI9341_YELLOW);
flash_init();
int flashstatus = flash_read_status();
flash_read_id(id_tab);
Serial.printf("Flash Status: 0x%X, ID:0x%X,0x%X,0x%X,0x%X ", flashstatus , id_tab[0], id_tab[1], id_tab[2], id_tab[3]);
if (id_tab[0]!=0xef || id_tab[1]!=0x40 || id_tab[2]!=0x18 || id_tab[3]!=0x00)
{Serial.println(" is not ok."); goto end;}
else Serial.println("");
end:
// this is what caused the buzz sound in my code. The first byte of page 0 always reads zero
// you would have to pre-load the first page of the EEPROM to check on this one
// I used Frank B code SD2SerialFlash to pre-load the EEPROM
flash_read_pages(buf2, 0, 1);
for (int i=0; i<PAGE; i++) {
Serial.print(buf2, HEX);
Serial.print(" ");
}
Serial.println("Done");
}
void loop(void) {
int i;
}
// Needed when using ILI9341 with the Audio Board, also needed for reading W25Q128
SPI.setMOSI(7);
SPI.setSCK(14);
ILI9341_t3 tft = ILI9341_t3(TFT_CS, TFT_DC);
#define TFT_DC 20
#define TFT_CS 21
#define TFT_RST 255 // 255 = unused, connect to 3.3V
#define TFT_MOSI 7
#define TFT_SCLK 14
#define TFT_MISO 12
ILI9341_t3 tft = ILI9341_t3(TFT_CS, TFT_DC, TFT_RST, TFT_MOSI, TFT_SCLK, TFT_MISO);
Hey Guys,
I was just wondering if there is a way to either force the new fonts to display as fixed width or when they are generated, adjust the parameters so they are a fixed width font?
The new fonts work really well just the fixed width is kind of tripping me up.
Cheers