Fork of LCD-Window which works with Enhanced TextLCD from Wim

Fork of LcdWindow by Hendrik Lipka

Revision:
12:393329d0e050
Parent:
10:d40c70908bf0
--- a/textlcdadapter.cpp	Mon Jan 04 21:20:43 2016 +0000
+++ b/textlcdadapter.cpp	Tue Jan 12 20:40:39 2016 +0000
@@ -27,28 +27,30 @@
 
 TextLCDAdapter::TextLCDAdapter(TextLCD_Base *lcd) {
     _lcd=lcd;
+    _columns = _lcd->columns();
+    _rows    = _lcd->rows();
 }
 void TextLCDAdapter::clear() {
     _lcd->cls();
 }
 
 void TextLCDAdapter::writeText(const unsigned int column, const unsigned int row, const char text[]){
+    if ((column > getColumns()) || (row > getRows())){
+        return;
+    }
     _lcd->locate(column,row);
     int i=0;
-    while(text[i]!=0)
+    while((text[i]!=0) && (column+i < getColumns()))
     {
         _lcd->putc(text[i]);
         i++;
     }
 }
 
-int TextLCDAdapter::getRows() {
-    return _lcd->rows();
-}
-int TextLCDAdapter::getColumns() {
-    return _lcd->columns();
-}
 void TextLCDAdapter::character(int column, int row, int c) {
+    if ((column > getColumns()) || (row > getRows())){
+        return;
+    }
     _lcd->locate(column,row);
     _lcd->putc(c);
 }