Replies: 2 comments 1 reply
-
First it is important to use the font which includes just the glyphs required for your project, but "tr" is probably a good choice for your project. U8g2 already removes unused functions. For example, the circle draw functions are not included, because you don't call them. There are still some optimizations possible, please have a look into u8g2.h for this. There are pros and cons for this, but for example if you don't require font rotation, then you could save some bytes by commenting the corresponding define: Lines 124 to 131 in b42953b |
Beta Was this translation helpful? Give feedback.
-
Hello olikraus, I have another question which could fit in this topic: I like to add 3 letters into the type u8g2_font_helvB24_tn. With this knowledge I could also reduce the size of some used fonts. Have a great day! |
Beta Was this translation helpful? Give feedback.
-
Hello!
At first: Great Lib! It was really easy and well explained to create in a short time nice screens with the Lib functions.
Are there some tips to tailor the lib?
Are already not used functions optimized by the arduino compiler? Or can I safe some flash by commenting some functions /definitions?
The Lib and functions I used consumed more than 10kB of flash.
I already used the smallest font libs of the choosen style I need (e.g. sometimes just numbers).
Maybe you have some other tips for me below I printed a regular function I use to create different screens for my project.
Are some fucntions really need a lot of flash (e.g. get the character width / height...)
Thanks a lot in advance!
Usual functions I use:
oled.firstPage();
do
{
// Draw Caption with Line and little Logo
oled.setFont(u8g2_font_helvB10_tr);
oled.setFontDirection(0); // text is horizontal
oled.setFontPosTop(); // text is build up from top of the font (top line)
oled.setCursor(1,1);
oled.print(caption);
oled.drawLine(0, oled.getMaxCharHeight()+2,ScreenWidth_lastpixel, oled.getMaxCharHeight()+2); // draw a line below the "caption" of the screen
//oled.drawXBM(ScreenWidth_lastpixel - RegalMini_XMB_Width, (oled.getMaxCharHeight()+2-RegalMini_XMB_Height)/2, RegalMini_XMB_Width,RegalMini_XMB_Height,RegalMini_XMB);
oled.drawXBMP(ScreenWidth_lastpixel - RegalMini_XMB_Width+1, 0, RegalMini_XMB_Width,RegalMini_XMB_Height,RegalMini_XMB);
}
while (oled.nextPage());
Beta Was this translation helpful? Give feedback.
All reactions