Prevent an imp’s WiFi sub-system from being powered down
Device (from impOS™ 42)
Not available on impC001
This method can be used to prevent the imp’s WiFi sub-system from being powered down*, even when the WiFi connection is broken manually by calling server.disconnect(). This allows you to avoid situations where bringing up a powered-down WiFi sub-system introduces unwanted Squirrel latency to your application.
Note Keeping the WiFi sub-system powered continuously will have a major impact on imp power draw so this method only intended for use in mains-powered applications.
From a cold boot or wake from deep sleep, the imp will be able to power down the WiFi sub-system, so you should include your call to imp.net.latchwifipower() as early as possible in your device code.
The setting will persist through Squirrel reloads, but it will be cleared by deep sleep or calling imp.reset(). Indeed, the latter call can be used to re-enable the imp’s default behavior.
* imp.net.latchwifipower() is not guaranteed to never power down WiFi, only to do so in normal situations. Even if the method is called, impOS may still power down WiFi if it needs to recover in the event of an internal WiFi error.
This method is not available on imps without integrated WiFi cores (currently impC001). It is also unavailable on the imp005.