clear_buffer poprawione, dodano color
This commit is contained in:
@@ -17,7 +17,7 @@ uint8_t font_print_str(const FONT_INFO * font, uint8_t * text, uint8_t pos_x, ui
|
||||
|
||||
uint8_t width = font_string_lenght_px(font, text);
|
||||
|
||||
ssd1306_clear_buffer(width, height, pos_x, pos_y);
|
||||
SSD1306_clear_buffer(width, height, pos_x, pos_y, WHITE);
|
||||
|
||||
while(*text)
|
||||
{
|
||||
@@ -27,20 +27,12 @@ uint8_t font_print_str(const FONT_INFO * font, uint8_t * text, uint8_t pos_x, ui
|
||||
continue;
|
||||
}
|
||||
|
||||
// if (actual_char == ' ')
|
||||
// {
|
||||
// x += font->spacePixels + font->interspacePixels;
|
||||
// continue;
|
||||
// }
|
||||
|
||||
uint8_t char_nr = actual_char - font->startChar;
|
||||
const FONT_CHAR_INFO *charinfo = &font->charInfo[char_nr];
|
||||
|
||||
|
||||
ssd1306_write_to_buffer(font->data + charinfo->offset, charinfo->widthBits, height, x, pos_y);
|
||||
ssd1306_write_to_buffer(font->data + charinfo->offset, charinfo->widthBits, height, x, pos_y, WHITE);
|
||||
|
||||
x += charinfo->widthBits + font->interspacePixels;
|
||||
|
||||
}
|
||||
|
||||
return x;
|
||||
@@ -56,13 +48,8 @@ uint8_t font_string_lenght_px(const FONT_INFO * font, uint8_t * text)
|
||||
if (actual_char < ' ' || actual_char > 126) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// if (actual_char == ' ') {
|
||||
// x += font->spacePixels + font->interspacePixels;
|
||||
// } else {
|
||||
x += font->charInfo[char_nr].widthBits + font->interspacePixels;
|
||||
// }
|
||||
|
||||
|
||||
x += font->charInfo[char_nr].widthBits + font->interspacePixels;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user