Object for reading a config file - and other magic ...
MagIO2
Posts: 2,243
Hi there ...
I think this might be a problem which can occur in other projects as well. Here is the first working draft of my solution. Next few days I will change it and make an object out of it, so, please don't put to much energy in this version·and don't·use it as is in your projects. The changes will be to big. But maybe someone is interested and maybe has some ideas I did not think of.
The demo only requires a SD card and a serial terminal. Copy the desk2.ini to the SD-card. If you start the program you have to switch to the terminal and press any key two times. Then you'll see the output.
Post Edited (MagIO2) : 4/25/2010 6:22:13 PM GMT
I think this might be a problem which can occur in other projects as well. Here is the first working draft of my solution. Next few days I will change it and make an object out of it, so, please don't put to much energy in this version·and don't·use it as is in your projects. The changes will be to big. But maybe someone is interested and maybe has some ideas I did not think of.
The demo only requires a SD card and a serial terminal. Copy the desk2.ini to the SD-card. If you start the program you have to switch to the terminal and press any key two times. Then you'll see the output.
Post Edited (MagIO2) : 4/25/2010 6:22:13 PM GMT
Comments
Did someone try out the posted code? Some comments? Ideas? Is there a MUST HAVE before realeasing to the ObEx?
One more idea ... this little config reader can also be used as a scripting engine. Could be usefull for one or the other problem.
Need someone who has an eye on the code. I tried to transform the code of my first post into an object. But somehow it's not doing the same thing as before even if I don't see a change in the relevant code.
"Tried to load outside of buffer!" gives a hint where things go wrong. Loading and processing the first 512 works fine, but loading the next part of the config-file is doing something wrong. The bytemove seems to copy the remaining part of the buffer to a wrong place.
Thanks in advance for everybody who's gonna have a short look
**** thank's again for the downloader - I'm gonna add some comments for docu and put the result to the ObEx the next days. This bug would really make a good challenge.
Post Edited (MagIO2) : 4/24/2010 10:36:54 PM GMT
I tried the first version and was initially puzzled because nothing happened. After verifying that my SD card worked (using the FSRW test program) I dug into yours and found that to get going I had to press several keys. I made your demo a little more "JonnyMac (i.e., regular guy) friendly" by changing the second line in CogOS_IO.start to kb.rxflush, and then modified the starting section of the main program like this:
Like you, I'm interested in having a little script reader that I might be able to use for a simple animation controller (for Halloween and movie prop control).
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon McPhalen
Hollywood, CA
Yep .. scripting is exactly what you can easily do with it as well. Wait a few minutes, I'm nearly done with the version I'm gonna upload to the object exchange.
No mention in the program comments -- I had to dig through the code. In the future, you'll probably get more feedback when you ask for it if your programs are easier to work with (i.e, they actually do something when you start them, without requiring unspecified user interaction). When a program runs and nothing happens, many assume it doesn't work and toss it; I nearly did.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon McPhalen
Hollywood, CA
I'm going to change it in the archive I put to the ObEx. Thanks for your feedback.
Here's my story:
I currently use it as a script-language interpreter. I still want to build a remote control replacement* for my livingroom which uses a graphical touchscreen display. As I definitely want to have a nice GUI, the graphics for animations needs to be pre-calculated. So I defined some instructions which allow to set the background and do simple slide-in/-out animations for example for the tool-bar or a window ... maybe blending in and out will be added as well.
So, the ConfigReader is currently used to read all this instructions and render the pictures needed out of a set of TIFF-files. This way I don't have to prepare the whole images with a graphics-software by hand. This also allows to change the skin from time to time. And the result is stored in one huge vMem-file, which is much better than my first attempt, where I ended up with a lot of files.
Later on it will also be used to read the button positions and propably all other settings needed. This way the settings can be kept in a nice text-file which can be easily extended/modified.
..... modified .... that reminds me ... where is CassLan???
* hopefully remote control replacement is a understatement. In the end it rather should be a home automation central ;o)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,