Once again thanks Robert. I will wrestle with that along with a lot of other stuff. I have the time, and the desire, now all I have to work on is the smarts
Great then - I’ll be happy to help and explain some things the best way I can!
kfixman, because the library isn’t documented, I just looked at firmware and/or app source code that does something like I wanted to do and used the same or related functions in my code (after perusing the .h files for the library to see what else was available). With C++ it’s pretty easy to see what-all capabilities are included in a class once you’ve found it in a .h file.
I am beginning to understand parts of your code Frank. You include the MAKERphone library, but tell me the lines of code where you call it to reinstall the firmware.
I am reading the book Beginning C for Arduino by Jack Purdum. Hope that is a good one.
When you put a .bin file (like pi.bin) in a directory named pi along with an icon.bmp file, it forms an application that is loaded by the firmware upon request. When a program is loaded in this way, the firmware loads it into a second memory partition, while the firmware remains in the original memory partition. Then your program runs until it calls the MAKERphone::loader() member function. You’ll see in my code that it does this if it detects that you’ve pressed the B button while it’s waiting for the number of digits to be typed in (mp.loader() call on line 50). This library call causes the firmware in the original memory partition to be executed from the beginning again (it doesn’t have to be reloaded).
If you just compile and upload the sketch directly from the Arduino IDE (which doesn’t understand the firmware’s partitions), then it really does overwrite the firmware and the B button will only restart the PI program (the firmware is gone). In that case, you really do need to use the Tools/Burn Bootloader capability of the Ringo board package on the Arduino IDE to restore the firmware to factory (which will be the latest if you have the latest Ringo board package installed on the IDE).
As far as a coding reference for C++, the C reference is a good start but will only get you so far. You’ll really need to understand C++ classes to use the Ringo/Makerphone library. I highly recommend the C++ tutorial(s) found at http://www.cplusplus.com.
Please feel free to ask me any programming questions you may have (though I’ll be skiing for the next week so won’t be checking this community very often until I get back).
Ahhh, I am slowly beginning to understand. The .bmp is no problem, I have done a bunch of those. I have also downloaded some programs to the phone requiring a reload of the firmware. The existence of the second memory partition answers most of my questions, and eventually I will look at the Ringo firmware as recommended by Robert to see how the second partition is created.
When I get good enough I hope to create a simple Arduino sketch, convert it to a .bin, put it in the proper named folder with the .bmp, and have it return to the firmware after pushing a button.
Thanks for the C++ reference. It will be next on my study list.
That’s done simply in the Arduino IDE with Sketch/Export compiled Binary (instead of Sketch/Upload). Puts the .bin file in the same directory as the source code. And you don’t need to have the phone plugged in while you do this.
Yep, I tried that awhile back, but the code wasn’t right and it didn’t work. I will be borrowing a bunch of your code after a little more study. I know you don’t mind.
I am trying to come up with some RINGO API functions (if I am even using the term correctly) that I will be using. I don’t think I am ready to delve into the firmware .bin yet (hopefully someday soon), but if I am thinking correctly, these functions from Frank’s PI code will be some that I will use after I reference MAKERphone.h
I am such a newbie, that I don’t even know if my thinking about this is in the right direction or not. Still having fun though.
MAKERphone is a class (type) that encapsulates all the unique functionality of the MAKERphone. This functionality is provided by member functions and objects. In this case, the member functions you mentioned do the following:
begin() - Initializes the object (a MAKERphone) and tells it whether to display the moving splash screen during initialization or not.
update() - Called periodically, this syncs the hardware with the software library. This is rather time consuming and should not be called unnecessarily.
loader() - restarts firmware if it is still available in the other memory partition.
while the object members (in your case, display and buttons) provide their own member functions to affect sub-parts of the MAKERphone:
display.print() - for example, write text to display (overloaded to support string type and assorted numeric type arguments)
buttons.released() - for example, returns whether a specific button has been released.
If you read MAKERphone.h, you’ll see lots more members of the MAKERphone class, and for those members that are objects (of a particular other class), those objects will have their own member functions and object members. And so on and so on.
I agree this is a TERRIBLE way to try to understand the MAKERphone library, so hopefully CircuitMess will soon publish a library reference manual similar to that for other Arduino libraries.
Thanks Frank. That helps a lot. I am struggling a bit trying to open the firmware.bin as a .txt file. Is that what I have to do to get into MAKERphone.h, or am I on the wrong trail?
No, firmware.bin is the binary load image… it can’t be opened as a text file. You want to open this file: MAKERphone.h
Thank you Frank. Back to my studies.
Frank pretty much explained how things work but I would like to add a couple of things.
Update() should be called quite often actually - it is what pushes sprites to the screen, detects button presses and just generally makes everything work. Of course, it is quite time consuming since it does a lot of things altogether. Calling it once at the end of each loop is often quite enough, although it doesn’t have to be.
I would definitely recommend looking through the source code of our games which can be found on GitHub. By looking at that you’ll get the best idea of when is the best to use which function and therefore understand the most important ones in no time.
You know, I think I will eventually be able to deal with the programming, but until I get a real understanding of the MAKERphone library with all of the functions and the purpose of each, I really can’t do much. As Frank said, this is where CircuitMess effort is needed. This information needs to be “front and center” in any tutorial offered. It needs to be provided before CircuitBlocks, or Arduino IDE, and as a sticky at the beginning of the Programming Forums for brand new folks like me.
Having said that, I think with the MAKERphone.h reference that Frank gave me (should be the first thing provided in the Forum’s programming sections - would have saved me a lot of time), and Robert’s advice about studying the code from the games (should be the second thing provided in the Forum), I have a way to proceed.
Thank you for the help. Hopefully, more informed questions from me will follow.
Just reviewed some of the Ringo-Arduino examples (from robbie-8bit) on the GitHub reference provided by Robert. These are extremely helpful.
I agree with everything you’ve said. We’ve been creating a whole new “Creations and tutorials” part of our web which would feature a lot of tutorials, guides and much, much more, many of which have been already written for this platform.
Unfortunately, it has taken us a lot more to completely polish it and launch than expected and we don’t want to release an unfinished product. It should launch really soon and then there will be plenty of material to work with!
Keep in touch to see when it drops. Until it drops, keep exploring and ask me anything if you need to.
Robert, your caring, understanding, and help is very much appreciated. Something I don’t see much of in today’s world (without a profit motive).
Looking forward to the new guides and tutorials.
Getting the Arduino error message “Error compiling for board Ringo by CircuitMess” I have the Ringo by CircuitMess board installed as well as the Ringo library. Just trying to play with the fifth LCD example provided by robbie8-bit a couple of weeks ago.
Can you please copy the whole error? Also, is your phone plugged in, turned on and selected in the ‘Port’ section?