Howto make the filament monitor more robust
-
Hi,
we sometimes face the problem, that the filamentsensor is producing "false" errors. They are actually true from the MFM perspective resulting in 0% extrusion or even minus values, but only minor in nature e.g. due to friction or some sort of untangling of the filament spool and will not affect the print result at all.
So the current range will not work on these kind of errors.In order to reduce these "false" alarms and resulting print pause, I came up with the idea of some kind of a backoff counter.
It works the following:
- count the filament errors
- if the count will go above a threshold, pause the print.
- reduce the count if there was no filament error within a relaxe duration e.g. 60s
reduce the check distance in order not to loose resultion. e.g. from
M591 D0 P3 C"e1stop" S1 R70:120 E6 L25.3
to
M591 D0 P3 C"e1stop" S1 R70:120 E2 L25.3
with a counter of 3.
the output looks like the following below the threshold:
and above the threshold:
The code 0:/sys/filament-error.g:
; Parameter P description ; 2 = noDataReceived ; 3 = noFilament ; 4 = tooLittleMovement ; 5 = tooMuchMovement ; 6 = SensorError ; 7 = Magnet to weak ; 8 = Magnet to strong if !exists(global.mfmbackoff) global mfmbackoff = 3 if !exists(global.lastMFMBackoffCheck) global lastMFMBackoffCheck = state.upTime if param.P == 2 || param.P == 6 echo "Filament Sensor Error: " ^ param.P ^ " sensor : " ^ param.D ^ " - continue printing" M99 if param.P == 4 if exists(global.mfmcalibration) && global.mfmcalibration == true M92 E{move.extruders[0].stepsPerMm+0.1} echo "E-Steps: " ^ {move.extruders[0].stepsPerMm} ^ "" else echo "Filament Sensor " ^ param.D ^ ": Too little Filament movement - Possible Reasons: Filament empty, grinding or clogged nozzle." set global.lastMFMBackoffCheck = state.upTime if global.mfmbackoff == 0 set global.mfmbackoff = 3 M291 P{"Filament Sensor " ^ param.D ^ ": Too little Filament movement - Possible Reasons: Filament empty, grinding or clogged nozzle."} S1 T0 M25 ; pause print else set global.mfmbackoff = global.mfmbackoff - 1 echo "Filament Sensor Backoffcounter: " ^ global.mfmbackoff ^ "" M99 ; leave macro if param.P == 5 if exists(global.mfmcalibration) && global.mfmcalibration == true M92 E{move.extruders[0].stepsPerMm-0.1} echo "E-Steps: " ^ {move.extruders[0].stepsPerMm} ^ "" else echo "Filament Sensor " ^ param.D ^ ": Too much Filament movement - Possible Reasons: Spool skipped or Filament pushed into PTFE tube." M291 P{"Filament Sensor " ^ param.D ^ ": Too much Filament movement - Possible Reasons: Spool skipped or Filament pushed into PTFE tube."} S1 T0 M25 ; pause print M99 ; leave macro echo "Filament error: " ^ param.P ^ " on sensor " ^ param.D ^ " - paused" M291 P{"Filament Sensor " ^ param.D ^ ": " ^ param.S ^ " - Paused"} S1 T0 M25 ; pause
0:/sys/daemon.g:
if exists(global.mfmbackoff) && exists(global.lastMFMBackoffCheck) && global.mfmbackoff < 3 && ((global.lastMFMBackoffCheck + 60) < state.upTime) set global.mfmbackoff = global.mfmbackoff + 1 set global.lastMFMBackoffCheck = state.upTime
-