I've set "numlines" to "2" as everybody with a 16x2 does. Now when I go to "row 2" (the third one, which is not present on the 16x2 displays), row is NOT > numlines, so the "if" doesn't trigger. When I try to go to line 3, it "limits my movement" back to line 1, the last one if I had a 16x2.
Am I the first to find this bug? It's been in there for ages....
In researching this I found several "improved" liquidcrystal libraries. Why hasn't one of those been adopted?
Am I the first to find this bug? It's been in there for ages....
If you look through my previous posts you will see that I have been mentioning this for ages as well.
The lcd.begin() function gives the LiquidCrystal library the information it needs to properly initialize the display and to permit the lcd.setcursor() function to work properly. Unfortunately the library itself does not follow up on this capability. It does not use the first parameter at all and it only checks to see if the second one is 1 or greater than 1.
The library does not compensate for the fact that the 16x4 and the 20x4 have different starting addresses for the third and fourth rows of characters. Therefore the characters on the third and fourth rows are, and have always been, positioned incorrectly.
Why hasn't one of those been adopted?
Possibly because of the phenomena known as NIH (Not Invented Here). The current LiquidCrystal library, which is a vast improvement over the ones used before v0017, was indeed written by an outsider so the feat is not impossible - only nearly impossible.
I confess that I didn't read his post carefully enough and I was in fact commenting on a different cursor positioning bug. I personally don't recall helping anyone on his particular cursor positioning problem before. Obviously he is not the first one to discover the bug since it has already been fixed. I hope they get around to fixing the offset problem for the 16x4 displays as well.
Offtopic sandbox:
I think the Arduino folks, while okay-ish at open source, aren't entirely in the swing of it.
I think the best option would be to put all of the Arduino project on github, as the official repository and download site, and include setup/build instructions for making your own changes.
Then, anyone could fork it, make changes, and send pull requests for improvements. That just seems to work a lot smoother with github than any other open source project host I've found (sourceforge, bazaar, codeproject, tigris, etc)
GitHib for the win!
jwatte:
Offtopic sandbox:
I think the best option would be to put all of the Arduino project on github, as the official repository and download site, and include setup/build instructions for making your own changes.
True But that's not where I actually get the downloaded versions.
as the official repository and download site, and include setup/build instructions for making your own changes
If the download/install instructions included the link-up with the source, it would make it easier to apply patches.
However, looking at the other LCD libraries, most of them add a bunch of code size for a feature set that will never be used all at once. A better option might be to write a LiquidCrystal library that uses a template to define the specific LCD class (pin numbers, data mode, parameterize on an I/O handler, etc.) Then, the code would actually be smaller, and it would be more flexible to boot.