Allow UBL to build without a probe
This commit is contained in:
		
							
								
								
									
										12
									
								
								.travis.yml
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								.travis.yml
									
									
									
									
									
								
							@@ -73,11 +73,17 @@ script:
 | 
			
		||||
  - opt_set ABL_GRID_POINTS_Y 16
 | 
			
		||||
  - build_marlin_pio ${TRAVIS_BUILD_DIR} ${TEST_PLATFORM}
 | 
			
		||||
  #
 | 
			
		||||
  # Test a simple build of AUTO_BED_LEVELING_UBL
 | 
			
		||||
  # Test a probeless build of AUTO_BED_LEVELING_UBL
 | 
			
		||||
  #
 | 
			
		||||
  - restore_configs
 | 
			
		||||
  - opt_enable AUTO_BED_LEVELING_UBL UBL_G26_MESH_EDITING ENABLE_LEVELING_FADE_HEIGHT BLTOUCH EEPROM_SETTINGS G3D_PANEL
 | 
			
		||||
  - opt_enable_adv CUSTOM_USER_MENUS I2C_POSITION_ENCODERS BABYSTEPPING BABYSTEP_ZPROBE_OFFSET
 | 
			
		||||
  - opt_enable AUTO_BED_LEVELING_UBL UBL_G26_MESH_EDITING ENABLE_LEVELING_FADE_HEIGHT EEPROM_SETTINGS G3D_PANEL
 | 
			
		||||
  - opt_enable_adv CUSTOM_USER_MENUS I2C_POSITION_ENCODERS BABYSTEPPING
 | 
			
		||||
  - build_marlin_pio ${TRAVIS_BUILD_DIR} ${TEST_PLATFORM}
 | 
			
		||||
  #
 | 
			
		||||
  # ...and with a probe
 | 
			
		||||
  #
 | 
			
		||||
  - opt_enable BLTOUCH
 | 
			
		||||
  - opt_enable_adv BABYSTEP_ZPROBE_OFFSET
 | 
			
		||||
  - build_marlin_pio ${TRAVIS_BUILD_DIR} ${TEST_PLATFORM}
 | 
			
		||||
  #
 | 
			
		||||
  # Test a Sled Z Probe
 | 
			
		||||
 
 | 
			
		||||
@@ -135,17 +135,6 @@
 | 
			
		||||
  extern char lcd_status_message[];
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
// Remove this if all is well with Teensy compile:
 | 
			
		||||
#if 0
 | 
			
		||||
#if AVR_AT90USB1286_FAMILY  // Teensyduino & Printrboard IDE extensions have compile errors without this
 | 
			
		||||
  inline void sync_plan_position_e() { planner.set_e_position_mm(current_position[E_AXIS]); }
 | 
			
		||||
  inline void set_current_to_destination() { COPY(current_position, destination); }
 | 
			
		||||
#else
 | 
			
		||||
  extern void sync_plan_position_e();
 | 
			
		||||
  extern void set_current_to_destination();
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if ENABLED(NEWPANEL)
 | 
			
		||||
  void lcd_setstatusPGM(const char* const message, const int8_t level);
 | 
			
		||||
  void chirp_at_user();
 | 
			
		||||
 
 | 
			
		||||
@@ -85,13 +85,16 @@ class unified_bed_leveling {
 | 
			
		||||
                  g29_phase_value,
 | 
			
		||||
                  g29_repetition_cnt,
 | 
			
		||||
                  g29_storage_slot,
 | 
			
		||||
                  g29_map_type,
 | 
			
		||||
                  g29_grid_size;
 | 
			
		||||
                  g29_map_type;
 | 
			
		||||
    static bool   g29_c_flag, g29_x_flag, g29_y_flag;
 | 
			
		||||
    static float  g29_x_pos, g29_y_pos,
 | 
			
		||||
                  g29_card_thickness,
 | 
			
		||||
                  g29_constant;
 | 
			
		||||
 | 
			
		||||
    #if HAS_BED_PROBE
 | 
			
		||||
      static int  g29_grid_size;
 | 
			
		||||
    #endif
 | 
			
		||||
 | 
			
		||||
    #if ENABLED(UBL_G26_MESH_VALIDATION)
 | 
			
		||||
      static float   g26_extrusion_multiplier,
 | 
			
		||||
                     g26_retraction_multiplier,
 | 
			
		||||
 
 | 
			
		||||
@@ -65,8 +65,7 @@
 | 
			
		||||
         unified_bed_leveling::g29_phase_value,
 | 
			
		||||
         unified_bed_leveling::g29_repetition_cnt,
 | 
			
		||||
         unified_bed_leveling::g29_storage_slot = 0,
 | 
			
		||||
         unified_bed_leveling::g29_map_type,
 | 
			
		||||
         unified_bed_leveling::g29_grid_size;
 | 
			
		||||
         unified_bed_leveling::g29_map_type;
 | 
			
		||||
  bool   unified_bed_leveling::g29_c_flag,
 | 
			
		||||
         unified_bed_leveling::g29_x_flag,
 | 
			
		||||
         unified_bed_leveling::g29_y_flag;
 | 
			
		||||
@@ -75,6 +74,10 @@
 | 
			
		||||
         unified_bed_leveling::g29_card_thickness = 0.0,
 | 
			
		||||
         unified_bed_leveling::g29_constant = 0.0;
 | 
			
		||||
 | 
			
		||||
  #if HAS_BED_PROBE
 | 
			
		||||
    int  unified_bed_leveling::g29_grid_size;
 | 
			
		||||
  #endif
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   *   G29: Unified Bed Leveling by Roxy
 | 
			
		||||
   *
 | 
			
		||||
@@ -310,6 +313,8 @@
 | 
			
		||||
      return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (g29_parameter_parsing()) return; // abort if parsing the simple parameters causes a problem,
 | 
			
		||||
 | 
			
		||||
    // Check for commands that require the printer to be homed
 | 
			
		||||
    if (axis_unhomed_error()) {
 | 
			
		||||
      const int8_t p_val = parser.intval('P', -1);
 | 
			
		||||
@@ -317,8 +322,6 @@
 | 
			
		||||
        gcode.home_all_axes();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (g29_parameter_parsing()) return; // abort if parsing the simple parameters causes a problem,
 | 
			
		||||
 | 
			
		||||
    // Invalidate Mesh Points. This command is a little bit asymmetrical because
 | 
			
		||||
    // it directly specifies the repetition count and does not use the 'R' parameter.
 | 
			
		||||
    if (parser.seen('I')) {
 | 
			
		||||
@@ -381,6 +384,8 @@
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    #if HAS_BED_PROBE
 | 
			
		||||
 | 
			
		||||
      if (parser.seen('J')) {
 | 
			
		||||
        if (g29_grid_size) {  // if not 0 it is a normal n x n grid being probed
 | 
			
		||||
          save_ubl_active_state_and_disable();
 | 
			
		||||
@@ -416,6 +421,8 @@
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
    #endif // HAS_BED_PROBE
 | 
			
		||||
 | 
			
		||||
    if (parser.seen('P')) {
 | 
			
		||||
      if (WITHIN(g29_phase_value, 0, 1) && state.storage_slot == -1) {
 | 
			
		||||
        state.storage_slot = 0;
 | 
			
		||||
@@ -431,6 +438,8 @@
 | 
			
		||||
          SERIAL_PROTOCOLLNPGM("Mesh zeroed.");
 | 
			
		||||
          break;
 | 
			
		||||
 | 
			
		||||
        #if HAS_BED_PROBE
 | 
			
		||||
 | 
			
		||||
          case 1:
 | 
			
		||||
            //
 | 
			
		||||
            // Invalidate Entire Mesh and Automatically Probe Mesh in areas that can be reached by the probe
 | 
			
		||||
@@ -449,6 +458,8 @@
 | 
			
		||||
                              parser.seen('T'), parser.seen('E'), parser.seen('U'));
 | 
			
		||||
            break;
 | 
			
		||||
 | 
			
		||||
        #endif
 | 
			
		||||
 | 
			
		||||
        case 2: {
 | 
			
		||||
          #if ENABLED(NEWPANEL)
 | 
			
		||||
            //
 | 
			
		||||
@@ -776,6 +787,8 @@
 | 
			
		||||
          z_values[x][y] += g29_constant;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  #if HAS_BED_PROBE
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Probe all invalidated locations of the mesh that can be reached by the probe.
 | 
			
		||||
     * This attempts to fill in locations closest to the nozzle's start location first.
 | 
			
		||||
@@ -930,7 +943,10 @@
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  #endif // HAS_BED_PROBE
 | 
			
		||||
 | 
			
		||||
  #if ENABLED(NEWPANEL)
 | 
			
		||||
 | 
			
		||||
    float unified_bed_leveling::measure_point_with_encoder() {
 | 
			
		||||
 | 
			
		||||
      while (ubl_lcd_clicked()) delay(50);  // wait for user to release encoder wheel
 | 
			
		||||
@@ -1080,7 +1096,8 @@
 | 
			
		||||
      do_blocking_move_to_z(Z_CLEARANCE_DEPLOY_PROBE);
 | 
			
		||||
      do_blocking_move_to_xy(lx, ly);
 | 
			
		||||
    }
 | 
			
		||||
  #endif
 | 
			
		||||
 | 
			
		||||
  #endif // NEWPANEL
 | 
			
		||||
 | 
			
		||||
  bool unified_bed_leveling::g29_parameter_parsing() {
 | 
			
		||||
    bool err_flag = false;
 | 
			
		||||
@@ -1114,19 +1131,34 @@
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (parser.seen('P')) {
 | 
			
		||||
      g29_phase_value = parser.value_int();
 | 
			
		||||
      const int pv = parser.value_int();
 | 
			
		||||
      #if !HAS_BED_PROBE
 | 
			
		||||
        if (pv == 1) {
 | 
			
		||||
          SERIAL_PROTOCOLLNPGM("G29 P1 requires a probe.\n");
 | 
			
		||||
          err_flag = true;
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
      #endif
 | 
			
		||||
        {
 | 
			
		||||
          g29_phase_value = pv;
 | 
			
		||||
           if (!WITHIN(g29_phase_value, 0, 6)) {
 | 
			
		||||
             SERIAL_PROTOCOLLNPGM("?(P)hase value invalid (0-6).\n");
 | 
			
		||||
             err_flag = true;
 | 
			
		||||
           }
 | 
			
		||||
         }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (parser.seen('J')) {
 | 
			
		||||
      #if HAS_BED_PROBE
 | 
			
		||||
        g29_grid_size = parser.has_value() ? parser.value_int() : 0;
 | 
			
		||||
        if (g29_grid_size && !WITHIN(g29_grid_size, 2, 9)) {
 | 
			
		||||
          SERIAL_PROTOCOLLNPGM("?Invalid grid size (J) specified (2-9).\n");
 | 
			
		||||
          err_flag = true;
 | 
			
		||||
        }
 | 
			
		||||
      #else
 | 
			
		||||
        SERIAL_PROTOCOLLNPGM("G29 J action requires a probe.\n");
 | 
			
		||||
        err_flag = true;
 | 
			
		||||
      #endif
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (g29_x_flag != g29_y_flag) {
 | 
			
		||||
@@ -1624,6 +1656,8 @@
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  #if HAS_BED_PROBE
 | 
			
		||||
 | 
			
		||||
    void unified_bed_leveling::tilt_mesh_based_on_probed_grid(const bool do_ubl_mesh_map) {
 | 
			
		||||
      constexpr int16_t x_min = max(MIN_PROBE_X, UBL_MESH_MIN_X),
 | 
			
		||||
                        x_max = min(MAX_PROBE_X, UBL_MESH_MAX_X),
 | 
			
		||||
@@ -1769,6 +1803,8 @@
 | 
			
		||||
      if (do_ubl_mesh_map) display_map(g29_map_type);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  #endif // HAS_BED_PROBE
 | 
			
		||||
 | 
			
		||||
  #if ENABLED(UBL_G29_P31)
 | 
			
		||||
    void unified_bed_leveling::smart_fill_wlsf(const float &weight_factor) {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -647,9 +647,7 @@ static_assert(1 >= 0
 | 
			
		||||
  /**
 | 
			
		||||
   * Require some kind of probe for bed leveling and probe testing
 | 
			
		||||
   */
 | 
			
		||||
  #if ENABLED(AUTO_BED_LEVELING_UBL)
 | 
			
		||||
    #error "Unified Bed Leveling requires a probe: FIX_MOUNTED_PROBE, BLTOUCH, SOLENOID_PROBE, Z_PROBE_ALLEN_KEY, Z_PROBE_SLED, or Z Servo."
 | 
			
		||||
  #elif HAS_ABL
 | 
			
		||||
  #if HAS_ABL && DISABLED(AUTO_BED_LEVELING_UBL)
 | 
			
		||||
    #error "Auto Bed Leveling requires one of these: PROBE_MANUALLY, FIX_MOUNTED_PROBE, BLTOUCH, SOLENOID_PROBE, Z_PROBE_ALLEN_KEY, Z_PROBE_SLED, or a Z Servo."
 | 
			
		||||
  #endif
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user