Skip to content

Commit d5a9057

Browse files
committed
Handle last BFT filename string indexes
Filename index is a string in OctoPrint >= 1.8.0
1 parent a2a5556 commit d5a9057

3 files changed

Lines changed: 9 additions & 7 deletions

File tree

octoprint_firmwareupdater/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,8 @@ def get_lastbft_filename(self):
520520
return None
521521
if profile_id in filenames.keys():
522522
return filenames[profile_id]
523+
elif str(profile_id) in filenames.keys():
524+
return filenames[str(profile_id)]
523525
else:
524526
return None
525527
else:
@@ -531,7 +533,7 @@ def set_lastbft_filename(self, value):
531533
last_bft_filenames = self._settings.get(["last_bft_filenames"])
532534
last_bft_filenames[profile_id] = value
533535
self._settings.set(["last_bft_filenames"], last_bft_filenames)
534-
536+
535537
# Send capability information to the UI
536538
def _send_capability(self, capability, enabled):
537539
self._plugin_manager.send_plugin_message(self._identifier, dict(type="capability", capability=capability, enabled=enabled))
@@ -718,7 +720,7 @@ def on_settings_migrate(self, target, current=None):
718720
if "marlinbft_last_filename" in profile and profile["marlinbft_last_filename"] is not None:
719721
last_bft_filenames_new.update({index: profile["marlinbft_last_filename"]})
720722
del profile["marlinbft_last_filename"]
721-
723+
722724
profiles_new.append(profile)
723725

724726
self._settings.set(['last_bft_filenames'],last_bft_filenames_new)

octoprint_firmwareupdater/methods/marlinbft.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ def _flash_marlinbft(self, firmware=None, printer_port=None, **kwargs):
7777
time.sleep(bft_waitafterconnect)
7878

7979
# Try to delete the last-flashed file
80-
if timestamp_filenames and self.get_lastbft_filename() is not None:
81-
last_filename = self.get_lastbft_filename()
80+
last_filename = self.get_lastbft_filename()
81+
if timestamp_filenames and last_filename is not None:
8282
self._logger.info(u"Attempting to delete previous firmware file /{}".format(last_filename))
8383
protocol.send_ascii("M21")
8484
protocol.send_ascii("M30 {}".format(last_filename))
@@ -245,7 +245,7 @@ def _wait_for_start(self, printer_port=None):
245245
if not restarted:
246246
self._logger.error(u"Timeout waiting for board to reset")
247247
return False
248-
248+
249249
end = time.time()
250250
duration = round((end - start),2)
251251

@@ -303,7 +303,7 @@ def _wait_for_board(self, printer_port=None, no_restart_wait=False):
303303
m997_restart_wait = self.get_profile_setting("marlinbft_m997_restart_wait")
304304
if m997_restart_wait is None:
305305
m997_restart_wait = 20
306-
306+
307307
self._logger.info(u"Waiting {seconds}s for printer at '{port}' to restart".format(seconds=m997_restart_wait, port=printer_port))
308308

309309
timeout = m997_restart_wait

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
plugin_name = "OctoPrint-FirmwareUpdater"
1515

1616
# The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module
17-
plugin_version = "1.13.2"
17+
plugin_version = "1.13.3b1"
1818

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

0 commit comments

Comments
 (0)