@@ -53,41 +53,60 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
5353#define PROGMEM __attribute__ ((section(" .progmem.data" )))
5454#endif
5555
56- // Add header of the fonts here. Comment as many as possible to conserve FLASH memory.
57- #include " util/font5x7.h" // Comment this line if you do not need the 5x7 font
58- #include " util/font8x16.h" // Comment this line if you do not need the 8x16 font
59- #include " util/fontlargenumber.h" // Comment this line if you do not need the large number font
60- #include " util/7segment.h" // Comment this line if you do not need the 7segment font
61- // The 31x48 font is handy, but uses a big chunk of flash memory - about 7k.
62- // If you want to use this font, uncomment the line below:
63- // #include "util/fontlargeletter31x48.h"
56+ // Add header of the fonts here. Fonts that aren't included below are
57+ // eliminated by the compiler.
58+ #include " util/font5x7.h"
59+ #include " util/font8x16.h"
60+ #include " util/fontlargenumber.h"
61+ #include " util/7segment.h"
62+ #include " util/fontlargeletter31x48.h"
6463
6564#define MAXFONTS 5 // Do not change this line
6665
66+ // To save flash memory, change these to zeros for the fonts you do
67+ // not want. In particular, the 31x48 font is handy, but uses a big
68+ // chunk of flash memory - about 7k. It is excluded by default.
69+ #ifndef INCLUDE_FONT_5x7
70+ #define INCLUDE_FONT_5x7 1
71+ #endif
72+ #ifndef INCLUDE_FONT_8x16
73+ #define INCLUDE_FONT_8x16 1
74+ #endif
75+ #ifndef INCLUDE_FONT_7SEG
76+ #define INCLUDE_FONT_7SEG 1
77+ #endif
78+ #ifndef INCLUDE_FONT_LARGENUMBER
79+ #define INCLUDE_FONT_LARGENUMBER 1
80+ #endif
81+ #ifndef INCLUDE_FONT_LARGELETTER
82+ #define INCLUDE_FONT_LARGELETTER 0
83+ #endif
84+
85+
6786// Add the font name as declared in the header file. Remove as many
6887// as possible to conserve FLASH memory.
6988const unsigned char *MicroOLED::fontsPointer[] = {
70- #ifdef FONT5X7_H
89+ #if INCLUDE_FONT_5x7
7190 font5x7,
7291#else
7392 0x0 ,
7493#endif
75- #ifdef FONT8X16_H
94+ #if INCLUDE_FONT_8x16
7695 font8x16,
7796#else
7897 0x0 ,
7998#endif
80- #ifdef FONT7SEGMENT_H
99+ #if INCLUDE_FONT_7SEG
81100 sevensegment,
82101#else
83102 0x0 ,
84103#endif
85- #ifdef FONTLARGENUMBER_H
104+ #if INCLUDE_FONT_LARGENUMBER
86105 fontlargenumber,
87106#else
88107 0x0 ,
89108#endif
90- #ifdef FONTLARGELETTER31X48_H
109+ #if INCLUDE_FONT_LARGELETTER
91110 fontlargeletter31x48
92111#else
93112 0x0
0 commit comments