Imp.setpowersave(true) persists after downloading new code

If you have used imp.setpowersave(true) in your code, and then remove this statement and run (download) the new code, the powersave mode does not return to the default value of ‘false’.
You have to explicitly call imp.setpowersave(false), or reboot the imp to revert to the default state.

I think this should be mentioned in the documentation wiki. There might be other default states that behave similarly.

That’s a good point. And you’re right that there are others: imp.enableblinkup(), for instance. And in fact most of the hardware.* API has long-lasting effects, too: if you set a pin as a driven, push-pull output, and then download new code that doesn’t touch that pin at all, then it keeps its old configuration.

Peter

Good to know!
Are there any plans to change this behaviour in future releases?

@peter

When this is still the case, a one-liner in the documentation for relevant API calls and introduction material would be good.

Will a power cycle or a prolonged power outage revert settings to original values?

I would prefer to start all sketches explicitly setting some or all of these to known states.

A power-cycle resets all settings, as indeed does a deep-sleep or (on imp003) the RESET_L pin. This is a thread from quite a while ago (in imp terms!) and in fact nowadays almost all of the hardware.* APIs are reset when new Squirrel is loaded.

Peter