MarlinFirmware / Marlin

Marlin is an optimized firmware for RepRap 3D printers based on the Arduino platform. Many commercial 3D printers come with Marlin installed. Check with your vendor if you need source code for your specific machine.
https://marlinfw.org
GNU General Public License v3.0
16.26k stars 19.23k forks source link

FILAMENT_RUNOUT_SENSOR not working? #4090

Closed lavato closed 8 years ago

lavato commented 8 years ago

I am trying to use the FILAMENT_RUNOUT_SENSOR option for printer to pause when there is no filament however, it does not seam to work.

I use RC6 latest DEV with RAMPS EEB config and filament sensor which is HIGH (4.9v) on the signal side when the filament is not available. Regardless if I supply HIGH to Signal or not (which I do manually when testing) nothing happens, printer does not pause.

I have tried two pins D4 (servo) & D2 (X_MAX) both don't work.

When trying D4, I did below updates to config:

#define FILAMENT_RUNOUT_SENSOR
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
  const bool FIL_RUNOUT_INVERTING = true;
  //#define ENDSTOPPULLUP_FIL_RUNOUT  **<--Commented out**
  #define FILAMENT_RUNOUT_SCRIPT "M600"
#endif

d4

When trying D2, I did the same as for D4 put also did update the "pins_RAMPS_14.h" with below:

#if ENABLED(FILAMENT_RUNOUT_SENSOR)
  #define FILRUNOUT_PIN     2
#endif

d2

Is there something else which needs to be set or this is a bug?

thinkyhead commented 8 years ago

I presume you are testing with SD printing? (It only interrupts the print when SD printing.)

lavato commented 8 years ago

Yes

thinkyhead commented 8 years ago

I've made some tweaks to this feature, but probably not anything that will affect your results. Still, start with the latest code and try also changing FIL_RUNOUT_INVERTING to false, both with and without ENDSTOPPULLUP_FIL_RUNOUT, to see if the results change.

lavato commented 8 years ago

I tried all combinations but it did not work, since the TRIGGER is on HIGH. If something, it should be a pull down.

To prove a point I un-commented #define USE_XMAX_PLUG and I get a following output. For first M119 the signal is LOW and for the second one the signal is HIGH.

SENDING:M119
Reporting endstop status
x_min: open
x_max: TRIGGERED
y_min: open
z_min: TRIGGERED
>>>m119
SENDING:M119
Reporting endstop status
x_min: open
x_max: open
y_min: open
z_min: TRIGGERED

This proves that the wiring is correct at least.

Note, that it does not mater what I do, ether setting the signal pin to HIGH or LOW, the printer will not pause.

Because this never worked for me, can you tell me when does Marlin start checking for the status of the pin, e.g. Is it from the moment the print start or during the warm-up?

In any case, I waited for the printer to actually start printing and then supplied the HIGH/LOW signal but still no luck.

thinkyhead commented 8 years ago

It's pretty straightforward…

  #if ENABLED(FILAMENT_RUNOUT_SENSOR)
    if (IS_SD_PRINTING && !(READ(FIL_RUNOUT_PIN) ^ FIL_RUNOUT_INVERTING))
      handle_filament_runout(); // Send "M600" command
  #endif

If you have FILAMENTCHANGEENABLE enabled then when SD printing it should run the M600 command soon after receiving the signal from the runout sensor.

lavato commented 8 years ago

I did some digging myself and want to point out couple of things:

Serial output, when pin set to HIGH, from :

//Serial output commands removed
  #if ENABLED(FILAMENT_RUNOUT_SENSOR)
    if (IS_SD_PRINTING && !(READ(FIL_RUNOUT_PIN) ^ FIL_RUNOUT_INVERTING))
      handle_filament_runout(); // Send "M600" command
  #endif

is:

IS_SD_PRINTING: 1
READ(FILRUNOUT_PIN): 1
FIL_RUNOUT_INVERTING: 1
IS_SD_PRINTING && !(READ(FILRUNOUT_PIN) ^ FIL_RUNOUT_INVERTING): 1
thinkyhead commented 8 years ago

M600 command via Pronterface, again nothing happens

So you definitely have FILAMENTCHANGEENABLE enabled too…? Hmm, strange behavior.

filament_ran_out in Marlin_main.cpp not being reset

Right. Actually the M600 handler resets it, so it's the only supported command for the runout script.

lavato commented 8 years ago

If you have FILAMENTCHANGEENABLEenabled then when SD printing it should run the M600 command soon after receiving the signal from the runout sensor.

and

So you definitely have FILAMENTCHANGEENABLEenabled too…? Hmm, strange behavior

Oh, I missed this earlier. I don't actually. However I noticed below code which would prevent FILAMENTCHANGEENABLE be set as I have REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER

#if ENABLED(ULTIPANEL)
  //#define FILAMENTCHANGEENABLE
  #if ENABLED(FILAMENTCHANGEENABLE)

Any suggestions?

thinkyhead commented 8 years ago

code which would prevent FILAMENTCHANGEENABLE

Simply enable the option. ULTIPANEL is set in Conditionals.h when you select REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER

#if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
  #define DOGLCD
  #define U8GLIB_ST7920
  #define REPRAP_DISCOUNT_SMART_CONTROLLER
#endif

#if ENABLED(ULTIMAKERCONTROLLER) || ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) || ENABLED(G3D_PANEL) || ENABLED(RIGIDBOT_PANEL)
  #define ULTIPANEL
  #define NEWPANEL
#endif
lavato commented 8 years ago

OK, that worked - Thank you!

May I suggest couple of points:

1) Can comments be updated in the 'Configuration.h' next to section for FILAMENT_RUNOUT_SENSOR, as it is not apparent at all that this has to be done.

2) The FILAMENT_RUNOUT_SENSOR process starts polling during the warm-up and auto level, shouldn't it start polling when the printing actually starts printing, as if you have a sensor which detects blockages, it will trigger during the warm-up since the filament is not moving?

3) The "Change Filament" message does not disappear from the LCD screen once print is resumed.

thinkyhead commented 8 years ago

shouldn't it start polling when the printing actually starts printing

I suppose so. There's no concept in Marlin of "currently printing" but it can do things like monitor the sensor whenever there has been a recent movement command.

thinkyhead commented 8 years ago

The "Change Filament" message does not disappear from the LCD screen once print is resumed.

The current M600 feature is going to be replaced pretty soon. But this sounds like something we could fix up in advance of that.

lavato commented 8 years ago

I suppose so. There's no concept in Marlin of "currently printing" but it can do things like monitor the sensor whenever there has been a recent movement command.

and

But this sounds like something we could fix up in advance of that.`

Is it best to raise the above two as separate issues?

jbrazio commented 8 years ago

The big question is what do we should consider "printing", is it moving the tower ? Is it extruding plastic ? We don't have a "start" and a "stop" command, we do some eyeballing and guessing for the print timers but that's not accurate enough to detect a printing state.

lavato commented 8 years ago

I know what you mean... but isn't it better to start polling when extruding plastic then during the heat-up sequence, would't you say?

github-actions[bot] commented 2 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.