Change jam detection behavior in dev

I'm using jam detection with a microswitch to trigger high when out if filament. It works fine. Bit I don't know that it's out till I look at the printer. Can I modify the gcode so that I can add an m300 to ring the buzzer to alert me somethings going on?

That would be very helpful. Thank you!

Comments

  • You could simply add a beeper call in
    void Printer::handleInterruptEvent() {

    where is the case for jam detected.
  • Would you mind sharing a sample syntax. It'll take me a while to figure the proper format. Pls and thank you!
  • edited November 2016
    Just add something like this 

     HAL::tone(BEEPER_PIN, 10000); // frequency 
     HAL::delayMilliseconds(500); // duration 
     HAL::noTone(BEEPER_PIN);
  • Awesome, thx will try that and post back
  • awesome, worked perfect, thank you!   It's simple enough for now, but maybe oneday, I'll have it do some melody :P

    Would be cool if this were added to the configurator tool for dev.  since sometimes the printers in another room, you may not see that it's paused/jammed.
    image
  • Maybe. I think about it if I want to bloat the configuration monster a bit more:-)
  • It's not bloated at all. You've done an excellent job. Every option there has its purpose.
  • @repetier, did you decide to add this option to the configuration?  I'll post the details of my changes later, but it would be nice to have this configurable.
  • Currently I'm still more against it. Most printers have it nearly unhearable and if you do not hear the printer is idle you most probably will also not hear a short beep.
  • I'll have to post my config as it's definitely hearable OK mine and it beeps for 60 seconds. So I hear it from other rooms in the house. I understand not including it, but would be great to have some documentation on manually adding it.

    Thank you for the consideration!
  • edited December 2016
    @repetier maybe I'm doing something wrong.  I added those HAL commands you mentioned above, but I think they're in the wrong place.  When a "jam" event went off, the printer would reset.  Does the below look close to correct?
    this is in printer.cpp starting @ line 2051

    void Printer::handleInterruptEvent() {
        if(interruptEvent == 0) return;
        int event = interruptEvent;
        interruptEvent = 0;
        switch(event) {
    #if EXTRUDER_JAM_CONTROL
        case PRINTER_INTERRUPT_EVENT_JAM_DETECTED:
            //HAL::tone(BEEPER_PIN, 2000); // frequency 
            //HAL::delayMilliseconds(30000); // duration 
            //HAL::noTone(BEEPER_PIN); //beeper pin
            EVENT_JAM_DETECTED;
            Com::printFLN(PSTR("important:Extruder jam detected"));
            UI_ERROR_P(Com::translatedF(UI_TEXT_EXTRUDER_JAM_ID));
    #if JAM_ACTION == 1 // start dialog
            Printer::setUIErrorMessage(false);
    #if UI_DISPLAY_TYPE != NO_DISPLAY
            uid.executeAction(UI_ACTION_WIZARD_JAM_EOF, true);
    #elif JAM_ACTION == 2 // pause host/print
    #if SDSUPPORT
            if(sd.sdmode == 2) {
                sd.pausePrint(true);
                break;
            }

  • You block everything with your delay, so host will timeout and watchdog will trigger (reset). Reduce tone to 1-2s to prevent watchdog triggering. Not sure how fast it triggers. But I don't think it takes more then 4s to trigger it might be less.
  • Meh. That won't work as intended again. I'll never hear a tone that's running for 2 seconds. I'd really like to find a way around this as I'm usually in the house but not around the printer. So I wouldn't know it's out of filament till I check on the printer physically
  • Would require a loop and setting the busy signal. In the loop call HAL::pingWatchdog() and Commands::checkForPeriodicalActions(false); with a short wait.
  • I'll have to look at that. It's a bit above my head at the moment. Thx for the details!
  • I mean like this:

    HAL::tone(BEEPER_PIN, 2000); // frequency 
    for(int j=0;j<1000;j++) {
      HAL::delayMilliseconds(30); // duration 
      HAL::pingWatchdog() ;
      Commands::checkForPeriodicalActions(false);
    }
    HAL::noTone(BEEPER_PIN); //beeper pin
Sign In or Register to comment.