bed_mesh: Add panel for bed_mesh

This commit is contained in:
Jordan Ruthe
2020-12-04 14:13:03 -05:00
parent a724836378
commit 3e11fad1fd
5 changed files with 223 additions and 6 deletions

View File

@@ -98,10 +98,17 @@ name: Bed Level
icon: bed-level
panel: bed_level
[menu __main config bedmesh]
name: Bed Mesh
icon: bed-level
panel: bed_mesh
enable: {{ printer.bed_mesh is defined }}
[menu __main config zoffset]
name: Z Calibrate
icon: z-offset-increase
panel: zcalibrate
enable: {{ ((printer.bltouch is defined) or (printer.probe is defined)) }}
[menu __main config network]
name: Network

View File

@@ -34,16 +34,16 @@ class KlippyGcodes:
@staticmethod
def set_bed_temp(temp):
return KlippyGcodes.SET_BED_TEMP + " S" + str(temp)
return "%s S%s" % (KlippyGcodes.SET_BED_TEMP, str(temp))
@staticmethod
def set_ext_temp(temp, tool=0):
return KlippyGcodes.SET_EXT_TEMP + " T" + str(tool) + " S" + str(temp)
return "%s T%s S%s" % (KlippyGcodes.SET_EXT_TEMP, str(tool), str(temp))
@staticmethod
def set_fan_speed(speed):
speed = str( int(float(int(speed) % 101)/100*255) )
return KlippyGcodes.SET_FAN_SPEED + " S"+ speed
return "%s S%s" % (KlippyGcodes.SET_FAN_SPEED, speed)
@staticmethod
def set_extrusion_rate(rate):
@@ -59,4 +59,12 @@ class KlippyGcodes:
@staticmethod
def extrude(dist, speed=500):
return KlippyGcodes.MOVE + " E" + dist + " F" + speed
return "%s E%s F%s" % (KlippyGcodes.MOVE, dist, speed)
@staticmethod
def bed_mesh_load(profile):
return "BED_MESH_PROFILE LOAD=%s" % profile
@staticmethod
def bed_mesh_save(profile):
return "BED_MESH_PROFILE SAVE=%s" % profile

View File

@@ -40,6 +40,15 @@ class Printer:
"temperature": 0,
"target": 0
}
if x.startswith('bed_mesh '):
r = self.config[x]
r['x_count'] = int(r['x_count'])
r['y_count'] = int(r['y_count'])
r['max_x'] = float(r['max_x'])
r['min_x'] = float(r['min_x'])
r['max_y'] = float(r['max_y'])
r['min_y'] = float(r['min_y'])
r['points'] = [[float(j.strip()) for j in i.split(",")] for i in r['points'].strip().split("\n")]
self.process_update(data)
logger.info("Klipper version: %s", self.klipper['version'])
@@ -57,8 +66,16 @@ class Printer:
logger.debug("Power devices: %s" % self.power_devices)
def process_update(self, data):
keys = ['virtual_sdcard','pause_resume','idle_timeout','print_stats']
keys = ['fan','gcode_move','idle_timeout','pause_resume','print_stats','toolhead','virtual_sdcard']
keys = [
'bed_mesh',
'fan',
'gcode_move',
'idle_timeout',
'pause_resume',
'print_stats',
'toolhead',
'virtual_sdcard'
]
for x in keys:
if x in data:
if x not in self.data: