Memory reset when trying to reconnect? [SOLVED]

I noticed a problem when the core tries to reconnect to WiFi where all my variables get cleared to 0/NULL (all memory gets zeroed out I guess?). I see this happening plotting these variables to an LCD (which happen to monitor the variables (temperatures and such) already.

The core is NOT resetting as the setup() section is definitely not run, it just keeps running the loop and all pins remain in their respective in/output modes etc. Basically everything keeps running apart from the fact that my variables get cleared.

As you can imagine, this causes all sorts of problems, in my case all floating PID variables get “reset”.
Once it is connected again all is fine…

Is this a known bug/issue? Anything I can do/try ?

@BaSS, without seeing your code it is difficult to advise. Have you considered that perhaps you have an array index going out of bounds or something else which may be wiping memory in your code?

They’re all plain variables (ie: float tempWaterIn = 99.0;)

But now that I think about it… I need to double check, but I don’t think the PID setpoint gets reset to 0 (as the PIDs do recover) … and the setpoint currently is a plain (hardcoded) variable that is completely untouched otherwise…

It might be a problem with the 1-wire read outs i’m getting (even though I check the CRC) … ugh…:slight_smile:

Ugh, turns out it was a 1-wire issue where devices return all zeros and hence the CRC calculates zero as well and actually passes. Added code to check the returned 1-wire values for valid data as well as CRC.
I just happened to be displaying mostly 1-wire values on the LCD display…

I only get bad 1-wire read-backs during the connection phase however (line probably down for just a bit too long).

Thanks for looking anyways Peekay.

1 Like