@@ -73,8 +73,8 @@ void BDS_Leveling::init(uint8_t _sda, uint8_t _scl, uint16_t delay_s) {
7373 config_state = BDS_IDLE;
7474 const int ret = BD_I2C_SENSOR.i2c_init (_sda, _scl, BD_SENSOR_I2C_ADDR, delay_s);
7575 if (ret != 1 ) SERIAL_ECHOLNPGM (" BD Sensor Init Fail (" , ret, " )" );
76- sync_plan_position ();
77- pos_zero_offset = planner.get_axis_position_mm (Z_AXIS) - current_position .z ;
76+ motion. sync_plan_position ();
77+ pos_zero_offset = planner.get_axis_position_mm (Z_AXIS) - motion. position .z ;
7878 SERIAL_ECHOLNPGM (" BD Sensor Zero Offset:" , pos_zero_offset);
7979}
8080
@@ -120,27 +120,27 @@ void BDS_Leveling::process() {
120120
121121 uint16_t tmp = 0 ;
122122 const float cur_z = planner.get_axis_position_mm (Z_AXIS) - pos_zero_offset;
123- static float old_cur_z = cur_z, old_buf_z = current_position .z ;
123+ static float old_cur_z = cur_z, old_buf_z = motion. position .z ;
124124 tmp = BD_I2C_SENSOR.BD_i2c_read ();
125125 if (BD_I2C_SENSOR.BD_Check_OddEven (tmp) && good_data (tmp)) {
126126 const float z_sensor = interpret (tmp);
127127 #if ENABLED(BABYSTEPPING)
128128 if (config_state > 0 ) {
129129 if (cur_z < config_state * 0 .1f
130130 && old_cur_z == cur_z
131- && old_buf_z == current_position .z
131+ && old_buf_z == motion. position .z
132132 && z_sensor < (MAX_BD_HEIGHT) - 0 .1f
133133 ) {
134134 babystep.set_mm (Z_AXIS, cur_z - z_sensor);
135- DEBUG_ECHOLNPGM (" BD:" , z_sensor, " , Z:" , cur_z, " |" , current_position .z );
135+ DEBUG_ECHOLNPGM (" BD:" , z_sensor, " , Z:" , cur_z, " |" , motion. position .z );
136136 }
137137 else
138138 babystep.set_mm (Z_AXIS, 0 );
139139 }
140140 #endif
141141
142142 old_cur_z = cur_z;
143- old_buf_z = current_position .z ;
143+ old_buf_z = motion. position .z ;
144144 endstops.bdp_state_update (z_sensor <= BD_SENSOR_HOME_Z_POSITION);
145145
146146 #if HAS_STATUS_MESSAGE
@@ -159,7 +159,7 @@ void BDS_Leveling::process() {
159159 kill (F (" BDsensor connect Err!" ));
160160 }
161161
162- DEBUG_ECHOLNPGM (" BD:" , tmp & 0x3FF , " Z:" , cur_z, " |" , current_position .z );
162+ DEBUG_ECHOLNPGM (" BD:" , tmp & 0x3FF , " Z:" , cur_z, " |" , motion. position .z );
163163 if (TERN0 (DEBUG_OUT_BD, BD_I2C_SENSOR.BD_Check_OddEven (tmp) == 0 )) DEBUG_ECHOLNPGM (" CRC error" );
164164
165165 if (!good_data (tmp)) {
@@ -205,15 +205,15 @@ void BDS_Leveling::process() {
205205 SERIAL_ECHOLNPGM (" c_z0:" , planner.get_axis_position_mm (Z_AXIS), " -" , pos_zero_offset);
206206
207207 // Move the z axis instead of enabling the Z axis with M17
208- // TODO: Use do_blocking_move_to_z for synchronized move.
209- current_position .z = 0 ;
210- sync_plan_position ();
208+ // TODO: Use motion.blocking_move_z for synchronized move.
209+ motion. position .z = 0 ;
210+ motion. sync_plan_position ();
211211 gcode.process_subcommands_now (F (" G1Z0.05" ));
212212 safe_delay (300 );
213213 gcode.process_subcommands_now (F (" G1Z0.00" ));
214214 safe_delay (300 );
215- current_position .z = 0 ;
216- sync_plan_position ();
215+ motion. position .z = 0 ;
216+ motion. sync_plan_position ();
217217 // safe_delay(1000);
218218
219219 while ((planner.get_axis_position_mm (Z_AXIS) - pos_zero_offset) > 0 .00001f ) {
@@ -236,10 +236,10 @@ void BDS_Leveling::process() {
236236 }
237237 else {
238238 char tmp_1[32 ];
239- // TODO: Use prepare_internal_move_to_destination to guarantee machine space
239+ // TODO: Use motion. prepare_internal_move_to_destination to guarantee machine space
240240 sprintf_P (tmp_1, PSTR (" G1Z%d.%d" ), int (zpos), int (zpos * 10 ) % 10 );
241241 gcode.process_subcommands_now (tmp_1);
242- SERIAL_ECHO (tmp_1); SERIAL_ECHOLNPGM (" , Z:" , current_position .z );
242+ SERIAL_ECHO (tmp_1); SERIAL_ECHOLNPGM (" , Z:" , motion. position .z );
243243 uint16_t failcount = 300 ;
244244 for (float tmp_k = 0 ; abs (zpos - tmp_k) > 0 .006f && failcount--;) {
245245 tmp_k = planner.get_axis_position_mm (Z_AXIS) - pos_zero_offset;
0 commit comments