How to let RRF know my arduino is still alive
-
@bitofadummy said in How to let RRF know my arduino is still alive:
β¦ if mid-print the IR-sensor dies, or teensy hangs for whatever reason β¦
Donβt happen to know the Teensy, but with an Arduino, you can use the built-in watchdog to detect a hanging program. However, a controller should not die out of the blue, so you need to look for the reason. In most cases, the controller runs out of RAM or exhausts the stack. I think you will have to rework your sketch.
-
@infiniteloop
Whell the last time it happened the teensy hung mid print was because of af bad solder connection of the IR-sensor, and the library for that melexis sensor makes Teensy hang. So I am looking in on to how to avoid that. But it made me realize that there can be other bugs that makes the teensy stop working...But thank you for the watchdog tip, I will look into that to!
-
the library for that melexis sensor makes Teensy hang.
Do you use the mlx90614? With a quick DuckDuckGo search for "arduino mlx90614", I found at least a second library from Adafruit which you might prefer over the one provided by Melexis. Maybe you find other libraries as well. Generally, you should never use libraries who tend to mess-up your Arduino
-
Different Teensys have differing watchdog timers. The main gotcha I know of is that on Teensy LC if you use the hardware watchdog you're stuck with it - once you set it running you can't switch it off, so you then need to service it indefinitely (until you reset the chip). It also has limited timeout options.
You could use a variable rather than a fake fan, e.g. put
global tick=0
in config.sys and have the teensy sendset global.tick=1
and damon.g canset global.tick=0
.(I haven't tested that the duet responds to meta-gcode on the serial ine, but that's the only thing that would stymie this approach, I think).Yes, it works (at least on RRF 3.4.4). I've put a teensy sendingset global.tick=1
on the serial port every five seconds, and then you can watch the variable in the object model viewer - set it to something else and see it jump back to 1. -
@achrn I like your approach but Iβd probably reverse it. Have daemon.g keep adding to a global timeout variable and have the board keep setting it to zero. If your timeout goes above a threshold you could post a notification
-
@infiniteloop
I agree ! -
@achrn
Wow, that was what I was looking for,
works great thanks! -
@Sindarius
Yes, I added you option as well. It prevents a fals trigger at startup as daemon.g runs every 10 seconds.
Now daemon.g runs 5 times before it is triggered and halts a print.
very nice ! -
well I wanted to end by showing my code, but it gets rejected as spam...
-
@bitofadummy try again, I upvotes a few posts so that might help get it past the spam filters