Skip to content

Commit

Permalink
Update __init__.py
Browse files Browse the repository at this point in the history
Unmount the SD card from the host before resetting.
  • Loading branch information
benlye committed May 9, 2019
1 parent 0ce340a commit 2d8d39f
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions octoprint_firmwareupdater/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,15 @@ def _flash_lpc1768(self, firmware=None, printer_port=None):

if self._settings.get_boolean(["lpc1768_preflashreset"]):
self._send_status("progress", subtype="boardreset")

unmount_command = 'sudo umount ' + lpc1768_path
self._logger.info(u"Unmounting SD card: '{}'".format(unmount_command))
try:
r = os.system(unmount_command)
except:
e = sys.exc_info()[0]
self._logger.error("Error executing unmount command '{}'".format(unmount_command))

self._logger.info(u"Pre-flash reset: attempting to reset the board")
if not self._reset_lpc1768(printer_port):
self._logger.error(u"Reset failed")
Expand Down Expand Up @@ -551,6 +560,14 @@ def _flash_lpc1768(self, firmware=None, printer_port=None):
self._send_status("flasherror")
return False

unmount_command = 'sudo umount ' + lpc1768_path
self._logger.info(u"Unmounting SD card: '{}'".format(unmount_command))
try:
r = os.system(unmount_command)
except:
e = sys.exc_info()[0]
self._logger.error("Error executing unmount command '{}'".format(unmount_command))

self._logger.info(u"Firmware update reset: attempting to reset the board")
if not self._reset_lpc1768(printer_port):
self._logger.error(u"Reset failed")
Expand Down

0 comments on commit 2d8d39f

Please sign in to comment.