Hello,
My 1.27" OLED display had been using a version of Adafruit_GFX.h included within "libraries\TFT\src\utility". Hoping to change the font found a newer version of the GFX as per [url]
// https://learn.adafruit.com/adafruit-gfx ... sing-fonts
[/url].
My sketch compiles fine and I am able to set a font in code as per GFX examples above but the display no longer "works" (black screen) with new library.
Relevant Includes are as follows:
#include <gfxfont.h>
#include <Adafruit_GFX.h> (new one, same name as old one....)
#include <Adafruit_SSD1351.h>
#include <SPI.h>
Any ideas appreciated....
Thank you!
Marc
Setting Font on SSD1351 OLED with latest Adafruit_GFX.h
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
-
- Posts: 28
- Joined: Wed Jan 16, 2013 6:57 pm
- adafruit_support_mike
- Posts: 67485
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Setting Font on SSD1351 OLED with latest Adafruit_GFX.h
It doesn't look like you've included a header that contains a font definition.
Take a look at the GFX tutorial's section on fonts and see if that helps:
https://learn.adafruit.com/adafruit-gfx ... sing-fonts
Take a look at the GFX tutorial's section on fonts and see if that helps:
https://learn.adafruit.com/adafruit-gfx ... sing-fonts
-
- Posts: 28
- Joined: Wed Jan 16, 2013 6:57 pm
Re: Setting Font on SSD1351 OLED with latest Adafruit_GFX.h
Thank you for the idea - I had the font includes commented out and have since un-commented and recompiled.
There seems to be something else going on.... there is still no life whatsoever in the display. I'd think that there would be a default system font working too?
Graphics operations also stopped working after adding the new GFX library.... tft.fillRect for example shows no output.
Includes with fonts:
#include <gfxfont.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1351.h>
#include <Fonts/FreeMonoBoldOblique12pt7b.h>
#include <Fonts/FreeSerif9pt7b.h>
Weird thing is everything compiles just fine.
Any other troubleshooting ideas greatly appreciated!
There seems to be something else going on.... there is still no life whatsoever in the display. I'd think that there would be a default system font working too?
Graphics operations also stopped working after adding the new GFX library.... tft.fillRect for example shows no output.
Includes with fonts:
#include <gfxfont.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1351.h>
#include <Fonts/FreeMonoBoldOblique12pt7b.h>
#include <Fonts/FreeSerif9pt7b.h>
Weird thing is everything compiles just fine.
Any other troubleshooting ideas greatly appreciated!
- adafruit_support_mike
- Posts: 67485
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Setting Font on SSD1351 OLED with latest Adafruit_GFX.h
Post your entire sketch please. Just looking at the #includes doesn't tell us much.
-
- Posts: 28
- Joined: Wed Jan 16, 2013 6:57 pm
Re: Setting Font on SSD1351 OLED with latest Adafruit_GFX.h
It seems that something must have loading out of order?
When I created a simple test sketch to upload here it [of course] works! I modified my more complex sketch to include libraries in the below order and every works properly there now as well. The odd thing is it compiles happily either way.
Here is the working sketch on the SSD1351 OLED display along with some explanation:
Thank you!
When I created a simple test sketch to upload here it [of course] works! I modified my more complex sketch to include libraries in the below order and every works properly there now as well. The odd thing is it compiles happily either way.
Here is the working sketch on the SSD1351 OLED display along with some explanation:
Code: Select all
#define sclk 2
#define mosi 3
#define dc 4
#define cs 5
#define rst 6
// Color definitions
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF
#define GREY 0x808080
#define DARK_ORANGE 0xE46C0A
///////////////////////////////////////////////// SCENARIO 1 ///////////////////////
// USES files provided on product page.... header file is under tft/utility folder
//
//#include <Adafruit_GFX.h>
//#include <Adafruit_SSD1351.h>
//
// To test we must comment section 2, remove the newer folder referenced below from Libraries and restart this IDE
//
///////////////////////////////////////////////// SCENARIO 1 ///////////////////////
///////////////////////////////////////////////// SCENARIO 2 ///////////////////////
// Uses the newer GFX library found on github. Path is under libraries is libraries/Adafruit-GFX-Library-master/Adafruit_GFX.h
//
#include <gfxfont.h>
#include <Fonts/FreeMonoBoldOblique12pt7b.h>
#include <Fonts/FreeSerif9pt7b.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1351.h>
//
// to test ensure above folder in place, restart IDE if necessary, comment section 1
//
///////////////////////////////////////////////// SCENARIO 1 ///////////////////////
Adafruit_SSD1351 tft = Adafruit_SSD1351(cs, dc, rst);
void setup(void) {
tft.begin();
tftPrintHello();
}
void tftPrintHello() {
tft.fillRect(0, 14, 60, 25, BLUE);
tft.setCursor(0, 20);
tft.setTextColor(GREEN);
tft.setTextSize(3);
tft.print("This is a test");
}
void loop ()
{}
Last edited by adafruit_support_mike on Mon May 08, 2017 2:02 am, edited 1 time in total.
Reason: added CODE tags
Reason: added CODE tags
- adafruit_support_mike
- Posts: 67485
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Setting Font on SSD1351 OLED with latest Adafruit_GFX.h
Aside from needing font headers, I'm not sure anything has dependencies that require the headers be loaded in a specific order. Try changing the order of the lines in the block of #includes that work, and see if you can find a repeatable pattern that makes them break.
-
- Posts: 28
- Joined: Wed Jan 16, 2013 6:57 pm
Re: Setting Font on SSD1351 OLED with latest Adafruit_GFX.h
The original sketch where this occurred was far more complex (and running on a MEGA).... If I am able to reproduce this I will share the details in the event it is helpful to others.
The important thing here is that we know this combination works just fine with the newer library despite the docs perhaps lagging a bit behind.
Thanks again for the great support.
The important thing here is that we know this combination works just fine with the newer library despite the docs perhaps lagging a bit behind.
Thanks again for the great support.
- adafruit_support_mike
- Posts: 67485
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Setting Font on SSD1351 OLED with latest Adafruit_GFX.h
Glad to hear it's working for you. Happy hacking!
- Vinida001
- Posts: 1
- Joined: Tue Aug 29, 2017 5:54 am
Re: Setting Font on SSD1351 OLED with latest Adafruit_GFX.h
I have no idea.
Please be positive and constructive with your questions and comments.