load_cell_probe: Enhance regression test case

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2026-01-19 23:27:24 -05:00
parent bb96318725
commit 3c56eb7f6f
4 changed files with 108 additions and 7 deletions

View file

@ -313,6 +313,8 @@ class LoadCellSampleCollector:
self._errors = 0
overflows = self._overflows
self._overflows = 0
if self._mcu.is_fileoutput():
samples = [(0., 0., 0.)]
return samples, (errors, overflows) if errors or overflows else 0
def _collect_until(self, timeout):
@ -324,6 +326,8 @@ class LoadCellSampleCollector:
raise self._printer.command_error(
"LoadCellSampleCollector timed out! Errors: %i,"
" Overflows: %i" % (self._errors, self._overflows))
if self._mcu.is_fileoutput():
break
self._reactor.pause(now + RETRY_DELAY)
return self._finish_collecting()

View file

@ -454,6 +454,8 @@ class LoadCellProbingMove:
res = self._dispatch.stop()
# clear the homing state so it stops processing samples
self._last_trigger_time = self._mcu_load_cell_probe.clear_home()
if self._mcu.is_fileoutput():
self._last_trigger_time = home_end_time
if res >= mcu.MCU_trsync.REASON_COMMS_TIMEOUT:
error = "Load Cell Probe Error: unknown reason code %i" % (res,)
if res in self.ERROR_MAP:

View file

@ -1,11 +1,75 @@
# Test config for load_cell
# Test config for load cells
[stepper_x]
step_pin: PF0
dir_pin: PF1
enable_pin: !PD7
microsteps: 16
rotation_distance: 40
endstop_pin: ^PE5
position_endstop: 0
position_max: 200
homing_speed: 50
[stepper_y]
step_pin: PF6
dir_pin: !PF7
enable_pin: !PF2
microsteps: 16
rotation_distance: 40
endstop_pin: ^PJ1
position_endstop: 0
position_max: 200
homing_speed: 50
[stepper_z]
step_pin: PL3
dir_pin: PL1
enable_pin: !PK0
microsteps: 16
rotation_distance: 8
endstop_pin: PK1
position_endstop: 0.0
position_max: 200
[extruder]
step_pin: PA4
dir_pin: PA6
enable_pin: !PA2
microsteps: 16
rotation_distance: 33.5
nozzle_diameter: 0.400
filament_diameter: 1.750
heater_pin: PB4
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PK5
control: pid
pid_Kp: 22.2
pid_Ki: 1.08
pid_Kd: 114
min_temp: 0
max_temp: 250
[heater_bed]
heater_pin: PH5
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PK6
control: watermark
min_temp: 0
max_temp: 130
[bed_mesh]
mesh_min: 10,10
mesh_max: 180,180
[mcu]
serial: /dev/ttyACM0
[printer]
kinematics: none
kinematics: cartesian
max_velocity: 300
max_accel: 3000
max_z_velocity: 5
max_z_accel: 100
[load_cell my_ads1220]
sensor_type: ads1220
@ -14,10 +78,22 @@ data_ready_pin: PA1
[load_cell my_hx711]
sensor_type: hx711
sclk_pin: PA2
dout_pin: PA3
sclk_pin: PA3
dout_pin: PA5
[load_cell my_hx717]
sensor_type: hx717
sclk_pin: PA4
dout_pin: PA5
sclk_pin: PA7
dout_pin: PJ0
[load_cell_probe]
z_offset: 0
sensor_type: ads1220
speed: 10.0
cs_pin: PJ2
data_ready_pin: PJ3
counts_per_gram: 100
reference_tare_counts: 1000
drift_filter_cutoff_frequency: 0.8
buzz_filter_cutoff_frequency: 100.0
notch_filter_frequencies: 50, 60

View file

@ -2,4 +2,23 @@
DICTIONARY atmega2560.dict
CONFIG load_cell.cfg
G4 P1000
# Start by homing the printer.
G28
G1 F6000
# Z / X / Y moves
G1 Z1
G1 X1
G1 Y1
# Run bed_mesh_calibrate
BED_MESH_CALIBRATE
# Move again
G1 Z5 X0 Y0
# Do regular probe
PROBE
# Move again
G1 Z9