такие публикации кода лишены смысла, поскольку заведомо устарели.
нужно публиковать патчи, тогда их актуальность будет продолжительной, до кординальных правок исходника
			
		|  | roboforum.ruТехнический форум по робототехнике. |  | 



// Add support for experimental filament exchange support M600; requires display
#if ENABLED(ULTIPANEL)
  //#define FILAMENTCHANGEENABLE
  #if ENABLED(FILAMENTCHANGEENABLE)
    #define FILAMENTCHANGE_XPOS 3
    #define FILAMENTCHANGE_YPOS 3
    #define FILAMENTCHANGE_ZADD 10
    #define FILAMENTCHANGE_FIRSTRETRACT -2
    #define FILAMENTCHANGE_FINALRETRACT -100
    #define AUTO_FILAMENT_CHANGE                //This extrude filament until you press the button on LCD
    #define AUTO_FILAMENT_CHANGE_LENGTH 0.04    //Extrusion length on automatic extrusion loop
    #define AUTO_FILAMENT_CHANGE_FEEDRATE 300   //Extrusion feedrate (mm/min) on automatic extrusion loop
  #endif
#endif

 
 
 ,
,




stepmotor писал(а):Да, что-то смена прутка неадекватно работает
Надо подумать, прям интересно
 )
 ) inline void gcode_M600() {
    if (degHotend(active_extruder) < extrude_min_temp) {  // Проверяем температуру, если она ниже минимальной то выводим ошибку.
      SERIAL_ERROR_START;
      SERIAL_ERRORLNPGM(MSG_TOO_COLD_FOR_M600);
      return;
    }
    float lastpos[NUM_AXIS], fr60 = feedrate / 60;  //запоминаем позицию и тукущую подачу.
    for (int i = 0; i < NUM_AXIS; i++)
      lastpos[i] = destination[i] = current_position[i];
    #if ENABLED(DELTA)
      #define RUNPLAN calculate_delta(destination); \
                      plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], destination[E_AXIS], fr60, active_extruder);
    #else
      #define RUNPLAN line_to_destination();
    #endif
    //retract by E
    if (code_seen('E')) destination[E_AXIS] += code_value();
    #ifdef FILAMENTCHANGE_FIRSTRETRACT
      else destination[E_AXIS] += FILAMENTCHANGE_FIRSTRETRACT;
    #endif
    RUNPLAN;
    //lift Z
    if (code_seen('Z')) destination[Z_AXIS] += code_value();
    #ifdef FILAMENTCHANGE_ZADD
      else destination[Z_AXIS] += FILAMENTCHANGE_ZADD;
    #endif
    RUNPLAN;
    //move xy
    if (code_seen('X')) destination[X_AXIS] = code_value();
    #ifdef FILAMENTCHANGE_XPOS
      else destination[X_AXIS] = FILAMENTCHANGE_XPOS;
    #endif
    if (code_seen('Y')) destination[Y_AXIS] = code_value();
    #ifdef FILAMENTCHANGE_YPOS
      else destination[Y_AXIS] = FILAMENTCHANGE_YPOS;
    #endif
    RUNPLAN;
    LCD_ALERTMESSAGEPGM("Выгрузка прутка !");
    if (code_seen('L')) destination[E_AXIS] += code_value();
    #ifdef FILAMENTCHANGE_FINALRETRACT
      else destination[E_AXIS] += FILAMENTCHANGE_FINALRETRACT;
    #endif
    RUNPLAN;
    //finish moves
    st_synchronize();
    
    millis_t next_tick = 0;
    while (!lcd_clicked()) {
      LCD_ALERTMESSAGEPGM("Пруток вставлен ?");
      millis_t ms = millis();
      if (ms >= next_tick) {
      lcd_quick_feedback();
      next_tick = ms + 1000; //
      }
        manage_heater();
        manage_inactivity(true);
        lcd_update(); 
    }
  
    //disable extruder steppers so filament can be removed
    disable_e0();
    disable_e1();
    disable_e2();
    disable_e3();
    delay(300);
    
    #if ENABLED(AUTO_FILAMENT_CHANGE)
      current_position[E_AXIS] = 0;
      st_synchronize();
    #endif
    
    LCD_ALERTMESSAGEPGM("Загузка прутка !"); 
    //return to normal
    if (code_seen('L')) destination[E_AXIS] -= code_value();
    #ifdef FILAMENTCHANGE_FINALRETRACT
      else destination[E_AXIS] -= FILAMENTCHANGE_FINALRETRACT;
    #endif
    next_tick = 0; 
    while (!lcd_clicked()) {  
        current_position[E_AXIS] += AUTO_FILAMENT_CHANGE_LENGTH;
        destination[E_AXIS] = current_position[E_AXIS];
        line_to_destination(AUTO_FILAMENT_CHANGE_FEEDRATE);
        st_synchronize();
    }
    lcd_quick_feedback(); // click sound feedback
    
  //  lcd_reset_alert_level();
    #if ENABLED(DELTA)
      // Move XYZ to starting position, then E
      calculate_delta(lastpos);
      plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], destination[E_AXIS], fr60, active_extruder);
      plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], lastpos[E_AXIS], fr60, active_extruder);
    #else
    LCD_ALERTMESSAGEPGM("Продолжаем печатать");
    
      // Move XY to starting position, then Z, then E
      destination[X_AXIS] = lastpos[X_AXIS];
      destination[Y_AXIS] = lastpos[Y_AXIS];
      line_to_destination();
      destination[Z_AXIS] = lastpos[Z_AXIS];
      line_to_destination();
      current_position[E_AXIS] = lastpos[E_AXIS];
      st_synchronize();
    #endif
    #if ENABLED(FILAMENT_RUNOUT_SENSOR)
      filrunoutEnqueued = false;
    #endif
  }

#if ENABLED(FILAMENTCHANGEENABLE)  // Смена нити
  /**
   * M600: Pause for filament change
   *
   *  E[distance] - Retract the filament this far (negative value)
   *  Z[distance] - Move the Z axis by this distance
   *  X[position] - Move to this X position, with Y
   *  Y[position] - Move to this Y position, with X
   *  L[distance] - Retract distance for removal (manual reload)
   *
   *  Default values are used for omitted arguments.
   *
   */
Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 0