From be478fd0b31f1eee379fa113e2a9706beae89dd2 Mon Sep 17 00:00:00 2001 From: Stuart Blair <47907842+smurf0969@users.noreply.github.com> Date: Tue, 12 Mar 2019 20:55:12 +0000 Subject: [PATCH 1/6] Update OLEDDisplay.h Added a global to allow changing of the default font --- src/OLEDDisplay.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/OLEDDisplay.h b/src/OLEDDisplay.h index ddf80bd..bb2d83d 100644 --- a/src/OLEDDisplay.h +++ b/src/OLEDDisplay.h @@ -34,6 +34,10 @@ #include #include "OLEDDisplayFonts.h" +#ifndef OLEDDISPLAY_DEFAULTFONT +#define OLEDDISPLAY_DEFAULTFONT ArialMT_Plain_10 +#endif + //#define DEBUG_OLEDDISPLAY(...) Serial.printf( __VA_ARGS__ ) #ifndef DEBUG_OLEDDISPLAY @@ -278,7 +282,7 @@ class OLEDDisplay : public Print { OLEDDISPLAY_TEXT_ALIGNMENT textAlignment = TEXT_ALIGN_LEFT; OLEDDISPLAY_COLOR color = WHITE; - const uint8_t *fontData = ArialMT_Plain_10; + const uint8_t *fontData = OLEDDISPLAY_DEFAULTFONT; // State values for logBuffer uint16_t logBufferSize = 0; From 8ca8f0c9ca0c1b2e78c8509a6eed814af9f137c4 Mon Sep 17 00:00:00 2001 From: Stuart Blair <47907842+smurf0969@users.noreply.github.com> Date: Tue, 12 Mar 2019 20:59:49 +0000 Subject: [PATCH 2/6] Update OLEDDisplayUi.h Changed setFont to use global OLEDDISPLAY_DEFAULTFONT --- src/OLEDDisplayUi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OLEDDisplayUi.h b/src/OLEDDisplayUi.h index 2cabf30..0f0e35a 100644 --- a/src/OLEDDisplayUi.h +++ b/src/OLEDDisplayUi.h @@ -145,7 +145,7 @@ class OLEDDisplayUi { // Loading screen LoadingDrawFunction loadingDrawFunction = [](OLEDDisplay *display, LoadingStage* stage, uint8_t progress) { display->setTextAlignment(TEXT_ALIGN_CENTER); - display->setFont(ArialMT_Plain_10); + display->setFont(OLEDDISPLAY_DEFAULTFONT); display->drawString(64, 18, stage->process); display->drawProgressBar(4, 32, 120, 8, progress); }; From eaec1941258aab1af66d4512795dedf1bab66f03 Mon Sep 17 00:00:00 2001 From: Stuart Blair <47907842+smurf0969@users.noreply.github.com> Date: Tue, 12 Mar 2019 21:24:19 +0000 Subject: [PATCH 3/6] Update README.md --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 4f04d4e..c2276d9 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,11 @@ Going from 3.x version to 4.0 a lot of internals changed and compatibility for m Fonts are defined in a proprietary but open format. You can create new font files by choosing from a given list of open sourced Fonts from this web app: http://oleddisplay.squix.ch Choose the font family, style and size, check the preview image and if you like what you see click the "Create" button. This will create the font array in a text area form where you can copy and paste it into a new or existing header file. +```C++ +#include "YOUR_FONT.h" +#define OLEDDISPLAYFONTS_h //Exclude the default fonts file if not required to save memory +#define OLEDDISPLAY_DEFAULTFONT YOUR_FONT_ARRAY //Change the default ArialMT_Plane_10 to your own choice of font +``` ![FontTool](https://github.com/squix78/esp8266-oled-ssd1306/raw/master/resources/FontTool.png) From 0574db7b2e22d5d4aedbaea74796f1ece4b108f9 Mon Sep 17 00:00:00 2001 From: Stuart Blair <47907842+smurf0969@users.noreply.github.com> Date: Fri, 15 Mar 2019 13:13:24 +0000 Subject: [PATCH 4/6] Update OLEDDisplay.h Changes due to travis ci warnings --- src/OLEDDisplay.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/OLEDDisplay.h b/src/OLEDDisplay.h index bb2d83d..1866dec 100644 --- a/src/OLEDDisplay.h +++ b/src/OLEDDisplay.h @@ -122,8 +122,8 @@ class OLEDDisplay : public Print { public: virtual ~OLEDDisplay(); - const uint16_t width(void) const { return displayWidth; }; - const uint16_t height(void) const { return displayHeight; }; + const uint16_t width(void) { return displayWidth; }; + const uint16_t height(void) { return displayHeight; }; // Initialize the display bool init(); From e89614138af571ae05bbcb1fea247b61f30ee455 Mon Sep 17 00:00:00 2001 From: Stuart Blair <47907842+smurf0969@users.noreply.github.com> Date: Fri, 15 Mar 2019 13:44:14 +0000 Subject: [PATCH 5/6] Update OLEDDisplay.cpp --- src/OLEDDisplay.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/OLEDDisplay.cpp b/src/OLEDDisplay.cpp index 2c0c72a..7edaa3d 100644 --- a/src/OLEDDisplay.cpp +++ b/src/OLEDDisplay.cpp @@ -647,11 +647,11 @@ void OLEDDisplay::drawLogBuffer(uint16_t xMove, uint16_t yMove) { } } -uint16_t OLEDDisplay::getWidth(void) { +uint16_t OLEDDisplay::getWidth() { return displayWidth; } -uint16_t OLEDDisplay::getHeight(void) { +uint16_t OLEDDisplay::getHeight() { return displayHeight; } From 7bffed0396b0e7183a60ed3880b30444287ea190 Mon Sep 17 00:00:00 2001 From: Stuart Blair <47907842+smurf0969@users.noreply.github.com> Date: Fri, 15 Mar 2019 13:45:32 +0000 Subject: [PATCH 6/6] Update OLEDDisplay.h --- src/OLEDDisplay.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/OLEDDisplay.h b/src/OLEDDisplay.h index 1866dec..f6c505c 100644 --- a/src/OLEDDisplay.h +++ b/src/OLEDDisplay.h @@ -255,8 +255,8 @@ class OLEDDisplay : public Print { void drawLogBuffer(uint16_t x, uint16_t y); // Get screen geometry - uint16_t getWidth(void); - uint16_t getHeight(void); + uint16_t getWidth(); + uint16_t getHeight(); // Implement needed function to be compatible with Print class size_t write(uint8_t c);