Electron - code to reset it like unplug the battery

I’m looking for a robust code to reset the Electron like a cold reset (unplug battery).
Sometime happens that the Electron stop working and I would like to reset it because it’s not easy to go there and physically reset it.
At this moment my software is quite good but I am not using SYSTEM_THREAD and my actual watchdog just perform a system.reset, but I’ve read that the system reset didn’t reset the modem, and most of time I’ve found that connection is the problem.

Is it a good idea to:

  • add the SYSTEM_THREAD(ENABLED);
  • add ApplicationWatchdog wd(300000, watchdogCallback);
    void watchdogCallback() {
    	Particle.disconnect();
    	Cellular.command(30000, "AT+CFUN=16\r\n");  // credit here https://github.com/rickkas7/electronsample/blob/master/electronsample.cpp
    	Cellular.off();
    	delay(1000);
    	System.reset();
    }

I would keep the automatic mode in the main loop, and it will looks like this:

void loop() {
	// every 5 seconds collect data

	// after 60 seconds publish data to the cloud
	if(Particle.connected()) {
		// publish then sleep - reset at the end
		System.sleep(SLEEP_MODE_DEEP, _seconds, SLEEP_NETWORK_STANDBY);
	} else {
  		**while(1);**
	}
	wd.checkin();
}

I have few timers and every 5 seconds it collect data, after 60 seconds it check if is h:00 / h:15 / h:30 / h/45 and it publish to the cloud.

Does it make sense? Any idea to make it simple??

Just keep thinking, my code is quite simple, it ran for two minutes every 15 during daylight and every hour during night.
In the daylight after publish some data to the cloud it go sleep with System.sleep(SLEEP_MODE_DEEP, _seconds, SLEEP_NETWORK_STANDBY); during the night with System.sleep(SLEEP_MODE_SOFTPOWEROFF, _seconds);

What I found is that using the automatic mode if there is a connection problem it wait for connection, I think the watchdog is not triggered.

A simple semiautomatic mode with watchdog before a particle.connect() in the setup will solve this issue?!
I mean keeping the non thread version. But using the code above for the watchdog callback.