mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2025-01-26 20:28:52 +01:00
Fix some font attributes as const.
This commit is contained in:
parent
94a6d14687
commit
fcb9d38965
@ -73,6 +73,8 @@ void SSD1306Ascii::setCursor(uint8_t col, uint8_t row) {
|
||||
//------------------------------------------------------------------------------
|
||||
void SSD1306Ascii::setFont(const uint8_t* font) {
|
||||
m_font = font;
|
||||
fontFirstChar = readFontByte(m_font + FONT_FIRST_CHAR);
|
||||
fontCharCount = readFontByte(m_font + FONT_CHAR_COUNT);
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
void SSD1306Ascii::setRow(uint8_t row) {
|
||||
@ -101,10 +103,6 @@ size_t SSD1306Ascii::write(uint8_t ch) {
|
||||
return 0;
|
||||
}
|
||||
const uint8_t* base = m_font + FONT_WIDTH_TABLE;
|
||||
const uint8_t letterSpacing = 1;
|
||||
uint8_t fontFirstChar = readFontByte(m_font + FONT_FIRST_CHAR);
|
||||
uint8_t fontCharCount = readFontByte(m_font + FONT_CHAR_COUNT);
|
||||
uint8_t fontWidth = readFontByte(m_font + FONT_WIDTH);
|
||||
|
||||
if (ch < fontFirstChar || ch >= (fontFirstChar + fontCharCount)) return 0;
|
||||
ch -= fontFirstChar;
|
||||
|
@ -195,6 +195,13 @@ class SSD1306Ascii : public Print {
|
||||
uint8_t m_displayHeight; // Display height.
|
||||
uint8_t m_colOffset; // Column offset RAM to SEG.
|
||||
const uint8_t* m_font = nullptr; // Current font.
|
||||
|
||||
// Only fixed size 5x7 fonts in a 6x8 cell are supported.
|
||||
const int fontWidth = 5;
|
||||
const int fontHeight = 7;
|
||||
const uint8_t letterSpacing = 1;
|
||||
uint8_t fontFirstChar;
|
||||
uint8_t fontCharCount;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user