Skip to content

Commit

Permalink
Recovered save to EEPROM from earlier versions
Browse files Browse the repository at this point in the history
  • Loading branch information
scmanjarrez committed Apr 28, 2023
1 parent 8bdf2dc commit c2936b5
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 12 deletions.
40 changes: 29 additions & 11 deletions octoprint_SmartABL/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,19 @@ def gcode_queuing(
gcode in self._gcodes_ignore() or cmd in self._gcodes_ignore()
):
self._smartabl_logger.debug(
f"@gcode_queuing:ignore >> "
f"@gcode_queuing:ignore > "
f"Trigger(cmd={cmd}, gcode={gcode}) || "
f"{self._dbg()}"
)
return [None]
elif gcode == "G28":
self.cache = set()
elif gcode in self._gcodes_abl() or cmd in self._gcodes_abl():
self._smartabl_logger.debug(
f"@gcode_queuing:abl > "
f"Trigger(cmd={cmd}, gcode={gcode}) || "
f"{self._dbg()}"
)
self._printer.set_job_on_hold(True)
if self.thread is None:
self.thread = threading.Thread(
Expand All @@ -191,7 +196,7 @@ def gcode_queuing(
self.last_cmd = cmd
cmd = ["@SMARTABLQUERY"]
self._smartabl_logger.debug(
f"@gcode_queuing:abl >> Sending {cmd} > {self._dbg()}"
f"@gcode_queuing:abl_send >> Sending {cmd}"
)
return cmd
return [cmd]
Expand All @@ -206,10 +211,20 @@ def at_command(
self.state["prints"] = 0
self.state["last_mesh"] = self._today()
self._save()
self._smartabl_logger.debug(
f"@at_command:save > {self._dbgstate()}"
)
self._update_frontend()
if self.save_allowed:
cmds = self.fw_metadata[self.firmware]["save"]
self._smartabl_logger.debug(
f"@at_command:save >> Sending {cmds} > "
f"{self._dbgstate()} || "
f"{self._dbginternal()}"
)
self._printer.commands(cmds)
else:
self._smartabl_logger.debug(
f"@at_command:save > {self._dbgstate()} || "
f"{self._dbginternal()}"
)
elif cmd == "SMARTABLQUERY":
self.querying = True
cmds = self.fw_metadata[self.firmware]["info"][0]
Expand Down Expand Up @@ -247,15 +262,18 @@ def at_command(
cmds.append("@SMARTABLSAVE")
self._smartabl_logger.debug(
f"@at_command:decide >> ABL trigger >> Sending {cmds} > "
f"{self._dbginternal()}"
f"{self._dbg()}"
)
self.probe_required = False
else:
if self.save_allowed:
cmds = [self.fw_metadata[self.firmware]["load"]]
if self.last_cmd.startswith("M420 S1 Z"):
cmds = [self.last_cmd]
else:
cmds = [self.fw_metadata[self.firmware]["load"]]
self._smartabl_logger.debug(
f"@at_command:decide >> ABL skip >> Sending {cmds} > "
f"{self._dbginternal()}"
f"{self._dbg()}"
)
if cmds is not None:
self._printer.commands(cmds)
Expand Down Expand Up @@ -316,14 +334,14 @@ def process_line(self, comm_instance, line, *args, **kwargs):
if "EEPROM disabled" in line: # marlin eeprom disabled
self.save_allowed = False
elif self._line_mesh(line) and self.querying:
cmd = "@SMARTABLDECIDE"
cmds = "@SMARTABLDECIDE"
self.valid_mesh = self._valid_mesh(line)
self._smartabl_logger.debug(
f"@process_line:"
f"{'' if self.valid_mesh else 'in'}valid_mesh >> "
f"Sending {cmd} > {self._dbginternal()}"
f"Sending {cmds} > {self._dbginternal()}"
)
self._printer.commands(cmd)
self._printer.commands(cmds)
# elif "M420 S1.0 Z0.0" in line:
# self.valid_mesh = True
# self._smartabl_logger.debug(
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
plugin_name = "OctoPrint-SmartABL"

# The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module
plugin_version = "1.0.0"
plugin_version = "1.1.0"

# The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin
# module
Expand Down

0 comments on commit c2936b5

Please sign in to comment.