 
 
 
-    //
-    String trkJsonLoc = String("{")
-        // does this correctly indicate if this value is stale?
-        //+ "\"c_hour\":" + String::format("%d", _cell_locate.hour)
-        //+ ",\"c_min\":" + String::format("%d", _cell_locate.minute)
-        + "\"c_lat\":" + String(convertDegMinToDecDeg(GPS.latitude))
-        + ",\"c_lng\":" + String(convertDegMinToDecDeg(GPS.longitude))
-        + ",\"c_unc\":" + String(GPS.fixquality)
-        + ",\"c_alt\":" + String(GPS.altitude)
-        + "}";
-     Particle.publish("trk/loc", trkJsonLoc, 60, PRIVATE);
+    float latitude = convertDegMinToDecDeg(GPS.latitude);
+    float longitude = convertDegMinToDecDeg(GPS.longitude);
+
+    if ((latitude != 0) && (longitude != 0)) {
+        String trkJsonLoc = String("{")
+            + "\"c_lat\":" + String(convertDegMinToDecDeg(GPS.latitude))
+            + ",\"c_lng\":" + String(convertDegMinToDecDeg(GPS.longitude))
+            + ",\"c_unc\":" + String(GPS.fixquality)
+            + ",\"c_alt\":" + String(GPS.altitude)
+            + "}";
+         Particle.publish("trk/loc", trkJsonLoc, 60, PRIVATE);
+     }
 
 
     float batteryVoltage = fuel.getVCell();



void setup() {
    lastMotion = 0;
    lastPublish = 0;


     Particle.publish("trk/dev", devJson, 60, PRIVATE);


    publishLevel();

//          int value = rand() * 100;
//     String sensorJson = String("{")
//            + "\"level\":" + String::format("%d", value)
//            + "}";
//     Particle.publish("trk/level", sensorJson, 60, PRIVATE);
}



void publishLevel() {
    int levelValue = getLevelReading();

    accel.read();
    float aX = accel.x;
    float aY = accel.y;
    float aZ = accel.z;


     String sensorJson = String("{")
            + "\"level\":" + String::format("%d", levelValue)
            + ",\"tempF\":" + String::format("%d", 0)
            + ",\"x\":" + String::format("%.2f", aX)
            + ",\"y\":" + String::format("%.2f", aY)
            + ",\"z\":" + String::format("%.2f", aZ)

            + "}";
     Particle.publish("trk/env", sensorJson, 60, PRIVATE);
}


int getLevelReading() {

    //
    int emptyLevelValue = 3500;
    int fullLevelValue = 1800;
    // about 2 inches of water ->
    //int levelValue = analogRead(D0) - 2434;

    //delay(50);
    int levelReading = analogRead(A4);
    int levelValue = map(levelReading, fullLevelValue, emptyLevelValue, 0, 100);
    levelValue = 100 - levelValue;  // flip it

    Serial.println("water level is " + String(levelReading) + " percentage full is " + String(levelValue));

    return levelValue;
}

int crc8(String str) {
  int len = str.length();
