altishchenko:
Bill,
Can I have a look at your package? Is it on github or elsewhere?
Its not on github yet. It will be soon.
Since I can't do private repos on github but it needs to be on github to work with the library manager, I don't want to push it up to a public repo until I'm close to ready to release it.
But I can notify you as soon as I put it up, if you would like.
While it is currently up and working, I'm still finalizing/tweaking some of the internal i/o class to class APIs and I really don't want this being forked until those APIs are all pretty much locked down.
The overall concept is similar to fm's LiquidCrystal replacement library. (which I also worked on)
But this package will not have all the classes bundled into a single arduino library directory.
It will separate them out into separate libraries.
It will also not attempt to masquerade as the IDE bundled LiquidCrystal library.
This eliminates all the installation, build, and potential library collision issues in that library.
And since it will use the library manager, when using more recent IDEs, users can install it with just a few clicks and get update notices when updates become available.
As for the code page stuff - as I said it is more of the convenience, attempt to make things work out of the box for the newcomers. People buying pre-packaged arduino kits with all things included and a step-by-step tutorial on how to use it for themselves or for their kids are not the people who have 3 boxes of resistors and "stuff" lying around
Even, tutorials themselves start with a brief introduction to C++ - that is the auditory.
And that is why I'd recommend using the already existing command() api.
command() exists, and works with any version of the IDE even to back before 1.0 so you are not having to depend on any updates to a library to get support to control that display.
You could create a tutorial and an example of how to set the code page, that should work on any version of the IDE and with any hd44780 library - once they create their lcd library constructor for the library they are using.
Consider this, even if you manage to get this new API into the Arduino.cc IDE bundled LiquidCrystal library, (which is still not a given, but assuming it does get in) there are still dozens of other hd44780 libraries that won't have it, including the i2c backpack libraries.
This is important to remember as lots of users are using LCDs that are not using them with directly connected pins or with the Arduino.cc IDE LiquidCrystal library.
Keep in mind that other h/w like teensy, or chipkit, and Intel Arduino 101 ship with their own versions of the LiquidCrystal library so even while a sketch may be using the "LiquidCrystal" library, depending on the board hardware, it may not be using the LiquidCrystal library that Arduino.cc ships with their IDE.
So even if this new API were to be added to the Arduino.cc IDE bundled LiquidCrystal library that Arduino.cc ships in their release, there is no guarantee that the user is running an IDE that has this update or is using an arduino board that would use that LiquidCrystal library.
Some Arduino users have replaced the stock IDE LiquidCrystal library with fm's library. Those users would also not see the new API unless that library were updated.
Also many Arduino users do not always update to the latest version of the IDE and since recent versions of the IDE can break some libraries or sketches, some users are intentionally not upgrading as they don't have the skill set to fix the simple things that broke on the newer IDEs.
Users of a tutorial and examples that depend on a new API that are using environments that either don't use the Arduino.cc LiquidCrystal library or have an older IDE without the the updates to support this new API, or were using a board, or core that used a different LiquidCrystal library would have to patch their lcd library themselves in order to have the API that the tutorial and examples depend on.
Based on what I've seen over the years in the Arduino forums, trying to get less technical users to modify a library even for tiny simple changes, is too large a step for some of those users.
However, less technical users would easily be able to run an example that uses command() or even create their own code by cutting and pasting the single line that uses the command() API to get the code page set for that display.
I'm not really against updating the library for new functionality, it is just that given the current real world reality of the state of Arduino hd44780 libraries, IDEs, and core extensions, any nice simple easy to use tutorial that depends on new API functions existing in libraries supplied by another party will be confined to a very limited set of use cases and will fail to work in many common use scenarios.
Asking them to manually update some particular obscure library off github and do it right (so it will work) may be a bit of stretch, when the only thing they want is 'Hello, the temperature is XX C' in their speak.
I agree that asking users to install a library from github/bitbucket etc is a stretch for some users.
But with adequate instructions and a properly formed .zip image many less technical users can handle it using the IDE "install from zip" capability.
This is what many of the users are already having to do today to get their i2c backpacks up and running.
The biggest issue here related to installation, is that several of the libraries out there are not providing properly formed .zip files so the users can't use the IDE to do the install. This creates lots of support issues as the manual install process is more complicated and many less technical users screw it up and make a mess of things.
But that isn't the way libraries should be installed now.
In more recent IDEs, Libraries can use the library manager so users can install them with just few clicks and get notifications about updates whenever the author pushes them out.
The user does not have mess with zip files or know anything about github, even though github is used under the hood.
And, I am still against using command() directly. It is more of a hack to the end user and I would make it private(!) be I one of the LC maintainers - this is too dangerous a function to leave it exposed.
I'm not a particular fan of having to use it either.
However, given that there are so many hd44780 libraries out there, including multiple "LiquidCrystal" libraries, I think it is unreasonable to expect a common api across all of them much less even having a a new API exist across all of the "LiquidCrystal" libraries, so you are kind stuck using it if you really want to enable and promote the use of this display.
Now there are ways you could hide it if that is a goal.
The most integrated / clean way would be to create a wrapper class library.
In terms of dangerous. Yes when abused, it can mess with the current display initialization which could cause a display to be come illegible.
However, it was made public as a way to provide unanticipated functionality.
And even if abused and things go haywire on the display, I don’t' think it will actually damage the hardware so it isn't that dangerous.
Have you looked at lcdproc (linux/unix) tool, or LCD Smartie (Windows)?
There are some Arduino sketches out there that provide support for these packages.
It becomes trivial to create an arduino sketch on top of an LCD library to support these as long as the library supports a raw command interface like command().
Those packages do some amazing things, but they want/need to have full control over the hd44780 interface which includes being able to send direct commands to the display.
--- bill