markniu / Bed_Distance_sensor

Auto bed level with High resolution distance sensor
281 stars 28 forks source link

Internal error on command:"G28" #65

Closed rolohaun closed 8 months ago

rolohaun commented 11 months ago

I am using the BD_sensor on a Manta M8P plugged into the BLtouch port. I have verified the sensor works, but when I try to do a G28 I can an error.

If I remove the BDSensor section the printer homes fine

I am not using any pin aliases or anything my config is below

[BDsensor] sda_pin: PB2 # Don't use aliases for the board pins scl_pin: PB1 # example of connecting to main board Creality V4.2.7 delay: 20 # 20us per pulse, this value should be >=20 but must be below 50 z_offset:0 # this z_offset must be set to 0. z_adjust:0.0 # z axis adjustment, replace the z_offset function. within -0.3 to 0.3mm x_offset: 0 y_offset: 0 no_stop_probe: # enable this for fast probe, the toolhead will not stop at the probe point. position_endstop: 0.8 # the Z axis will stop at this position (mm) while homing z, recommend value is 0.4~1.0 speed:0.8 # this speed only works for the z tilt and PROBE_ACCURACY command.

markniu commented 11 months ago

what's error? you can attach the klippy.log file should be better to find that the error.

rolohaun commented 11 months ago

I got it, I found out a bed mesh is needed for the probe to work, just wasn't clear in the install guide

markniu commented 11 months ago

I got it, I found out a bed mesh is needed for the probe to work, just wasn't clear in the install guide

Thanks, I will this into the guide.

WinstonLeWolf commented 10 months ago

I got it, I found out a bed mesh is needed for the probe to work, just wasn't clear in the install guide

Please add this to the instructions. I was racking my brain trying to fix the error and almost gave up. Thank you for all the hard work.

Liquidus-tech commented 10 months ago

Hi, let me start by saying that I'm new to Klipper. I have a self-built Corexy printer , octopus v1.1 . Running G28 from the terminal I get an error. I'm sure I'm doing something wrong but I've been banging my head for too many days now. Can you help me? I attach log files Starting Klippy....txt e .cfg

#################################################################### ############################ MCU ################################### ####################################################################

[mcu] serial: /dev/serial/by-id/usb-Klipper_stm32f446xx_23000900105053424E363620-if00

#################################################################### ############################ PRINTER ############################### ####################################################################

[printer] kinematics: corexy max_velocity: 2000
max_accel: 20000 #Max 4000 max_z_velocity: 60 #Max 15 for 12V TMC Drivers, can increase for 24V max_z_accel: 350 square_corner_velocity: 5.0

[pause_resume] recover_velocity: 150

[input_shaper] shaper_freq_x: 64 # per accelerometer shaper_type_x: zv shaper_freq_y: 70.2 # per accelerometer shaper_type_y: mzv

#################################################################### ############################ XY Axis ############################### ####################################################################

                  #### X On Drive 0 ####

[stepper_x]
step_pin: PF13 dir_pin: !PF12 enable_pin: !PF14 microsteps: 64 rotation_distance: 40 endstop_pin: !PG6 position_endstop: 0 position_min: 0 position_max: 460 homing_speed: 25 full_steps_per_rotation: 200 homing_retract_dist: 0 homing_positive_dir: false

[tmc5160 stepper_x] cs_pin: PC4 spi_software_sclk_pin: PA5 spi_software_mosi_pin: PA7 spi_software_miso_pin: PA6

stealthchop_threshold: 0

sense_resistor: 0.022 interpolate: False run_current: 1.4
hold_current: 1.4

                    #### Y On Drive 1 ####

[stepper_y]
step_pin: PG0 dir_pin: !PG1 enable_pin: !PF15 microsteps: 64 rotation_distance: 40 endstop_pin: !PG9 position_endstop: 0 position_min: 0 position_max: 455 homing_speed: 25 full_steps_per_rotation: 200 homing_retract_dist: 0 homing_positive_dir: false

[tmc5160 stepper_y] cs_pin: PD11 spi_software_sclk_pin: PA5 spi_software_mosi_pin: PA7 spi_software_miso_pin: PA6 sense_resistor: 0.022

stealthchop_threshold: 0

interpolate: False run_current: 1.4
hold_current: 1.4

#################################################################### ############################ Z Axis#full_steps_per_rotation: 200 in hevort ################################ ####################################################################

__#### Z On Drive 2 ####___

[stepper_z]
step_pin: PF11 dir_pin: !PG3 enable_pin: !PG5 microsteps: 32 rotation_distance: 40
gear_ratio: 80:16
endstop_pin: probe:z_virtual_endstop position_max: 440 position_min: 0 homing_speed: 5 second_homing_speed: 0.8

[tmc5160 stepper_z] cs_pin: PC6 spi_software_sclk_pin: PA5 spi_software_mosi_pin: PA7 spi_software_miso_pin: PA6

stealthchop_threshold: 0

sense_resistor: 0.075 interpolate: False run_current: 0.8
hold_current: 0.8

_#### Z1 On Drive 3 ####___

[stepper_z1]
step_pin: PG4 dir_pin: !PC1 enable_pin: !PA0 microsteps: 32 rotation_distance: 40
gear_ratio: 80:16

[tmc5160 stepper_z1] cs_pin: PC7 spi_software_sclk_pin: PA5 spi_software_mosi_pin: PA7 spi_software_miso_pin: PA6

stealthchop_threshold: 0

sense_resistor: 0.075 interpolate: False run_current: 0.8
hold_current: 0.8

_#### Z2 On Drive 5 ####___

[stepper_z2] step_pin: PC13 dir_pin: !PF0 enable_pin: !PF1 microsteps: 32 rotation_distance: 40
gear_ratio: 80:16

[tmc5160 stepper_z2] cs_pin: PE4 spi_software_sclk_pin: PA5 spi_software_mosi_pin: PA7 spi_software_miso_pin: PA6

stealthchop_threshold: 0

sense_resistor: 0.075 interpolate: False run_current: 0.8
hold_current: 0.8

_#### Z3 On Drive 6 ####___

[stepper_z3] step_pin: PE2 dir_pin: !PE3 enable_pin: !PD4 microsteps: 32 rotation_distance: 40
gear_ratio: 80:16

[tmc5160 stepper_z3] cs_pin: PE1 spi_software_sclk_pin: PA5 spi_software_mosi_pin: PA7 spi_software_miso_pin: PA6

stealthchop_threshold: 0

sense_resistor: 0.075 interpolate: False run_current: 0.8
hold_current: 0.8

#####################################################################

Homing and Gantry Adjustment Routines

#####################################################################

[idle_timeout] timeout: 1800

[safe_z_home] #da

XY Location of the Z Endstop Switch

Update -10,-10 to the XY coordinates of your endstop pin

(such as 157,305) after going through Z Endstop Pin

Location Definition step.

home_xy_position:0,0 speed:100
z_hop:10

Use QUAD_GANTRY_LEVEL to level a gantry.

Min & Max gantry corners - measure from nozzle at MIN (0,0) and

MAX (250, 250), (300,300), or (350,350) depending on your printer size

to respective belt positions

[quad_gantry_level]

gantry_corners: 50,500 410,420 points: 50,25 50,275 300,275 300,25

--------------------------------------------------------------------

speed: 100 horizontal_move_z: 1 retries: 5 retry_tolerance: 0.0075 max_adjust: 10

[force_move]

enable_force_move: true # required by the command SET_KINEMATIC_POSITION in the calibration step below

[gcode_macro G82]

gcode =

#SET_KINEMATIC_POSITION X=0 Y=0 Z=0

#####################################################################

_____#### Extruder On Drive 4 #####____

#####################################################################

[extruder] step_pin: PF9 dir_pin: PF10 enable_pin: !PG2 microsteps: 16 full_steps_per_rotation: 200 rotation_distance: 4.637 nozzle_diameter: 0.400 filament_diameter: 1.750 sensor_type: EPCOS 100K B57560G104F sensor_pin: PF4

pullup_resistor: 4700

control: pid pid_Kp: 13.653 pid_Ki: 0.562 pid_Kd: 82.940 min_temp: 0 max_temp: 350

pressure_advance = 0.025

max_extrude_only_distance: 500 max_extrude_only_velocity: 120 pressure_advance_smooth_time: 0.03 heater_pin: PA2

[tmc5160 extruder] cs_pin: PF2 spi_software_sclk_pin: PA5 spi_software_mosi_pin: PA7 spi_software_miso_pin: PA6

stealthchop_threshold: 0

sense_resistor: 0.075 interpolate: False run_current: 0.59
hold_current: 0.59

_#__#### HEATER NOZZLE on HE0 ####

[firmware_retraction]

retract_length: 0.5

The length of filament (in mm) to retract when G10 is activated,

and to unretract when G11 is activated (but see

unretract_extra_length below). The default is 0 mm.

retract_speed: 80

The speed of retraction, in mm/s. The default is 20 mm/s.

unretract_extra_length: 0

The length (in mm) of additional filament to add when

unretracting.

unretract_speed: 80

The speed of unretraction, in mm/s. The default is 10 mm/s.

Try to keep pressure_advance below 1.0

pressure_advance: 0.05

Default is 0.040, leave stock

pressure_advance_smooth_time: 0.040

Fan0

[fan] pin: PA8

Fan1 controlled by extruder

[heater_fan nozzle_cooling_fan] pin: PE5 heater: extruder heater_temp: 45 fan_speed: 1.0

#################################################################### ############################ BED ################################### #################################################################### [heater_bed] heater_pin: PA1 sensor_type: EPCOS 100K B57560G104F sensor_pin: PF3 control: pid min_temp: 0 max_temp: 130 pid_kp = 50.108 pid_ki = 0.679 pid_kd = 924.488

[BDsensor] sda_pin: PB7 # Don't use aliases for the board pins scl_pin: PB6 # example of connecting to main board Creality V4.2.7

scl_pin:MKS_THR:gpio20 # example of connecting to CAN module like MKS THR42

sda_pin:MKS_THR:gpio11 # example of connecting to CAN module like MKS THR42

delay: 20 # 20us per pulse, this value should be >=18 but must be below 30 z_offset:0 # this z_offset must be set to 0. z_adjust:0.0 # z axis adjustment, replace the z_offset function. within -0.3 to 0.3mm x_offset: 22 y_offset: -1.8

no_stop_probe: # enable this for fast probe, the toolhead will not stop at the probe point.

position_endstop: 0.8 # this value must >0.5, the Z axis will be triggered after it measured the distance is below this value(mm) while homing z, recommend value is 0.5~1.0

speed:0.8 # this speed only works for the z tilt and PROBE_ACCURACY command.

############################################# ################# MACROS ##################### ############################################## [gcode_macro CANCEL_PRINT] rename_existing: BASE_CANCEL_PRINT gcode: TURN_OFF_HEATERS CLEAR_PAUSE SDCARD_RESET_FILE BASE_CANCEL_PRINT SET_FAN_SPEED FAN=psu48 SPEED=1

[gcode_macro START_PRINT] gcode: SET_FAN_SPEED FAN=psu48 SPEED=1

[gcode_macro FORCED_PAUSE] gcode: PAUSE

[gcode_macro M600] gcode: {% set X = params.X|default(20)|float %} {% set Y = params.Y|default(20)|float %} {% set Z = params.Z|default(10)|float %} SAVE_GCODE_STATE NAME=M600_state PAUSE G91 G1 E-.8 F2700 G1 Z{Z} G90 G1 X{X} Y{Y} F3000 G91 G1 E-60 F1000 RESTORE_GCODE_STATE NAME=M600_state

#################################################################### ###################### END of manual config ######################## #####################################################################*# <---------------------- SAVE_CONFIG ---------------------->

*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.

*

*# [extruder]

*# control = pid

*# pid_kp = 13.653

*# pid_ki = 0.562

*# pid_kd = 82.940

*# <---------------------- SAVE_CONFIG ---------------------->

*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.

*

*# [heater_bed]

*# control = pid

*# pid_kp = 50.108

*# pid_ki = 0.679

*# pid_kd = 924.488

markniu commented 10 months ago

This is the same error

    self.config.getsection('bed_mesh'), self.bedmesh.bmc.probe_finalize, self.bedmesh.bmc._get_adjusted_points())
AttributeError: 'NoneType' object has no attribute 'bmc'

just add the section bed_mesh in your printer.cfg, here is an example

[bed_mesh]
speed: 120
mesh_min: 10,10
mesh_max: 320,295
probe_count: 10, 10
horizontal_move_z: 1
algorithm: bicubic
Liquidus-tech commented 10 months ago

Great! I thank you! The printer finally moves. Unfortunately I have other errors, I'll recompile it, I'll do it again and hope for the best

Chienhuycu commented 10 months ago

Hello @markniu , Same problem with the recent Klipper Update (Release: v0.12.0-98-g5e433fff). Here is my Klippy.log for a custom VCore 3.1 klippy.log

Chienhuycu commented 10 months ago

I found this on my log:
File "/home/pi/klipper/klippy/extras/BDsensor.py", line 1190, in home_start trsync.start(print_time, self.trigger_completion, expire_timeout) TypeError: MCU_trsync.start() missing 1 required positional argument: 'expire_timeout'

markniu commented 10 months ago

Hi, you need to update the BDsensor.py file too, since there is an important update of klipper that change something about homing with probe.

I found this on my log: File "/home/pi/klipper/klippy/extras/BDsensor.py", line 1190, in home_start trsync.start(print_time, self.trigger_completion, expire_timeout) TypeError: MCU_trsync.start() missing 1 required positional argument: 'expire_timeout'

Chienhuycu commented 10 months ago

Hi @markniu, Is there a guide ?

markniu commented 10 months ago

you can try this in the ssh

cd ~/Bed_Distance_sensor
git pull
Chienhuycu commented 10 months ago

Thank you @markniu , I have just update with MoonRaker Update_Manager. Looking good