mirror of https://github.com/Desuuuu/klipper.git
extruder: Consistently use "extruder" for the primary extruder
No longer allow the primary extruder to be named "extruder0". This avoids internal and external confusion between the printer objects and config section names. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
29b5961d9f
commit
ed610a6600
|
@ -182,10 +182,10 @@ run_current: 1.000
|
|||
sense_resistor: 0.051
|
||||
|
||||
#On drive E0
|
||||
[extruder0]
|
||||
[extruder]
|
||||
step_pin: PD5
|
||||
dir_pin: PA1
|
||||
enable_pin: !PC6, tmc2660_extruder0:virtual_enable
|
||||
enable_pin: !PC6, tmc2660_extruder:virtual_enable
|
||||
step_distance: .002
|
||||
nozzle_diameter: 0.400
|
||||
filament_diameter: 1.750
|
||||
|
@ -199,7 +199,7 @@ pid_Kd: 114
|
|||
min_temp: 0
|
||||
max_temp: 250
|
||||
|
||||
[tmc2660 extruder0]
|
||||
[tmc2660 extruder]
|
||||
cs_pin: PC17
|
||||
spi_bus: usart1
|
||||
microsteps: 16
|
||||
|
@ -297,10 +297,10 @@ max_temp: 130
|
|||
[fan]
|
||||
pin: PC23
|
||||
|
||||
# Fan1 controlled by extruder0
|
||||
# Fan1 controlled by extruder
|
||||
[heater_fan nozzle_cooling_fan]
|
||||
pin: PC26
|
||||
heater: extruder0
|
||||
heater: extruder
|
||||
heater_temp: 45
|
||||
fan_speed: 1.0
|
||||
|
||||
|
|
|
@ -6,6 +6,13 @@ All dates in this document are approximate.
|
|||
|
||||
# Changes
|
||||
|
||||
20191107: The primary extruder config section must be specified as
|
||||
"extruder" and may no longer be specified as "extruder0". Gcode
|
||||
command templates that query the extruder status are now accessed via
|
||||
"{printer.extruder}".
|
||||
|
||||
20191021: Klipper v0.8.0 released
|
||||
|
||||
20191003: The move_to_previous option in [safe_z_homing] now defaults
|
||||
to False. (It was effectively False prior to 20190918.)
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ class PrinterLCD:
|
|||
self.menu = menu.MenuManager(config, self.lcd_chip)
|
||||
# printer objects
|
||||
self.toolhead = self.sdcard = None
|
||||
self.fan = self.extruder0 = self.extruder1 = self.heater_bed = None
|
||||
self.fan = self.extruder = self.extruder1 = self.heater_bed = None
|
||||
self.printer.register_event_handler("klippy:ready", self.handle_ready)
|
||||
# screen updating
|
||||
self.screen_update_timer = self.reactor.register_timer(
|
||||
|
@ -42,7 +42,7 @@ class PrinterLCD:
|
|||
self.toolhead = self.printer.lookup_object('toolhead')
|
||||
self.sdcard = self.printer.lookup_object('virtual_sdcard', None)
|
||||
self.fan = self.printer.lookup_object('fan', None)
|
||||
self.extruder0 = self.printer.lookup_object('extruder0', None)
|
||||
self.extruder = self.printer.lookup_object('extruder', None)
|
||||
self.extruder1 = self.printer.lookup_object('extruder1', None)
|
||||
self.heater_bed = self.printer.lookup_object('heater_bed', None)
|
||||
self.prg_time = .0
|
||||
|
@ -97,8 +97,8 @@ class PrinterLCD:
|
|||
def screen_update_hd44780(self, eventtime):
|
||||
lcd_chip = self.lcd_chip
|
||||
# Heaters
|
||||
if self.extruder0 is not None:
|
||||
info = self.extruder0.get_heater().get_status(eventtime)
|
||||
if self.extruder is not None:
|
||||
info = self.extruder.get_heater().get_status(eventtime)
|
||||
lcd_chip.write_glyph(0, 0, 'extruder')
|
||||
self.draw_heater(1, 0, info)
|
||||
if self.extruder1 is not None:
|
||||
|
@ -140,8 +140,8 @@ class PrinterLCD:
|
|||
self.draw_status(0, 3, gcode_info, toolhead_info)
|
||||
def screen_update_128x64(self, eventtime):
|
||||
# Heaters
|
||||
if self.extruder0 is not None:
|
||||
info = self.extruder0.get_heater().get_status(eventtime)
|
||||
if self.extruder is not None:
|
||||
info = self.extruder.get_heater().get_status(eventtime)
|
||||
self.lcd_chip.write_glyph(0, 0, 'extruder')
|
||||
self.draw_heater(2, 0, info)
|
||||
extruder_count = 1
|
||||
|
|
|
@ -391,15 +391,15 @@ items:
|
|||
|
||||
[menu __temp __hotend0_current]
|
||||
type: item
|
||||
enable: extruder0.is_enabled
|
||||
enable: extruder.is_enabled
|
||||
name: "Ex0:{0:4.0f} T"
|
||||
parameter: extruder0.temperature
|
||||
parameter: extruder.temperature
|
||||
|
||||
[menu __temp __hotend0_target]
|
||||
type: input
|
||||
enable: extruder0.is_enabled
|
||||
enable: extruder.is_enabled
|
||||
name: "{0:4.0f}"
|
||||
parameter: extruder0.target
|
||||
parameter: extruder.target
|
||||
input_min: 0
|
||||
input_max: 250
|
||||
input_step: 1
|
||||
|
@ -450,7 +450,7 @@ items:
|
|||
|
||||
[menu __temp __preheat_pla __all]
|
||||
type: command
|
||||
enable: extruder0.is_enabled,heater_bed.is_enabled
|
||||
enable: extruder.is_enabled,heater_bed.is_enabled
|
||||
name: Preheat all
|
||||
gcode:
|
||||
M140 S60
|
||||
|
@ -458,7 +458,7 @@ gcode:
|
|||
|
||||
[menu __temp __preheat_pla __hotend]
|
||||
type: command
|
||||
enable: extruder0.is_enabled
|
||||
enable: extruder.is_enabled
|
||||
name: Preheat hotend
|
||||
gcode: M104 S200
|
||||
|
||||
|
@ -478,7 +478,7 @@ items:
|
|||
|
||||
[menu __temp __preheat_abs __all]
|
||||
type: command
|
||||
enable: extruder0.is_enabled,heater_bed.is_enabled
|
||||
enable: extruder.is_enabled,heater_bed.is_enabled
|
||||
name: Preheat all
|
||||
gcode:
|
||||
M140 S110
|
||||
|
@ -486,7 +486,7 @@ gcode:
|
|||
|
||||
[menu __temp __preheat_abs __hotend]
|
||||
type: command
|
||||
enable: extruder0.is_enabled
|
||||
enable: extruder.is_enabled
|
||||
name: Preheat hotend
|
||||
gcode: M104 S245
|
||||
|
||||
|
@ -506,7 +506,7 @@ items:
|
|||
|
||||
[menu __temp __cooldown __all]
|
||||
type: command
|
||||
enable: extruder0.is_enabled,heater_bed.is_enabled
|
||||
enable: extruder.is_enabled,heater_bed.is_enabled
|
||||
name: Cooldown all
|
||||
gcode:
|
||||
M104 S0
|
||||
|
@ -514,7 +514,7 @@ gcode:
|
|||
|
||||
[menu __temp __cooldown __hotend]
|
||||
type: command
|
||||
enable: extruder0.is_enabled
|
||||
enable: extruder.is_enabled
|
||||
name: Cooldown hotend
|
||||
gcode: M104 S0
|
||||
|
||||
|
@ -611,7 +611,7 @@ gcode: PROBE
|
|||
|
||||
[menu __prepare __hotend_pid_tuning]
|
||||
type: command
|
||||
enable: !toolhead.is_printing, extruder0.is_enabled
|
||||
enable: !toolhead.is_printing, extruder.is_enabled
|
||||
name: Tune Hotend PID
|
||||
gcode: PID_CALIBRATE HEATER=extruder TARGET=210 WRITE_FILE=1
|
||||
|
||||
|
@ -821,23 +821,23 @@ items:
|
|||
|
||||
[menu __card_hotend0_current]
|
||||
type: item
|
||||
enable: extruder0.is_enabled
|
||||
enable: extruder.is_enabled
|
||||
name: "{1:3.0f}"
|
||||
parameter: extruder0.temperature
|
||||
parameter: extruder.temperature
|
||||
transform: abs()
|
||||
|
||||
[menu __card_hotend0_target]
|
||||
type: item
|
||||
enable: extruder0.is_enabled
|
||||
enable: extruder.is_enabled
|
||||
name: "{1:3.0f}"
|
||||
parameter: extruder0.target
|
||||
parameter: extruder.target
|
||||
transform: abs()
|
||||
|
||||
[menu __card_hotend0_target_in]
|
||||
type: input
|
||||
enable: extruder0.is_enabled
|
||||
enable: extruder.is_enabled
|
||||
name: "{1:3.0f}"
|
||||
parameter: extruder0.target
|
||||
parameter: extruder.target
|
||||
transform: abs()
|
||||
input_min: 0
|
||||
input_max: 250
|
||||
|
|
|
@ -11,7 +11,7 @@ class PrinterHeaterFan:
|
|||
def __init__(self, config):
|
||||
self.printer = config.get_printer()
|
||||
self.printer.register_event_handler("klippy:ready", self.handle_ready)
|
||||
self.heater_name = config.get("heater", "extruder0")
|
||||
self.heater_name = config.get("heater", "extruder")
|
||||
self.heater_temp = config.getfloat("heater_temp", 50.0)
|
||||
self.heaters = []
|
||||
self.fan = fan.PrinterFan(config, default_shutdown_speed=1.)
|
||||
|
|
|
@ -404,7 +404,10 @@ class GCodeParser:
|
|||
heater = self.printer.lookup_object('heater_bed', None)
|
||||
elif 'T' in params:
|
||||
index = self.get_int('T', params, minval=0)
|
||||
extruder = self.printer.lookup_object('extruder%d' % (index,), None)
|
||||
section = 'extruder'
|
||||
if index:
|
||||
section = 'extruder%d' % (index,)
|
||||
extruder = self.printer.lookup_object(section, None)
|
||||
if extruder is not None:
|
||||
heater = extruder.get_heater()
|
||||
elif self.extruder is not None:
|
||||
|
|
|
@ -243,8 +243,6 @@ class PrinterHeaters:
|
|||
self.sensor_factories[sensor_type] = sensor_factory
|
||||
def setup_heater(self, config, gcode_id=None):
|
||||
heater_name = config.get_name().split()[-1]
|
||||
if heater_name == 'extruder':
|
||||
heater_name = 'extruder0'
|
||||
if heater_name in self.heaters:
|
||||
raise config.error("Heater %s already registered" % (heater_name,))
|
||||
# Setup sensor
|
||||
|
@ -254,8 +252,6 @@ class PrinterHeaters:
|
|||
self.register_sensor(config, heater, gcode_id)
|
||||
return heater
|
||||
def lookup_heater(self, heater_name):
|
||||
if heater_name == 'extruder':
|
||||
heater_name = 'extruder0'
|
||||
if heater_name not in self.heaters:
|
||||
raise self.printer.config_error(
|
||||
"Unknown heater '%s'" % (heater_name,))
|
||||
|
|
|
@ -62,7 +62,7 @@ class PrinterExtruder:
|
|||
toolhead.register_step_generator(self._free_moves)
|
||||
# Setup SET_PRESSURE_ADVANCE command
|
||||
gcode = self.printer.lookup_object('gcode')
|
||||
if self.name in ('extruder', 'extruder0'):
|
||||
if self.name == 'extruder':
|
||||
gcode.register_mux_command("SET_PRESSURE_ADVANCE", "EXTRUDER", None,
|
||||
self.cmd_default_SET_PRESSURE_ADVANCE,
|
||||
desc=self.cmd_SET_PRESSURE_ADVANCE_help)
|
||||
|
@ -244,12 +244,10 @@ class DummyExtruder:
|
|||
def add_printer_objects(config):
|
||||
printer = config.get_printer()
|
||||
for i in range(99):
|
||||
section = 'extruder%d' % (i,)
|
||||
section = 'extruder'
|
||||
if i:
|
||||
section = 'extruder%d' % (i,)
|
||||
if not config.has_section(section):
|
||||
if not i and config.has_section('extruder'):
|
||||
pe = PrinterExtruder(config.getsection('extruder'), 0)
|
||||
printer.add_object('extruder0', pe)
|
||||
continue
|
||||
break
|
||||
pe = PrinterExtruder(config.getsection(section), i)
|
||||
printer.add_object(section, pe)
|
||||
|
@ -257,7 +255,10 @@ def add_printer_objects(config):
|
|||
def get_printer_extruders(printer):
|
||||
out = []
|
||||
for i in range(99):
|
||||
extruder = printer.lookup_object('extruder%d' % (i,), None)
|
||||
section = 'extruder'
|
||||
if i:
|
||||
section = 'extruder%d' % (i,)
|
||||
extruder = printer.lookup_object(section, None)
|
||||
if extruder is None:
|
||||
break
|
||||
out.append(extruder)
|
||||
|
|
Loading…
Reference in New Issue