Particle.subscribe() no longer working consistently while using GPS

I’m not a pro and I’ve hit a point where I can’t find any docs or other forum info to help…
I wasn’t having any trouble with Particle.subscribe() before I started using the gps. Now I’ve found my device barely receives the events and when it occasionally does it’s receiving them minutes after they were sent, many loops of my code later. I have no idea why it seems like using the gps is changing this behaviour. Do I need to be adding a Particle.process() before or after sleeping? Also just so I understand the subscribe function better: when does the handler function execute (e.g. could it be interrupting or be interrupted by something else)?

For context:

  • I’m using the Electron with the AssetTracker V2 shield and I’m using the AssetTrackerRK library with AssistNow from Ublox and threading enabled.
  • My device is set up to sleep (with SLEEP_NETWORK_STANDBY) on each loop() for up to 30 seconds, and publishes that data every 5-10 loops (current set at 5).
  • I’m using my subscribes to change variables or to stay awake until told to resume the loop() as I was finding this method to be the most reliable way (I had trouble with the cellular wake-up solution) to interact with the device as it spends most of it’s time asleep. I’m posting the events to subscribe to in the console particle event stream.
  • I’m testing the result of the subscriptions (they’re all coming back true) and I am using to serial to see when my subscription handle is called and to debug generally.

Thank you in advance for any advice. :slight_smile:

Hi Kal,

This should be related to the missing Functions and Variables issue that has now been fixed cloud-side. Can you attempt this again?

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