edward0429 / arduino

Automatically exported from code.google.com/p/arduino
0 stars 0 forks source link

LiquidCrystalDisplay library setCursor(col, row) bug #671

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

IDE22 - windows 7

void LiquidCrystal::setCursor(uint8_t col, uint8_t row)
{
  int row_offsets[] = { 0x00, 0x40, 0x14, 0x54 };
  if ( row > _numlines ) {                                                
    row = _numlines-1;    // we count rows starting w/0
  }

  command(LCD_SETDDRAMADDR | (col + row_offsets[row]));
}

It should be --  if (row >= _numLines)   --

as when you define lcd.begin(20,4);  _numLines will be 4.
If you do setCursor(x,4), row will be 4; the if test will fail and command will 
access row_offsets[4] which is not defined ... eh outside the array...

thread on the forum: 
- http://arduino.cc/forum/index.php/board,7.0.html -

Original issue reported on code.google.com by rob.till...@gmail.com on 8 Oct 2011 at 4:54

GoogleCodeExporter commented 9 years ago
https://github.com/arduino/Arduino/commit/f68432185090bb3a9523747552bfd9fb16976c
e5

Original comment by dmel...@gmail.com on 10 Oct 2011 at 4:36