Hello,
I have discovered a case where a device can hang when using the ab1805 driver GitHub - rickkas7/AB1805_RK: Library for AB1805/AM1805 RTC/Watchdog for Particle devices.
I am using an MSOM on 5.8.2, but I don't believe that matters here.
It can occur in ab1805.loop()
due to the Particle.timeSyncedLast()
call in the condition:
(!timeSet && Time.isValid() && Particle.timeSyncedLast() != 0)
This case can occur when a device is booting up and connecting to Particle using the time stored on the ab1805. Using the time stored on the ab1805 means that Time.isValid()
will return true, leading to the call to Particle.timeSyncedLast()
before the device is connected.
Particle docs mention that this call can hang.
I am wondering what a good workaround for this would be. It looks like the purpose of this condition is to sync the ab1805 with the latest time from Particle when the first connection is made.
I am thinking it can be as simple as adding an additional check to Particle.connected()
before Particle.timeSyncedLast()
, but I know that time isn't synced at the exact moment Particle.connected()
returns true, so there could be some slight hanging there potentially.
It seems strange that this call would hang, it seems like it would just be retrieving a timestamp from somewhere stored in a device os. I looked a bit into the internals and can see that it runs in the context of the system thread and am wondering why that is necessary.