# Blocking Particle.connect() and publish()

**URL:** <https://community.particle.io/t/blocking-particle-connect-and-publish/46497>\
**Category:** Firmware\
**Created:** [December 21, 2018, 9:16pm UTC](https://community.particle.io/t/blocking-particle-connect-and-publish/46497 "2018-12-21T21:16:23Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![Rftop](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rftop/32/16896_2.png) [@Rftop](https://community.particle.io/u/Rftop)\
**Post date:** [December 26, 2018, 8:29pm UTC](https://community.particle.io/t/blocking-particle-connect-and-publish/46497/9 "2018-12-26T20:29:54Z")

</div>

My understanding from the comments in your other [Post](https://community.particle.io/t/correctly-turning-off-the-cellular/46031) was this would best be accomplished with MANUAL Mode :

> [@Correctly turning off the Cellular?](https://community.particle.io/t/correctly-turning-off-the-cellular/46031/7):
>
> One difference between SEMI\_AUTOMATIC and MANUAL with SYSTEM\_THREAD(ENABLED) is that some functions are non-blocking in MANUAL mode while they are (under some circumstances) in SEMI\_AUTOMATIC mode.

But you have reasons to not want to modify your code for Manual Mode.

So, If you use an external watchdog, you still have the possibility of the Electron burning through battery for the full length of your timer interval during a Code Crash (1 hour cycle would be too long, especially considering the next connection attempt could fail/lockup).

If you perform 5 min Deep Sleep with an external watchdog as @RWB suggests, the only thing the Electron would do every wake cycle would be to Pet the H/W watchdog, increment a counter, and enter another 5 min Deep Sleep until it's time to publish. That seems realistic without requiring too much modification of your Code and shouldn't take too many milliseconds of precious battery power.

I guess you have to decide what's the power cost of waking at a short interval to kick the external watchdog, verses the power lost during a LONG interval while your Electron is "locked-up". But either way, the external watchdog "should" eliminate the need to manually reset the Electron.

Or Manual & Threaded using `(waitFor(Particle.connected, connectionFail)` and not have a hardware revision 🕶

---

_[View the full topic](https://community.particle.io/t/blocking-particle-connect-and-publish/46497)._
