@@ -53,63 +53,66 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
53
53
#define PROGMEM __attribute__ ((section(" .progmem.data" )))
54
54
#endif
55
55
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"
63
-
64
- #define MAXFONTS 5 // Do not change this line
65
-
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
56
+ // Add header of the fonts here.
57
+ // Fonts that aren't included the section below are excluded by the compiler.
58
+ #include " util/font5x7.h" // Font 0
59
+ #include " util/font8x16.h" // Font 1
60
+ #include " util/7segment .h" // Font 2
61
+ #include " util/fontlargenumber .h" // Font 3
62
+ #include " util/fontlargeletter31x48.h" // Font 4 (excluded by default - see below)
63
+
64
+ #define MAXFONTS 5 // Do not change this line - except when _adding_ new fonts
65
+
66
+ // To save flash memory, change these to zeros for the fonts you want to exclude.
67
+ // In particular, the 31x48 font is handy, but uses a big
68
68
// chunk of flash memory - about 7k. It is excluded by default.
69
+ //
70
+ // If you are compiling the code using your own makefile, you can use compiler flags to include
71
+ // or exclude individual fonts. E.g.: -DINCLUDE_FONT_LARGELETTER=1 or -DINCLUDE_FONT_LARGENUMBER=0
69
72
#ifndef INCLUDE_FONT_5x7
70
- #define INCLUDE_FONT_5x7 1
73
+ #define INCLUDE_FONT_5x7 1 // Change this to 0 to exclude the 5x7 font
71
74
#endif
72
75
#ifndef INCLUDE_FONT_8x16
73
- #define INCLUDE_FONT_8x16 1
76
+ #define INCLUDE_FONT_8x16 1 // Change this to 0 to exclude the 8x16 font
74
77
#endif
75
78
#ifndef INCLUDE_FONT_7SEG
76
- #define INCLUDE_FONT_7SEG 1
79
+ #define INCLUDE_FONT_7SEG 1 // Change this to 0 to exclude the seven segment font
77
80
#endif
78
81
#ifndef INCLUDE_FONT_LARGENUMBER
79
- #define INCLUDE_FONT_LARGENUMBER 1
82
+ #define INCLUDE_FONT_LARGENUMBER 1 // Change this to 0 to exclude the large number font
80
83
#endif
81
84
#ifndef INCLUDE_FONT_LARGELETTER
82
- #define INCLUDE_FONT_LARGELETTER 0
85
+ #define INCLUDE_FONT_LARGELETTER 0 // Change this to 1 to include the large letter font
83
86
#endif
84
87
85
88
86
- // Add the font name as declared in the header file. Remove as many
87
- // as possible to conserve FLASH memory.
89
+ // Add the font name as declared in the header file.
90
+ // Exclude as many as possible to conserve FLASH memory.
88
91
const unsigned char *MicroOLED::fontsPointer[] = {
89
92
#if INCLUDE_FONT_5x7
90
93
font5x7,
91
94
#else
92
- 0x0 ,
95
+ NULL ,
93
96
#endif
94
97
#if INCLUDE_FONT_8x16
95
98
font8x16,
96
99
#else
97
- 0x0 ,
100
+ NULL ,
98
101
#endif
99
102
#if INCLUDE_FONT_7SEG
100
103
sevensegment,
101
104
#else
102
- 0x0 ,
105
+ NULL ,
103
106
#endif
104
107
#if INCLUDE_FONT_LARGENUMBER
105
108
fontlargenumber,
106
109
#else
107
- 0x0 ,
110
+ NULL ,
108
111
#endif
109
112
#if INCLUDE_FONT_LARGELETTER
110
113
fontlargeletter31x48
111
114
#else
112
- 0x0
115
+ NULL
113
116
#endif
114
117
};
115
118
@@ -1035,7 +1038,7 @@ uint8_t MicroOLED::getTotalFonts(void)
1035
1038
uint8_t totalFonts = 0 ;
1036
1039
for (uint8_t thisFont = 0 ; thisFont < MAXFONTS; thisFont++)
1037
1040
{
1038
- if (fontsPointer[thisFont] > 0 )
1041
+ if (fontsPointer[thisFont] != NULL )
1039
1042
totalFonts++;
1040
1043
}
1041
1044
return (totalFonts);
@@ -1056,7 +1059,7 @@ uint8_t MicroOLED::getFontType(void)
1056
1059
*/
1057
1060
uint8_t MicroOLED::setFontType (uint8_t type)
1058
1061
{
1059
- if ((type >= MAXFONTS) || ! fontsPointer[type])
1062
+ if ((type >= MAXFONTS) || ( fontsPointer[type] == NULL ) )
1060
1063
return false ;
1061
1064
1062
1065
fontType = type;
0 commit comments