Sorry for posting this as an issue, but I’m very new to git and I didn’t know where else to publish my idea:
I found a simple solution for debouncing and eliminate interferences on the limit switches by adding some subsequent extra reads of the inputs in the ISR before firing an alarm.
Since delays can’t be used in an ISR, I do an adjustable number of reads, in my case 3 worked fine.
I added following declarations in the top of “grbl_limits.cpp”:
“C`
volatile byte readresult=0;
#define DEBOUNCEREADS 3
Then, at the beginning of void IRAMATTR isrlimit_switches(), I do subsequent readings of the limit inputs:
`C`
readresult=0;
for (byte N=0; N
}
Only if ALL subsequent reads show a triggered input, the rest of the ISR shall be executed. So I wrapped the whole rest of the code in this condition:
`C“
if (readcount==DEBOUNCEREADS){
if ( ( sys.state != STATEALARM) & (bitisfalse(sys.state, STATE_HOMING)) ) {
if (!(sysrtexec_alarm)) {
[...]
}
}
}
Before my modification, I had some very annoying alarm triggers by interferences from my HF spindle, despite of having applied all hardware means of debouncing (capacitors and strong pullups). The modification eliminiated all theses interferences!
**BUT BEWARE!! :
My modified code doesn’t take into account any inverting settings for the limit pins!**
As I’m not so deep in the grbl code, I just didn’t know how to manage this…
Perhaps someone could pick up the idea and correct the code?
评论 (6)
#4 – luc-github 于 2019-04-28
@vogtitec indeed there is a bug in sending realtime command in webUI – I am looking at it now
seems command sending String.fromCharCode(0xA1) send actually 0xC2 and 0xA1, and command sending String.fromCharCode(0xA0) send …nothing, they are not printable char so the behavior is may be not accurate, I will find a solution ASAP
#5 – bdring 于 2019-04-28
@vogtitec Thanks for testing that. I’ll put that in the devt branch merge it with master soon.
#6 – bdring 于 2019-04-28
@vogtitec I am working with @luc-github on the spindle button and he fixed an issue, but the way that button works is not very clear.
If you are running a job with a spindle on and you do a feed hold, that button allows you to toggle the spindle off and then back on. If you resume the job, the spindle will come back on regardless of where you left the toggle state. The Mist and Flood buttons work in a similar fashion.
This is an advanced feature of Grbl that I really did not fully understand until now. We might change that panel title to “Overrides” to help make that clearer.
A spindle control panel doing what you want would require a speed value to work. M3 without an S value is a problem.
#1 – bdring 于 2019-04-24
I added this to the roadmap
AVR Grbl uses a timer to do this controlled by #define ENABLESOFTWAREDEBOUNCE in config.h
I am worried that 3 iterations would run so fast that it might not work for all people, but increasing that might affect performance. We also have the option of using a task instead of a timer.