Refactoring DevKit code for final hardware help

If I were smarter and didn’t have my DevKit projects looking like several piles of spaghetti, I’m sure I could easily use some diff program to see the obvious changes from the DevKit ide to the newest one. However, I am neither smart, and I have lots of spaghetti :slight_smile:

Any help on what sections should I be looking at harder to get my older projects up and running on the new hardware?

While I would simply start using the updated library, I’ve hacked up ye olde arduboy CPP and h files a bunch and I’m afraid to go digging too deep :slight_smile:

The DevKit and production Arduboy share the same library. The production Arduboy can do everything the DevKit can (plus a few more things). Anything that works on the DevKit, written using the current library, will most likely work unchanged on the production Arduboy.

So basically, make sure your sketch works on a DevKit with the currently released library and then just try it with a production Arduboy. If it works, great. If not, and you can’t determine the problem, ask here in the forum for help.

Note that to make the current library work properly with a DevKit, you will probably have to edit the library src/core/core.h file to comment out the #define ARDUBOY_10 and uncomment the #define AB_DEVKIT, as instructed in the comments near the start of the file.
See this later reply.

Also, you can examine the example sketches included with the library to get a basic idea of how to properly use it.

If you want to post your sketch code, I and probably others might be able to help with whatever changes are required.

3 Likes

Thanks Scott!

I actually had very little problems compiling with the new libraries.

I had problems after uploading to the device (black screen, no sound) a lot of this was due to differently named classes and functions from what I was using (before ArduboyAudio and ArduboyTunes were official-like).

Somehow, after hacking away at it, and checking out other similar projects from the arg team, I’ve magically got things working again :slight_smile:

Thanks for your help! I’ll be back to whine again later :wink:

2 Likes

Okay. Back for more :wink:

The latest thing I’ve noticed is that the general arduboy.print(somestring) no longer works (I used to have this directly in the the arduboy.h and cpp).

I see it’s been separated out to a separate file in the core folder of the libraries, but when I add those files into the game folder (and rename/include just in case) I can’t seem to get any characters from the glcd.c font I was using, all I see is a white block. setCursor and setSize (used to be setTextSize?) still appear to work fine (the white block moves appropriately) but I’m a little confused as to what I’m missing.

I’ll keep hacking away and post back if I figure it out. But if any veterans out there know the obvious problem I’m forgetting about, feel free to school me :slight_smile:

The print method from the Arduboy class is something that is being changed a bit for 1.2, we haven’t decided how to do it yet. I would recommend using the 1.1 tag from the repository for now.

It will be broken out into a separate class, but I’m thinking we will override a virtual function or inherit a class that holds the printer, like ArduboyPrint instead of the current method of two classes being needed to print.

1 Like

Sorry. I’m still pretty lost. :frowning:

I can’t even get the latest version of Glove to compile due to print errors for any function that has arduboy.print or arduboy.setCursor

Where exactly am I supposed to be including the ab_printer.h? (although looking at the code, it doesn’t seem to include the original print function, is that still included in Print.h ?)

Is there a simpler way of just using the old print functions without breaking compatibility with the new hardware?

I’m feeling very stupid right now.

Hehe, don’t worry we all are learning. I would recommend, at this point, removing the Arduboy Library, or any library you have in C:/Users/<username>/Documents/Arduino/libraries that looks like an Arduboy Library.

Then go back to the Kickstarter guide and follow Step 2, which has you add the library through the Arduino IDE Library manager, and select release 1.1.

It sounds like you are on the master branch of the Github repo, which is fine, but won’t work with any old code using print ATM. The master branch is the working branch for version 1.2 of the API, and you want to use the 1.1 tag, or the 1.1 release.

2 Likes

Yeah, that is one of the reasons the new API isn’t finalized. Please feel free to weigh in on the Github page, https://github.com/Arduboy/Arduboy. Search the issues, and if you dont find one, opened or closed that matches your issue, feel free to open a new one.

Suggestions, comments and problems with the library as a piece of software should be directed at the Github page for the Arduboy’s library repository.

1 Like

Awesome. Thanks so much, I finally got it sorted out!

The biggest culprits were the changes to Arduboy::write and Arduboy::drawChar (prototype order is also different). Once I patched those up, all the print functions are awesome again :smile:

Now, I just have to get sound working the way it was… then I can get back to breaking things properly :wink:

1 Like

Excellent, glad I found this. I was worried that I was too far behind on the Arduboy Library (last loaded a Sketch to my Dev Kit back in Nov. 2015) and was going to start a thread. But I think you’ve already got it covered. Thanks, the Arduboy Forum is the best!

1 Like

This is no longer necessary. You can now install support in the Arduino IDE to allow selecting between the production Arduboy and the DevKit. See Step 2 in the Quick Start Guide: Install Support for the Arduboy and DevKit.

Selecting between Arduboy or Arduboy DevKit will automatically set the ARDUBOY_10 and AB_DEVKIT defines as required.

2 Likes