summaryrefslogtreecommitdiff
path: root/obdlogger/MultiLCD.cpp
diff options
context:
space:
mode:
authorStanley Huang <stanleyhuangyc@gmail.com>2013-04-20 12:40:25 +0800
committerStanley Huang <stanleyhuangyc@gmail.com>2013-04-20 12:40:25 +0800
commit06cac07f9bca7fe50cf3b96184e5b8707606108a (patch)
tree3b42d37316485bc5f9bbeb9d7423026380bb9fd5 /obdlogger/MultiLCD.cpp
parent58cf18a5ebb3d31b7c2933b5d76fceaa6659affd (diff)
download2021-arduino-obd-06cac07f9bca7fe50cf3b96184e5b8707606108a.tar.gz
2021-arduino-obd-06cac07f9bca7fe50cf3b96184e5b8707606108a.tar.bz2
2021-arduino-obd-06cac07f9bca7fe50cf3b96184e5b8707606108a.zip
update MultiLCD library
Diffstat (limited to 'obdlogger/MultiLCD.cpp')
-rw-r--r--obdlogger/MultiLCD.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/obdlogger/MultiLCD.cpp b/obdlogger/MultiLCD.cpp
index 22112d1..c611b14 100644
--- a/obdlogger/MultiLCD.cpp
+++ b/obdlogger/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++;
+ }
}
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++;
+ }
s++;
}
}