fix font; add separate counter for distance from power-on

This commit is contained in:
2026-09-13 22:47:07 +03:00
parent 2073575f54
commit 6586bcfa69
4 changed files with 93 additions and 30 deletions

View File

@@ -111,8 +111,8 @@ void lcd_draw_vertical_xsmall_digit_segment(uint16_t x, uint16_t y, uint16_t col
}
}
const uint8_t DIGIT_MASKS[10] = {0b1110111, 0b0100100, 0b1011101, 0b1101101, 0b0101110,
0b1101011, 0b1111011, 0b0100101, 0b1111111, 0b1101111};
static const uint8_t DIGIT_MASKS[10] = {0b1110111, 0b0100100, 0b1011101, 0b1101101, 0b0101110,
0b1101011, 0b1111011, 0b0100101, 0b1111111, 0b1101111};
void lcd_draw_digit(uint8_t digit, uint16_t x, uint16_t y, uint16_t color, uint16_t bgColor) {
const uint16_t SEGMENT_OFFSETS[7][2] = {{9, 0}, {0, 9}, {49, 9}, {9, 49}, {0, 58}, {49, 58}, {9, 99}};
@@ -199,7 +199,7 @@ void lcd_write_string(const char *string, uint16_t x, uint16_t y, uint16_t color
st7789_write(glyphPixels, 24 * (glyphWidth + LETTER_SPACING) * sizeof(uint16_t));
x += glyphWidth + LETTER_SPACING;
} else {
lcd_fill_rectangle(x, y, 12, 24, bgColor);
_fill_rectangle(x, y, 12, 24, bgColor);
x += 12;
}
}
@@ -215,7 +215,7 @@ int lcd_string_width(const char *string) {
} else {
int glyphIndex = glyph_index_for_code_point(character);
if (glyphIndex != -1) {
width += GLYPH_WIDTH[glyphIndex] + 1;
width += GLYPH_WIDTH[glyphIndex] + LETTER_SPACING;
} else {
width += 12;
}