|
Forum Index : Microcontroller and PC projects : Previously Stable device crashing.
| Author | Message | ||||
| Phil23 Guru Joined: 27/03/2016 Location: AustraliaPosts: 1667 |
Hi All, Bit of a quiz, to see what answers I get, now that I think I've solved it... Story, My Coms monitor, GCMicro2 (64) has been stable forever despite a bit of screen flicker when the ESP8266 or HC-12 hit it up for some transmit power. I just never misses a beat & polls my Spa Controller, Heat Pump & Ceiling heat controller. Does up a nice VT-100 page for me to see in Teraterm, & also sends the data to two E-100's to display on their screens. So all of a sudden it's randomly crashing out to the prompt. Can run for hours before this happens & can't see the issue in teraterm, as it's done an idle disconnect from the ESP8266 when I randomly discover it. I had added a few lines of code before the issues apeared, but did check their operation & that code worked fine. I just wanted a number on the console output to give me a ball park time in hours as to when the water would be up to temp; save the mental calc based on the "Temp Rise/h", 2.12 in the above image. Avoided a Div by Zero with the IF statement. All works Ok in both the Pump running & idle state when Flowrate is zero. Checked & wiggled hardware; rechecked the code above; watched it sit running on the floor on the laptop, but was at a loss why it behave & then when not watching it stopped. Anyone wan't to put up their theory on why it might have been crashing out? See if we come up with the same answer? Cheers Phil. Edit:- Should add that this MM polls the other 3 devices & receives blocks of data (readable text) back from each device, does a Checksum on the block & if it passes, pulls it to bits & puts it in the local devices variables. Edited 2020-04-16 13:01 by Phil23 |
||||
| CaptainBoing Guru Joined: 07/09/2016 Location: United KingdomPosts: 2171 |
Morning Phil. no idea as to your mysterious shenanigans, but i developed this debug a couple of years ago - it helps massively in isolating the bit of code executing when this stuff happens http://www.fruitoftheshed.com/MMBasic.Program-Step-A-Fast-Flexible-Debugging-Aid.ashx To save messing up your display, just save teh PSTEP value to a variable then when is crashes to the prompt, print it at and that is where your code was at when it died. Also consider using the watchdog to restart your app and MM.WATCHDOG to tell if the start was because of it (i.e. an error) Edited 2020-04-16 17:52 by CaptainBoing |
||||
| Phil23 Guru Joined: 27/03/2016 Location: AustraliaPosts: 1667 |
Thanks @CaptainBoing I've fixed it now, but all the detail pointing to the problem is in the post above, I just would like to challenge everyone to spot the fail point; the one I overlooked so many times. I even caught it crash in Teraterm before my eyes today, and it was exactly what I finally realized earlier. Only the first 5 of the 6 lines posted above were new code, & the answer is in that new code. It's pretty damn simple, but admittedly I missed it time & time again. Cheers. |
||||
| disco4now Guru Joined: 18/12/2014 Location: AustraliaPosts: 1045 |
TmpScOut-TmpScInp could equal zero ? giving divide by zero F4 H7FotSF4xGT |
||||
| CaptainBoing Guru Joined: 07/09/2016 Location: United KingdomPosts: 2171 |
LOL... always something to learn. Glad it is working now |
||||
| Phil23 Guru Joined: 27/03/2016 Location: AustraliaPosts: 1667 |
Lol, Lock it in? I missed that possibility repeatedly. Then the Penny dropped. Whilst digging thru the ((((('s & )))))'s, thinking order of operations. You win the Beer! Cheers |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |