Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.updatesPending() not working properly #1285

Closed
ScruffR opened this issue Mar 30, 2017 · 6 comments
Closed

System.updatesPending() not working properly #1285

ScruffR opened this issue Mar 30, 2017 · 6 comments
Milestone

Comments

@ScruffR
Copy link
Contributor

@ScruffR ScruffR commented Mar 30, 2017

As discussed in this thread
https://community.particle.io/t/how-to-notify-application-incase-of-an-incoming-ota-update/30976
and on slack (2017-03-31T18:36Z)
System.updatesPending() is currently of no use.

This code never indicates a pending update (neither for dev nor for prod devices)

STARTUP(System.disableUpdates())

void setup() {
  pinMode(D7, OUTPUT);
}

void loop() {  
  if (System.updatesPending())
    digitalWrite(D7, HIGH);
}

I added a note to the docs for that reason.

Tested on Photon 0.6.1 & Electron 0.6.1


Completeness:

  • Minimum test case added
  • Device, system and user firmware versions stated
ScruffR added a commit to particle-iot/docs that referenced this issue Mar 30, 2017
@technobly

This comment has been minimized.

Copy link
Member

@technobly technobly commented Mar 30, 2017

Currently this API only returns true while the user handler for firmware_update_pending event is running, right before applying an update. It's not yet smart about the fact that an update in the Cloud is available when the firmware has disabled updates via System.disableUpdates(). This is something we will build out in the future, and is especially needed for Products.

@dcliff9

This comment has been minimized.

Copy link

@dcliff9 dcliff9 commented May 11, 2017

For ultra low powered operations, this function is so very necessary. Trying to keep a device online for longer periods of time consumes a lot of power. I would really like a functional way to check for updates on each loop as such that if returned false, I can put the device back to sleep as fast as possible.

@ScruffR

This comment has been minimized.

Copy link
Contributor Author

@ScruffR ScruffR commented Jun 22, 2017

Just to add to the list of victims to this issue
https://community.particle.io/t/photon-ota-vs-system-sleep/33954
And myself for a contract work I recently discussed with Dave

@ScruffR

This comment has been minimized.

Copy link
Contributor Author

@ScruffR ScruffR commented Feb 12, 2018

@ScruffR

This comment has been minimized.

Copy link
Contributor Author

@ScruffR ScruffR commented Mar 27, 2018

@technobly, maybe this isn't really an issue of System.updatesPending() or firmware_update_pending itself, but rather one of Particle.disableUpdates(). One way to circumvent that might be not to disable the ability to recognise a pending update but rather only the download and application of that update.

Once System.disableUpdates() only blockst the latter part of the process but still "listens" for an update, the system event and System.updatesPending() could report the fact to inform the application to re-enable updates.

Hope, I expressed my line of thought clear to other readers too 😊

@m-mcgowan

This comment has been minimized.

Copy link
Contributor

@m-mcgowan m-mcgowan commented Jul 19, 2019

The 1.2.1 release connects the System.disableUpdates() API with the cloud, and now operates in a more intuitive manner in conjunction with pending updates.

@m-mcgowan m-mcgowan closed this Jul 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.