Possible stack overflow.

I have been unable to resolve this. My latest code seems to freeze after about 24 hours. Any help is very appreciated!

My latest thermostat code.