From 1f352e95e6774ea733b5876bb9bb7ac9f2109ca2 Mon Sep 17 00:00:00 2001 From: Andy Werner Date: Wed, 13 Mar 2019 19:06:34 +0100 Subject: [PATCH] Fixes error state if flash_grbl (avrdude) failed + analytics: added avrdude output --- octoprint_mrbeam/analytics/analytics_handler.py | 7 ++++--- octoprint_mrbeam/comm_acc2.py | 9 +++------ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/octoprint_mrbeam/analytics/analytics_handler.py b/octoprint_mrbeam/analytics/analytics_handler.py index d178337d3..5080111d3 100644 --- a/octoprint_mrbeam/analytics/analytics_handler.py +++ b/octoprint_mrbeam/analytics/analytics_handler.py @@ -65,7 +65,7 @@ def __init__(self, plugin): self._storedConversions = list() self._jobevent_log_version = 4 - self._deviceinfo_log_version = 3 + self._deviceinfo_log_version = 4 self._logevent_version = 1 self._dust_log_version = 2 self._cam_event_log_version = 2 @@ -250,11 +250,12 @@ def _event_startup(self,event,payload): def _event_shutdown(self,event,payload): self._write_deviceinfo(ak.SHUTDOWN) - def write_flash_grbl(self, from_version, to_version, succesful): + def write_flash_grbl(self, from_version, to_version, succesful, err=None): payload = dict( from_version=from_version, to_version=to_version, - succesful=succesful) + succesful=succesful, + err=err) self._write_deviceinfo(ak.FLASH_GRBL, payload=payload) def _event_ip_addresses(self): diff --git a/octoprint_mrbeam/comm_acc2.py b/octoprint_mrbeam/comm_acc2.py index 8fd29ebfd..50b4fed58 100644 --- a/octoprint_mrbeam/comm_acc2.py +++ b/octoprint_mrbeam/comm_acc2.py @@ -1063,20 +1063,17 @@ def flash_grbl(self, grbl_file=None, verify_only=False, is_connected=True): _mrbeam_plugin_implementation._analytics_handler.write_flash_grbl( from_version=from_version, to_version=grbl_file, - succesful=(code == 0)) + succesful=(code == 0), + err = None if (code == 0) else output) except: self._logger.exception("Exception while writing GRBL-flashing to analytics: ") # error case if code != 0 and not verify_only: - msg_short = "ERROR flashing GRBL '{}'".format(grbl_file) + msg_short = "ERROR flashing GRBL '{}': FAILED (See Avrdude output above for details.)".format(grbl_file) msg_long = '{}:\n{}'.format(msg_short, output) self._logger.error(msg_long, terminal_as_comm=True) self._logger.error(msg_short, terminal_as_comm=True) - self._errorValue = "avrdude returncode: %s" % code - self._changeState(self.STATE_CLOSED_WITH_ERROR) - self._logger.info("Please reconnect manually or reboot system.", terminal_as_comm=True) - return elif code != 0 and verify_only: msg_short = "Verification GRBL '{}': FAILED (See Avrdude output above for details.)".format(grbl_file) msg_long = '{}:\n{}'.format(msg_short, output)