How to publish location event?

I have Particle Tracker One device and I´m working with Particle Edge firmware.
I would like to do next:

  • when my SoC (for ex.70) changes +/-5 (75 or 65) I would like to trigger a location event.

    if(abs(start_soc - batt_soc)>5){
    //trigger the event

    start_soc = batt_soc;
    }
    …How to trigger location event?

You can call this to trigger a location publish from user firmware:

TrackerLocation::instance().triggerLocPub();
2 Likes

Just one more question. Is there a function that can be called from user firmware that reboots device?

System.reset() :wink:

2 Likes

Tracker Edge will do a few things internally to reset gracefully. System.reset() will work as it is captured in the following snippet to stop some running processes first.

// Associate handler to OTAs and pending resets to disable the watchdog
System.on(reset_pending,
    [this](system_event_t event, int param){
        // Stop everything
        stop();
        end();
    }
);
4 Likes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.