Ticket Created

WERETECH-8118

Sim issue with saveWaypoints

In the sim using 3.1.5, the following sometimes doesn't work.

Toybox.PersistedContent.saveWaypoint(location, {:name => name});

It works fine in the device (a real 1030).

Parents
  • I've made a ticket for this issue. I noticed that you said that adding locations in another place works. Are you saying that passing a different "location" parameter works? or that the Toybox.PersistedContent.saveWaypoint(location, {:name => name}); line works in other places of your project?

    If the first, could you supply the location?

    If the second, could you describe what the app does before trying to save the waypoint?

Comment
  • I've made a ticket for this issue. I noticed that you said that adding locations in another place works. Are you saying that passing a different "location" parameter works? or that the Toybox.PersistedContent.saveWaypoint(location, {:name => name}); line works in other places of your project?

    If the first, could you supply the location?

    If the second, could you describe what the app does before trying to save the waypoint?

Children
  • Both. It's a different coordinates and in another place in the code.

    function addLocation(itemLocation)
    {
    var name = itemLocation["name"];
    var lat = itemLocation["lat"];
    var lon = itemLocation["lon"];

    try
    {
    System.println("Downloaded location: "+name.toString()+" "+lat.toString()+","+lon.toString());

    var location = new Position.Location({:latitude => lat.toFloat(), :longitude => lon.toFloat(), :format => :degrees});

    var track = getCurrentTrack(false);

    if (track != null && track instanceof TrackObj)
    {
    if(track.isource.equals(:frompluscode) || track.isource.equals(:fromsendpoints))
    {
    name = "+ "+name;
    }
    }

    if (Toybox has :PersistedContent)
    {
    Toybox.PersistedContent.saveWaypoint(location, {:name => name});
    }

    courseLoadedLast = getLocation(name);

    itypeLoadedLast = :type_loc;

    if (track != null && track instanceof TrackObj)
    {
    var bEncode = false;
    if(track.isource.equals(:frompluscode))
    {
    track.details = "Plus Code location";
    }
    else if(track.isource.equals(:fromsendpoints))
    {
    track.details = "Sendpoints location";
    bEncode = true;
    }

    track.file_type = :type_waypoint;

    track.title = name;
    track.coursename = name;
    track.lat = lat;
    track.lon = lon;

    track.details += " "+track.title + ".";

    if(bEncode)
    {
    track.details += " "+OLCObj.encodeOLC(lat.toFloat(), lon.toFloat());
    }

    track.distanceFrom(appbase.latCurrent, appbase.lonCurrent, unitsDistance);

    if(track.web.equals(""))
    {
    track.web = ""%.8f")+","+track.lon.toDouble().format("%.8f");">maps.google.com
    }

    track.distanceFrom(appbase.latCurrent, appbase.lonCurrent, unitsDistance);

    addCourse(track);
    }
    }
    catch (ex)
    {
    System.println(ex.getErrorMessage());
    appbase.strStatus = "Download "+name+" failed";
    }
    }