Prevent Init Button from being pressed twice.
Posted: Tue Jan 10, 2023 3:42 pm
Hi Tom,
Before I get back to tuning I was cleaning up some safety logic in our code. I'm looking for a way to have the "Init" button disabled after being pressed once. I tried using a persist variable , but since it's initialized before my routine, pressing Init once more re-initializes that variable and so I cannot use it to prevent a second Init to happen. If Init is pressed a second time, my machine bugs (partly because it re-inits the axes and affects my tachometer logic).
Any clever way to disable a button from being used again? Maybe there's code to send a .c file to another thread and then use the "startthread(n)" function to start that thread?
Thanks for your tips!
Before I get back to tuning I was cleaning up some safety logic in our code. I'm looking for a way to have the "Init" button disabled after being pressed once. I tried using a persist variable , but since it's initialized before my routine, pressing Init once more re-initializes that variable and so I cannot use it to prevent a second Init to happen. If Init is pressed a second time, my machine bugs (partly because it re-inits the axes and affects my tachometer logic).
Any clever way to disable a button from being used again? Maybe there's code to send a .c file to another thread and then use the "startthread(n)" function to start that thread?
Thanks for your tips!