extruder: Use template evaluation on gcode

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2019-06-07 10:42:22 -04:00
parent 27ca159285
commit e60ee861f8
1 changed files with 7 additions and 4 deletions

View File

@ -41,8 +41,11 @@ class PrinterExtruder:
self.stepper.set_max_jerk(9999999.9, 9999999.9) self.stepper.set_max_jerk(9999999.9, 9999999.9)
self.max_e_dist = config.getfloat( self.max_e_dist = config.getfloat(
'max_extrude_only_distance', 50., minval=0.) 'max_extrude_only_distance', 50., minval=0.)
self.activate_gcode = config.get('activate_gcode', '') gcode_macro = self.printer.try_load_module(config, 'gcode_macro')
self.deactivate_gcode = config.get('deactivate_gcode', '') self.activate_gcode = gcode_macro.load_template(
config, 'activate_gcode', '')
self.deactivate_gcode = gcode_macro.load_template(
config, 'deactivate_gcode', '')
self.pressure_advance = config.getfloat( self.pressure_advance = config.getfloat(
'pressure_advance', 0., minval=0.) 'pressure_advance', 0., minval=0.)
self.pressure_advance_lookahead_time = config.getfloat( self.pressure_advance_lookahead_time = config.getfloat(
@ -75,8 +78,8 @@ class PrinterExtruder:
return self.extrude_pos return self.extrude_pos
def get_activate_gcode(self, is_active): def get_activate_gcode(self, is_active):
if is_active: if is_active:
return self.activate_gcode return self.activate_gcode.render()
return self.deactivate_gcode return self.deactivate_gcode.render()
def stats(self, eventtime): def stats(self, eventtime):
return self.heater.stats(eventtime) return self.heater.stats(eventtime)
def motor_off(self, print_time): def motor_off(self, print_time):