gcode: Rename respond() to respond_raw()
Rename the method to make it more clear that it is a low-level call that should be rarely used. Also, change gcode_button.py, hall_filament_width_sensor.py, and tsl1401cl_filament_width_sensor.py to use respond_info() instead of respond_raw(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
@@ -187,7 +187,8 @@ class BedMesh:
|
||||
self.gcode.respond_info("Bed has not been probed")
|
||||
else:
|
||||
self.bmc.print_probed_positions(self.gcode.respond_info)
|
||||
self.z_mesh.print_mesh(self.gcode.respond, self.horizontal_move_z)
|
||||
self.z_mesh.print_mesh(self.gcode.respond_raw,
|
||||
self.horizontal_move_z)
|
||||
cmd_BED_MESH_MAP_help = "Serialize mesh and output to terminal"
|
||||
def cmd_BED_MESH_MAP(self, params):
|
||||
if self.z_mesh is not None:
|
||||
@@ -196,8 +197,7 @@ class BedMesh:
|
||||
'mesh_min': (params['min_x'], params['min_y']),
|
||||
'mesh_max': (params['max_x'], params['max_y']),
|
||||
'z_positions': self.bmc.probed_matrix}
|
||||
self.gcode.respond(
|
||||
"mesh_map_output " + json.dumps(outdict))
|
||||
self.gcode.respond_raw("mesh_map_output " + json.dumps(outdict))
|
||||
else:
|
||||
self.gcode.respond_info("Bed has not been probed")
|
||||
cmd_BED_MESH_CLEAR_help = "Clear the Mesh so no z-adjusment is made"
|
||||
|
||||
@@ -26,7 +26,7 @@ class GCodeButton:
|
||||
cmd_QUERY_BUTTON_help = "Report on the state of a button"
|
||||
|
||||
def cmd_QUERY_BUTTON(self, params):
|
||||
self.gcode.respond(self.name + ": " + self.get_status()['state'])
|
||||
self.gcode.respond_info(self.name + ": " + self.get_status()['state'])
|
||||
|
||||
def button_callback(self, eventtime, state):
|
||||
self.last_state = state
|
||||
|
||||
@@ -134,11 +134,11 @@ class HallFilamentWidthSensor:
|
||||
+ str(self.diameter))
|
||||
else:
|
||||
response += "Filament NOT present"
|
||||
self.gcode.respond(response)
|
||||
self.gcode.respond_info(response)
|
||||
|
||||
def cmd_ClearFilamentArray(self, params):
|
||||
self.filament_array = []
|
||||
self.gcode.respond("Filament width measurements cleared!")
|
||||
self.gcode.respond_info("Filament width measurements cleared!")
|
||||
# Set extrude multiplier to 100%
|
||||
self.gcode.run_script_from_command("M221 S100")
|
||||
|
||||
@@ -151,7 +151,7 @@ class HallFilamentWidthSensor:
|
||||
# Start extrude factor update timer
|
||||
self.reactor.update_timer(self.extrude_factor_update_timer,
|
||||
self.reactor.NOW)
|
||||
self.gcode.respond(response)
|
||||
self.gcode.respond_info(response)
|
||||
|
||||
def cmd_M406(self, params):
|
||||
response = "Filament width sensor Turned Off"
|
||||
@@ -166,7 +166,7 @@ class HallFilamentWidthSensor:
|
||||
self.filament_array = []
|
||||
# Set extrude multiplier to 100%
|
||||
self.gcode.run_script_from_command("M221 S100")
|
||||
self.gcode.respond(response)
|
||||
self.gcode.respond_info(response)
|
||||
|
||||
def cmd_Get_Raw_Values(self, params):
|
||||
response = "ADC1="
|
||||
@@ -175,7 +175,7 @@ class HallFilamentWidthSensor:
|
||||
response += (" RAW="+
|
||||
str(self.lastFilamentWidthReading
|
||||
+self.lastFilamentWidthReading2))
|
||||
self.gcode.respond(response)
|
||||
self.gcode.respond_info(response)
|
||||
def get_status(self, eventtime):
|
||||
return {'Diameter': self.diameter,
|
||||
'Raw':(self.lastFilamentWidthReading+
|
||||
|
||||
@@ -27,7 +27,7 @@ class QueryEndstops:
|
||||
msg = " ".join(["%s:%s" % (name, ["open", "TRIGGERED"][not not t])
|
||||
for name, t in self.last_state])
|
||||
gcode = self.printer.lookup_object('gcode')
|
||||
gcode.respond(msg)
|
||||
gcode.respond_raw(msg)
|
||||
|
||||
def load_config(config):
|
||||
return QueryEndstops(config)
|
||||
|
||||
@@ -32,7 +32,7 @@ class HostResponder:
|
||||
msg = msg[5:]
|
||||
else:
|
||||
msg = ''
|
||||
self.gcode.respond("%s %s" % (self.default_prefix, msg))
|
||||
self.gcode.respond_raw("%s %s" % (self.default_prefix, msg))
|
||||
def cmd_RESPOND(self, params):
|
||||
respond_type = self.gcode.get_str('TYPE', params, None)
|
||||
prefix = self.default_prefix
|
||||
@@ -46,7 +46,7 @@ class HostResponder:
|
||||
" of 'echo', 'command', or 'error'" % (respond_type,))
|
||||
prefix = self.gcode.get_str('PREFIX', params, prefix)
|
||||
msg = self.gcode.get_str('MSG', params, '')
|
||||
self.gcode.respond("%s %s" %(prefix, msg))
|
||||
self.gcode.respond_raw("%s %s" %(prefix, msg))
|
||||
|
||||
def load_config(config):
|
||||
return HostResponder(config)
|
||||
|
||||
@@ -110,11 +110,11 @@ class FilamentWidthSensor:
|
||||
+ str(self.lastFilamentWidthReading))
|
||||
else:
|
||||
response += "Filament NOT present"
|
||||
self.gcode.respond(response)
|
||||
self.gcode.respond_info(response)
|
||||
|
||||
def cmd_ClearFilamentArray(self, params):
|
||||
self.filament_array = []
|
||||
self.gcode.respond("Filament width measurements cleared!")
|
||||
self.gcode.respond_info("Filament width measurements cleared!")
|
||||
# Set extrude multiplier to 100%
|
||||
self.gcode.run_script_from_command("M221 S100")
|
||||
|
||||
@@ -127,7 +127,7 @@ class FilamentWidthSensor:
|
||||
# Start extrude factor update timer
|
||||
self.reactor.update_timer(self.extrude_factor_update_timer,
|
||||
self.reactor.NOW)
|
||||
self.gcode.respond(response)
|
||||
self.gcode.respond_info(response)
|
||||
|
||||
def cmd_M406(self, params):
|
||||
response = "Filament width sensor Turned Off"
|
||||
@@ -142,7 +142,7 @@ class FilamentWidthSensor:
|
||||
self.filament_array = []
|
||||
# Set extrude multiplier to 100%
|
||||
self.gcode.run_script_from_command("M221 S100")
|
||||
self.gcode.respond(response)
|
||||
self.gcode.respond_info(response)
|
||||
|
||||
def load_config(config):
|
||||
return FilamentWidthSensor(config)
|
||||
|
||||
@@ -72,13 +72,13 @@ class VirtualSD:
|
||||
def cmd_M20(self, params):
|
||||
# List SD card
|
||||
files = self.get_file_list()
|
||||
self.gcode.respond("Begin file list")
|
||||
self.gcode.respond_raw("Begin file list")
|
||||
for fname, fsize in files:
|
||||
self.gcode.respond("%s %d" % (fname, fsize))
|
||||
self.gcode.respond("End file list")
|
||||
self.gcode.respond_raw("%s %d" % (fname, fsize))
|
||||
self.gcode.respond_raw("End file list")
|
||||
def cmd_M21(self, params):
|
||||
# Initialize SD card
|
||||
self.gcode.respond("SD card ok")
|
||||
self.gcode.respond_raw("SD card ok")
|
||||
def cmd_M23(self, params):
|
||||
# Select SD file
|
||||
if self.work_timer is not None:
|
||||
@@ -108,8 +108,8 @@ class VirtualSD:
|
||||
except:
|
||||
logging.exception("virtual_sdcard file open")
|
||||
raise self.gcode.error("Unable to open file")
|
||||
self.gcode.respond("File opened:%s Size:%d" % (filename, fsize))
|
||||
self.gcode.respond("File selected")
|
||||
self.gcode.respond_raw("File opened:%s Size:%d" % (filename, fsize))
|
||||
self.gcode.respond_raw("File selected")
|
||||
self.current_file = f
|
||||
self.file_position = 0
|
||||
self.file_size = fsize
|
||||
@@ -132,9 +132,9 @@ class VirtualSD:
|
||||
def cmd_M27(self, params):
|
||||
# Report SD print status
|
||||
if self.current_file is None:
|
||||
self.gcode.respond("Not SD printing.")
|
||||
self.gcode.respond_raw("Not SD printing.")
|
||||
return
|
||||
self.gcode.respond("SD printing byte %d/%d" % (
|
||||
self.gcode.respond_raw("SD printing byte %d/%d" % (
|
||||
self.file_position, self.file_size))
|
||||
# Background work timer
|
||||
def work_handler(self, eventtime):
|
||||
@@ -162,7 +162,7 @@ class VirtualSD:
|
||||
self.current_file.close()
|
||||
self.current_file = None
|
||||
logging.info("Finished SD card print")
|
||||
self.gcode.respond("Done printing file")
|
||||
self.gcode.respond_raw("Done printing file")
|
||||
break
|
||||
lines = data.split('\n')
|
||||
lines[0] = partial_input + lines[0]
|
||||
|
||||
Reference in New Issue
Block a user