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