A strange question about the Magnetic Filament Sensor
-
@TheDragonLord One option is to play with the parameters of M591:
- Raa:bb - extreme values may suppress some false positives
- Enn - high distances (mm) may help, but are problematic with direct extruders
The second option I see is to write a macro filament-error.g to prevent the call of pause.g. For this to work, you need two global variables:
- a counter
- a timestamp
Within the macro, use something like this:
- Reset the counter if the last macro call happened some time ago.
- Else, increment the counter
- If the counter amounts to several frequent events, call pause.g
- Update the (global) timestamp
-
@TheDragonLord I'd probably just fit a simple runout switch, made from a microswitch (if you have a spare one) in a printed case; plenty of them on thingiverse. The rotating magnetic filament sensor has recently had an overhaul, and the new version is much improved in sensitivity and reliability. Not sure if it is available yet... @T3P3Tony ?
Ian
-
@infiniteloop thanks! The second choice looks more actrative to an old programmer like me!
I'll give it a try!
Thanks -
@droftarts said in A strange question about the Magnetic Filament Sensor:
@TheDragonLord I'd probably just fit a simple runout switch, made from a microswitch (if you have a spare one) in a printed case; plenty of them on thingiverse. The rotating magnetic filament sensor has recently had an overhaul, and the new version is much improved in sensitivity and reliability. Not sure if it is available yet... @T3P3Tony ?
Ian
Unfortunately at now I haven't got any endstop in my house, optical or mechanical...the solution to use the rotating sensor is temporary just to run the print I have to run urgently before the new optical switch arrive from the eshop... I didn't know a new rotaing sensor has been developed, is there a documentation about?
-
@infiniteloop said in A strange question about the Magnetic Filament Sensor:
@TheDragonLord One option is to play with the parameters of M591:
- Raa:bb - extreme values may suppress some false positives
- Enn - high distances (mm) may help, but are problematic with direct extruders
The second option I see is to write a macro filament-error.g to prevent the call of pause.g. For this to work, you need two global variables:
- a counter
- a timestamp
Within the macro, use something like this:
- Reset the counter if the last macro call happened some time ago.
- Else, increment the counter
- If the counter amounts to several frequent events, call pause.g
- Update the (global) timestamp
Naming the macro filament-error.g will assure it will be called automatically every time a sensor-error will occur?
-
@TheDragonLord said in A strange question about the Magnetic Filament Sensor:
Naming the macro filament-error.g will assure it will be called automatically every time a sensor-error will occur?
Yes. That's documented here. Although, please note that this will only work with RRF 3.4 or better.
-
@infiniteloop said in A strange question about the Magnetic Filament Sensor:
@TheDragonLord said in A strange question about the Magnetic Filament Sensor:
Naming the macro filament-error.g will assure it will be called automatically every time a sensor-error will occur?
Yes. That's documented here. Although, please note that this will only work with RRF 3.4 or better.
Thanks, I've installed the latest stable RRF version so it should work
-
@infiniteloop said in A strange question about the Magnetic Filament Sensor:
@TheDragonLord One option is to play with the parameters of M591:
- Raa:bb - extreme values may suppress some false positives
- Enn - high distances (mm) may help, but are problematic with direct extruders
The second option I see is to write a macro filament-error.g to prevent the call of pause.g. For this to work, you need two global variables:
- a counter
- a timestamp
Within the macro, use something like this:
- Reset the counter if the last macro call happened some time ago.
- Else, increment the counter
- If the counter amounts to several frequent events, call pause.g
- Update the (global) timestamp
May I ask you a question? I've read the documentation about the use of variables and functions (https://docs.duet3d.com/en/User_manual/Reference/Gcode_meta_commands). I can't understand how can I initialize a DateTime variable with the "actual" timestamp to use it later in the macro to determine the time passed form the previous call. I've seen the function datetime but it's used to convert the variable in signature to a DateTime. Other than that a global variable has to be declared ONLY in config.g or is it possible to declare it even in an "external" macro?
Thanks
-
@TheDragonLord
May I ask you a question?
Sure. Sorry for being a bit late with the answer …
It is good practice to declare global vars in config.g because their scope is really global. You can declare them elsewhere (e.g. in a macro), but with the risk of dependencies on the calling sequence. Another option is to declare all globals in a macro which is then called from config.g.
how can I initialize a DateTime variable with the "actual" timestamp?
You can use state.upTime from the object model. That’s the uptime in seconds. For the given purpose, its resolution is OK.
-
@infiniteloop excellent,thanks for the precious help!
-
i have great performance from the magnetic runout sensor. but when i do have false positives, i simply widened the limits to 10% to 190%, and this lets the printe run unless there is zero filament movement. but i mostly don't have to do this.
but i now want to try the idea using the counter and global variables.