File tree Expand file tree Collapse file tree 1 file changed +26
-9
lines changed Expand file tree Collapse file tree 1 file changed +26
-9
lines changed Original file line number Diff line number Diff line change @@ -63,18 +63,35 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
63
63
#include " util/fontlargeletter31x48.h"
64
64
65
65
// Change the total fonts included
66
- #ifdef INCLUDE_LARGE_LETTER_FONT
67
66
#define TOTALFONTS 5
68
- #else
69
- #define TOTALFONTS 4
70
- #endif
71
67
72
- // Add the font name as declared in the header file. Remove as many as possible to conserve FLASH memory.
68
+ // Add the font name as declared in the header file. Remove as many
69
+ // as possible to conserve FLASH memory.
73
70
const unsigned char *MicroOLED::fontsPointer[] = {
74
- font5x7, font8x16, sevensegment, fontlargenumber
71
+ #if INCLUDE_FONT0
72
+ font5x7,
73
+ #else
74
+ 0x0 ,
75
+ #endif
76
+ #if INCLUDE_FONT1
77
+ font8x16,
78
+ #else
79
+ 0x0 ,
80
+ #endif
81
+ #if INCLUDE_FONT2
82
+ sevensegment,
83
+ #else
84
+ 0x0 ,
85
+ #endif
86
+ #if INCLUDE_FONT3
87
+ fontlargenumber,
88
+ #else
89
+ 0x0 ,
90
+ #endif
75
91
#ifdef INCLUDE_LARGE_LETTER_FONT
76
- ,
77
92
fontlargeletter31x48
93
+ #else
94
+ 0x0
78
95
#endif
79
96
};
80
97
@@ -1015,8 +1032,8 @@ uint8_t MicroOLED::getFontType(void)
1015
1032
*/
1016
1033
uint8_t MicroOLED::setFontType (uint8_t type)
1017
1034
{
1018
- if ((type >= TOTALFONTS) || ( type < 0 ) )
1019
- return false ;
1035
+ if ((type >= TOTALFONTS) || !fontsPointer[ type] )
1036
+ return false ;
1020
1037
1021
1038
fontType = type;
1022
1039
fontWidth = pgm_read_byte (fontsPointer[fontType] + 0 );
You can’t perform that action at this time.
0 commit comments