diff options
-rw-r--r-- | libraries/MultiLCD/MultiLCD.h | 48 | ||||
-rw-r--r-- | megalogger/megalogger.ino | 30 |
2 files changed, 46 insertions, 32 deletions
diff --git a/libraries/MultiLCD/MultiLCD.h b/libraries/MultiLCD/MultiLCD.h index f0eb566..5dac47f 100644 --- a/libraries/MultiLCD/MultiLCD.h +++ b/libraries/MultiLCD/MultiLCD.h @@ -107,6 +107,25 @@ private: byte m_row; }; +class LCD_SH1106 : public LCD_Common, public Print +{ +public: + void begin(); + void setCursor(byte column, byte line); + void draw(const PROGMEM byte* buffer, byte width, byte height); + size_t write(uint8_t c); + void clear(byte x = 0, byte y = 0, byte width = 128, byte height = 64); + void clearLine(byte line); + byte getLines() { return 21; } + byte getCols() { return 8; } +private: + void WriteCommand(unsigned char ins); + void WriteData(unsigned char dat); + void writeDigit(byte n); + byte m_col; + byte m_row; +}; + #define TFT_LINE_HEIGHT 8 class LCD_ILI9325D : public LCD_Common, public Print @@ -118,6 +137,11 @@ public: m_y = column; m_x = (uint16_t)line * TFT_LINE_HEIGHT; } + void setXY(uint16_t x, uint16_t y) + { + m_y = x; + m_y = y; + } void setTextColor(uint16_t color) { m_color[1] = color; @@ -172,6 +196,11 @@ public: m_x = column; m_y = (uint16_t)line * TFT_LINE_HEIGHT; } + void setXY(uint16_t x, uint16_t y) + { + m_y = x; + m_y = y; + } void setTextColor(uint16_t color) { m_color[1][0] = color & 0xff; @@ -223,22 +252,3 @@ private: uint16_t m_x; uint16_t m_y; }; - -class LCD_SH1106 : public LCD_Common, public Print -{ -public: - void begin(); - void setCursor(byte column, byte line); - void draw(const PROGMEM byte* buffer, byte width, byte height); - size_t write(uint8_t c); - void clear(byte x = 0, byte y = 0, byte width = 128, byte height = 64); - void clearLine(byte line); - byte getLines() { return 21; } - byte getCols() { return 8; } -private: - void WriteCommand(unsigned char ins); - void WriteData(unsigned char dat); - void writeDigit(byte n); - byte m_col; - byte m_row; -}; diff --git a/megalogger/megalogger.ino b/megalogger/megalogger.ino index f2d7a70..401e06e 100644 --- a/megalogger/megalogger.ino +++ b/megalogger/megalogger.ino @@ -452,7 +452,8 @@ private: for (byte i = 0; i < sizeof(pidlist) / sizeof(pidlist[0]); i++) { bool valid = isValidPID(pidlist[i]); lcd.setTextColor(valid ? RGB16_GREEN : RGB16_RED); - lcd.draw(valid ? tick : cross, 304, i * 16 + 32, 16, 16); + lcd.setCursor(304, i * 2 + 4); + lcd.draw(valid ? tick : cross, 16, 16); } lcd.setTextColor(RGB16_WHITE); } @@ -480,27 +481,27 @@ private: lcd.setFont(FONT_SIZE_MEDIUM); lcd.setCursor(0, 8); - lcd.print("OBD"); + lcd.print("OBD "); lcd.setTextColor((state & STATE_OBD_READY) ? RGB16_GREEN : RGB16_RED); - lcd.draw((state & STATE_OBD_READY) ? tick : cross, 36, 64, 16, 16); + lcd.draw((state & STATE_OBD_READY) ? tick : cross, 16, 16); lcd.setTextColor(RGB16_WHITE); lcd.setCursor(0, 10); - lcd.print("ACC"); + lcd.print("ACC "); lcd.setTextColor((state & STATE_ACC_READY) ? RGB16_GREEN : RGB16_RED); - lcd.draw((state & STATE_ACC_READY) ? tick : cross, 36, 80, 16, 16); + lcd.draw((state & STATE_ACC_READY) ? tick : cross, 16, 16); lcd.setTextColor(RGB16_WHITE); lcd.setCursor(0, 12); - lcd.print("GPS"); + lcd.print("GPS "); if (state & STATE_GPS_READY) { lcd.setTextColor(RGB16_GREEN); - lcd.draw(tick, 36, 96, 16, 16); + lcd.draw(tick, 16, 16); } else if (state & STATE_GPS_CONNECTED) - lcd.print(" --"); + lcd.print("--"); else { lcd.setTextColor(RGB16_RED); - lcd.draw(cross, 36, 96, 16, 16); + lcd.draw(cross, 16, 16); } lcd.setTextColor(RGB16_WHITE); } @@ -545,10 +546,13 @@ private: { lcd.clear(); #ifndef MEMORY_SAVING - lcd.draw2x(frame0[0], 0, 0, 78, 58); - lcd.draw2x(frame0[0], 164, 0, 78, 58); - lcd.draw2x(frame0[0], 0, 124, 78, 58); - lcd.draw2x(frame0[0], 164, 124, 78, 58); + lcd.draw2x(frame0[0], 78, 58); + lcd.setXY(164, 0); + lcd.draw2x(frame0[0], 78, 58); + lcd.setXY(0, 124); + lcd.draw2x(frame0[0], 78, 58); + lcd.setXY(164, 124); + lcd.draw2x(frame0[0], 78, 58); #endif //lcd.setColor(RGB16(0x7f, 0x7f, 0x7f)); |