Skip to content

Commit

Permalink
Merge branch 'KalicoCrew:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianStremel authored Jan 6, 2025
2 parents e5788c9 + 55336a1 commit 3007219
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 27 deletions.
9 changes: 5 additions & 4 deletions docs/MPC.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ To use MPC as the temperature controller for the extruder use the following basi
[extruder]
control: mpc
heater_power: 50
cooling_fan: fan
cooling_fan:
filament_diameter: 1.75
filament_density: 1.20
filament_heat_capacity: 1.8
Expand All @@ -42,9 +42,10 @@ filament_heat_capacity: 1.8
heater. Setting heater_power to the power output at the expected printing
temperature is recommended.

- `cooling_fan: fan`
_Default Value: fan_
This is the fan that is cooling extruded filament and the hotend.
- `cooling_fan:`
_Default Value: Nothing_
The fan that is cooling extruded filament and the hotend. Default is no fan so
there will be no fan taken into account for controlling the heater.
Specifying "fan" will automatically use the part cooling fan.

- `filament_diameter: 1.75`
Expand Down
39 changes: 18 additions & 21 deletions klippy/extras/control_mpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,6 @@ def run(self, gcmd):
ambient_max_measure_time,
ambient_measure_sample_time,
fan_breakpoints,
new_control,
first_res,
)
second_res = self.process_second_pass(
Expand Down Expand Up @@ -588,7 +587,6 @@ def transfer_test(
ambient_max_measure_time,
ambient_measure_sample_time,
fan_breakpoints,
control,
first_pass_results,
):
target_temp = round(first_pass_results["post_block_temp"])
Expand All @@ -609,27 +607,26 @@ def transfer_test(
)
gcmd.respond_info(f"Average stable power: {power_base} W")
else:
if fan is not None:
for idx in range(0, fan_breakpoints):
speed = idx / (fan_breakpoints - 1)
curtime = self.heater.reactor.monotonic()
print_time = fan.get_mcu().estimated_print_time(curtime)
fan.set_speed(print_time + PIN_MIN_TIME, speed)
gcmd.respond_info("Waiting for temperature to stabilize")
self.wait_stable(3)
gcmd.respond_info(
f"Temperature stable, measuring power usage with {speed*100.:.0f}% fan speed"
)
power = self.measure_power(
ambient_max_measure_time, ambient_measure_sample_time
)
gcmd.respond_info(
f"{speed*100.:.0f}% fan average power: {power:.2f} W"
)
fan_powers.append((speed, power))
for idx in range(0, fan_breakpoints):
speed = idx / (fan_breakpoints - 1)
curtime = self.heater.reactor.monotonic()
print_time = fan.get_mcu().estimated_print_time(curtime)
fan.set_speed(print_time + PIN_MIN_TIME, 0.0)
fan.set_speed(print_time + PIN_MIN_TIME, speed)
gcmd.respond_info("Waiting for temperature to stabilize")
self.wait_stable(3)
gcmd.respond_info(
f"Temperature stable, measuring power usage with {speed*100.:.0f}% fan speed"
)
power = self.measure_power(
ambient_max_measure_time, ambient_measure_sample_time
)
gcmd.respond_info(
f"{speed*100.:.0f}% fan average power: {power:.2f} W"
)
fan_powers.append((speed, power))
curtime = self.heater.reactor.monotonic()
print_time = fan.get_mcu().estimated_print_time(curtime)
fan.set_speed(print_time + PIN_MIN_TIME, 0.0)
power_base = fan_powers[0][1]

return {
Expand Down
4 changes: 2 additions & 2 deletions klippy/extras/telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ def __init__(self, config):

if self.enabled is not True:
gcode.register_command(
"ENABLE_TELEMETRY", self.cmd_ENABLE_TELEMETRY, True
"ENABLE_TELEMETRY", self.cmd_ENABLE_TELEMETRY
)

if self.enabled is not False:
gcode.register_command(
"DISABLE_TELEMETRY", self.cmd_DISABLE_TELEMETRY, True
"DISABLE_TELEMETRY", self.cmd_DISABLE_TELEMETRY
)

if self.enabled is None:
Expand Down

0 comments on commit 3007219

Please sign in to comment.