Using Asset Tracker is just a mess

Hey guys. Is there a way to either have whoever is in charge of the AssetTracker2 Library add this update to it, or even if any of you have a solution, I am all ears. I have been struggling to handle this particular issue which is updating an electron WITHOUT the asset tracker 2 attached, that has the AssetTracker2 code in place to run it, which would simulate the asset tracker failing in the field and also help a lot with how buggy it has been to update devices using it, because if it throws an error it returns, and the code below, such as Particle Connect, is never run at this point, in which case you end up with a white LED. It has been huge headache to navigate, and even after my best efforts to write a custom version of the gpsOn; method that is included in the AssetTracker2 Library. This is basic idea of the function I wrote, but as it is not working, I thought I would ask, if anyone else has come up with a decent solution here, or if whoever is maintaining this Library would mind updating it.

I have already tried moving Particle.connect();, to before the gpsON method, but it doesnt seem to work when I do it. Should also include that I am using SemiAutomatic Mode, just for info sake.

The AssetTacker1-2 have both have been extremely temperamental to say the least.

Thank you! Any ideas would be greatly appreciated.

void turnGPSOn() {
    enum ubxReturn err;
    // Power to the GPS is controlled by a FET connected to D6
    pinMode(D6,OUTPUT);
    digitalWrite(D6,LOW);
    Serial1.begin(9600);
    delay(10);
    err = ubxPENDING;
    
    while (err != ubxSUCCESS){  
	    if (err != ubxPENDING ){
	        Serial.print("gps.begin failed: ");
	        Serial.println(err);
	        
            //connect anayways so can access other functions
            Particle.connect();           
            return;
	    }    
	    err=UbloxM8Q_GPS().begin();//ubxSUCCESS;
    }
    Serial.println("GPS started");

    //start recheck timer
    timer.start();
    
    //connect to the cloud after registering functions for lowest data usage
    Particle.connect();
}

The AssetTracker2 library was contributed by a private individual.
If you want some changes to that library you should go the the contributors repository and file an issue there

However, we usually recommend using the AssetTrackerRK library which is maintained by Rick from Particle
https://build.particle.io/libs/AssetTrackerRK/0.3.3/tab/AssetTrackerRK.cpp

3 Likes

Thank you for making my life infinitely easier with this suggestion. This solved this issue for me too!!!

1 Like