LTE Project: GPS and Compass screens!


Another update on my LTE project. This one is fairly small, but I worked out the compass screen, which runs off of the GPS. You can see the whole commit here.  What is interesting about this is that I actually edited the library for the LTE shield itself to do what I wanted. Fortunately, it was pretty simple.

The problem is space. I’m running out of dynamic memory. I need to maintain around 500 bytes to run the sketch, but it is difficult when I start adding variables. The Arduino Uno only has 2 kb of ram. So, to call the GPS to get the heading, you need this:

boolean Adafruit_FONA::getGPS(float *lat, float *lon, float *speed_kph, float *heading, float *altitude,
uint16_t *year, uint8_t *month, uint8_t *day, uint8_t *hour, uint8_t *min, float *sec) {

But I only had room for one more float variable. But I found this in the library:

// only grab altitude if needed
if (altitude != NULL) {
// grab altitude
char *altp = strtok(NULL, “,”);
if (! altp) return false;
*altitude = atof(altp);

What does that mean? Well, a lot of variables in the above are allowed to be “null” or nothing. So, I edited the libraries/Botletics_SIMCom_Library_v1.0.0/Adafruit_FONA.h file from this:

boolean getGPS(float *lat, float *lon, float *speed_kph, float *heading, float *altitude,

To this:

boolean getGPS(float *lat, float *lon, float *speed_kph, float *heading, float *altitude = NULL,

Claiming the altitude is null. This is perfect because I can call one float, named heading, and then call the method with just one float instead of a bunch of them. Like this:

case 4:{ // Compass screen
                float heading;
                if (fona.getGPS(&heading, &heading, &heading, &heading)) {
                  lcd.setCursor(0, 1);
                  lcd.print("Heading: "); lcd.print(heading);

So, even though I technically need a float for lat, long, heading, and altitude, now I am just using the heading one and letting it be overwritten by lat, long, etc., and the last one written is the heading! Yes, this is cheating, but praise God, it worked! This LTE project is really coming along!

Linux – keep it simple.

When Jack turns into a Ninja.

Well, Jack doesn’t actually turn into a Ninja. Actually Jack gets beat up by one. On my computer at least.

I’ve used Jack for a while now, when compiling Marshmallow roms. However, Jack keeps having problems while I am building Nougat roms. In fact, Jack seems to sit down and cry every time “Ninja” shows up. I keep getting a “out of memory” error for the Jack server.

Being somewhat used to Jack, I tried setting arguments by exporting them into the environment variables, as I mentioned in a previous post, but that wasn’t helping. So, I went to and read up about Jack. Unfortunately, none of the things that they recommend there are working.

Then I really read that link. Near the top of the page, it says:

“For instructions on using Jack in Android 7.0 (N) and later, see the Jack server documentation. For Android 6.0 (M), use the instructions in this section.”

Ahh, now I see the error of my ways. After going to the new Jack documentation ( ) I found this lovely tidbit:

“If you experience Jack compilations failing on Out of memory error.:

You can improve the situation by reducing the number of jack simultaneous compilations by editing your $HOME/.jack-server/ and changing jack.server.max-service to a lower value and then restarting the server.
If this is not enough, you may change the arguments used to start the server jvm and force a greater maximum Java heap size (“-Xmx”):

Stop the server using jack-admin stop-server, then:
If you start the server manually:
JACK_SERVER_VM_ARGUMENTS=”-Xmx2g -Dfile.encoding=UTF-8 -XX:+TieredCompilation” jack-admin start-server
If you use the jack server in the android tree then
export ANDROID_JACK_VM_ARGS=”-Xmx2g -Dfile.encoding=UTF-8 -XX:+TieredCompilation”
and restart your build command.”

So, now I can get Jack to join the Ninja party.

Linux – keep it simple.