Comments (7)
Which driver version? Please post the $I
response.
When using wait_on_input()
for anything else than immediate mode then a reasonable timeout has to be provided. If wait_on_input()
times out it returns -1
, you will have to test for that.
In plugin code you may consider registering an interrupt handler instead, support for this has recently been added to a number of drivers. The function pointer is non-zero if registering is supported.
Note that there is no debounce performed on aux inputs.
from core.
[VER:1.1f.20210629:]
[OPT:VNMZHS2,35,1024,3,0]
[NEWOPT:ENUMS,RT+,HOME,ES,TC]
[FIRMWARE:grblHAL]
[NVS STORAGE:*FRAM]
[DRIVER:iMXRT1062]
[DRIVER VERSION:210703]
[DRIVER OPTIONS:USB.2]
[BOARD:GRBLHAL2000 - PRINTNC]
[AUX IO:4,0,0,0]
[PLUGIN:RGB Indicator Lights v0.4]
Ah, so I need to implement debounce regardless of the method, that is what I needed to know.
from core.
Ideally I would like to trigger on low or falling but the board becomes inaccessible if I use them.
It crashes or hangs for the duration of the wait? wait_on_input()
with timeout > 0 blocks until the event or the timeout expires.
Ah, so I need to implement debounce regardless of the method
Yes, if you really need debounce. Currently the best method will be to register an interrupt handler, when called deregister it and delay, then read the input in immediate mode (and take the neccesary action) and reregister the handler. You may also set a flag instead of deregister/reregister, this to ignore further calls to the handler and/or check the input in your real time handler (IIRC you subscribe to the on_execute_realtime
event).
A delay (or any code that takes a long time to process) should not be executed in an interrupt handler, use protocol_enqueue_rt_command() to register a function to be executed (once) from the foreground process instead.
from core.
Great, thank you. Very helpful.
from core.
i'd like to add an aux-input for my tool setter over travel alarm line. I haven't been able to find an example of aux-in being used for a signal like this in any other plugins, is there an example you can point me to? I want to assert ALARM/ESTOP in the event this signal is tripped.
from core.
If you register an interrupt handler for the input pin then set the relevant signal when asserted and call hal.control.interrupt_callback.
If you want status report to show the correct status hook your code into hal.control.get_state . Save away the original fn pointer first (e.g to get_state_org
as in the example below).
In your replacement read the original status and "or" the input with the original.
control_signals_t get state (void):
{
control_signals_t signals = get_state_org();
signals.e_stop |= (hal.port.wait_on_input(true, <port>, WaitMode_Immediate, 0.0f) == 1);
return signals;
}
<port> is the port id you want to use.
The Bluetooth plugin uses interrupt for an aux input pin and may serve as an example for how to do that.
from core.
Terje,
I was able to address my situation with just a simple check of the pin during the loop, as all I want to do is to switch a light on when a button is pressed. It doesn't require interrupt level urgency, it's just for improved visibility and I don't perceive any delay when using it.
It will appear in a pending up date to the RGB plugin.
from core.
Related Issues (20)
- protocol_enqueue_gcode does not set last_error HOT 3
- probe enabled by default HOT 1
- MKS Tinybee cannot connect to the router using STA HOT 3
- Cannot Restore After Feedhold When Issued During Change of Spindle State HOT 10
- Not an issue: Want to know if macro variables are available for $342 to $344. HOT 3
- Tool table offsets are not persistent over power cycle HOT 6
- Joggin unavailable for many commands HOT 3
- Lathe Diameter/Radius offset report issue HOT 1
- kinda vfd support HOT 3
- Macro Issue that I can not figure out. HOT 6
- I noticed that the current Setting_AxisStepsPerMM setting has 5 zeros after the decimal point. Is there any reason for doing this? HOT 2
- regression in websocket init_message caused by commit a912ce4 HOT 1
- Is the data in the driver capabilities list dependably up to date? HOT 2
- set machine origin to 0, or bit3, not working for $22 HOT 5
- octopus max STM32H723 HOT 1
- Not correctly reporting coordinates? HOT 4
- Experiencing issues with ESP32 Blackbox Build HOT 10
- How to limit the maximum output pulse frequency to prevent the user from setting an excessively high pulse rate that could cause grblHAL to crash? HOT 1
- Delta Kinematics: Y axis moves are not executing correctly - Motor duplication? HOT 1
- Syntax error / typo in ngc_expr.c HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from core.