diff options
Diffstat (limited to 'libraries/MultiLCD')
-rw-r--r-- | libraries/MultiLCD/MultiLCD.cpp | 15 | ||||
-rw-r--r-- | libraries/MultiLCD/MultiLCD.h | 2 |
2 files changed, 14 insertions, 3 deletions
diff --git a/libraries/MultiLCD/MultiLCD.cpp b/libraries/MultiLCD/MultiLCD.cpp index 22112d1..cff82c2 100644 --- a/libraries/MultiLCD/MultiLCD.cpp +++ b/libraries/MultiLCD/MultiLCD.cpp @@ -118,12 +118,19 @@ void LCD_OLED::write(char c) { char s[2] = {c}; ScI2cMxDisplay8x16Str(OLED_ADDRESS, m_line, m_column, s); - m_column = (m_column + 8) & 0x7f; + m_column += 8; + if (m_column >= 128) { + m_column = 0; + m_line += 2; + } } void LCD_OLED::print(const char* s) { ScI2cMxDisplay8x16Str(OLED_ADDRESS, m_line, m_column, s); + m_column += (strlen(s) << 3); + m_line += (m_column >> 7) << 1; + m_column %= 0x7f; } void LCD_OLED::printLarge(const char* s) @@ -137,7 +144,11 @@ void LCD_OLED::printLarge(const char* s) } else { ScI2cMxFillArea(OLED_ADDRESS, m_line, m_line + 1, m_column, m_column + 16, 0); } - m_column = (m_column + 16) & 0x7f; + m_column += 16; + if (m_column >= 128) { + m_column = 0; + m_line += 2; + } s++; } } diff --git a/libraries/MultiLCD/MultiLCD.h b/libraries/MultiLCD/MultiLCD.h index 2a10356..35016aa 100644 --- a/libraries/MultiLCD/MultiLCD.h +++ b/libraries/MultiLCD/MultiLCD.h @@ -22,7 +22,7 @@ public: void setCursor(unsigned char column, unsigned char line) { m_column = column << 3; - m_line = line << 1; + m_line = line == -1 ? m_line + 2 : (line << 1); } void write(char c); void print(const char* s); |