Skip to content

Commit

Permalink
Merge pull request #200 from benlye/more-bft
Browse files Browse the repository at this point in the history
More BFT
  • Loading branch information
benlye authored Feb 10, 2021
2 parents 482f02f + 197643d commit 2796d9f
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 9 deletions.
2 changes: 2 additions & 0 deletions octoprint_firmwareupdater/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ def initialize(self):
self._console_logger.setLevel(logging.DEBUG)
self._console_logger.propagate = False

self._logger.info("Python binproto2 package installed: {}".format(marlinbft._check_binproto2(self)))

# Event handler
def on_event(self, event, payload):
#self._logger.info("Got event: {}".format(event))
Expand Down
23 changes: 17 additions & 6 deletions octoprint_firmwareupdater/methods/marlinbft.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
import os
import time
import shutil
import subprocess
import sys
import binproto2 as mbp

binproto2_installed = True
try:
import binproto2 as mbp
except:
binproto2_installed = False

current_baudrate = None

def _check_binproto2(self):
global binproto2_installed
return binproto2_installed

def _check_marlinbft(self):
self._logger.info("Marlin BINARY_FILE_TRANSFER capability is %s" % (self._settings.get_boolean(["marlinbft_hascapability"])))
if not self._settings.get_boolean(["marlinbft_hascapability"]):
self._logger.info("Python package 'marlin-binary-protocol' is installed: %s" % (_check_binproto2(self)))
self._logger.info("Marlin BINARY_FILE_TRANSFER capability is enabled: %s" % (self._settings.get_boolean(["marlinbft_hascapability"])))

if not _check_binproto2(self):
self._logger.error("Python package 'marlin-binary-protocol' is not installed")
self._send_status("flasherror", subtype="nobinproto2")
elif not self._settings.get_boolean(["marlinbft_hascapability"]):
self._logger.error("Marlin BINARY_FILE_TRANSFER capability is not supported")
self._send_status("flasherror", subtype="nobftcap")
return False
Expand Down
4 changes: 4 additions & 0 deletions octoprint_firmwareupdater/static/js/firmwareupdater.js
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,10 @@ $(function() {
message = gettext("Printer does not report support for the Marlin Binary File Transfer protocol.");
break;
}
case "nobinproto2": {
message = gettext("Python package 'marlin-binary-protocol' is not installed.");
break;
}
case "already_flashing": {
message = gettext("Already flashing.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@
<!-- End advanced options-->

<!-- Pre-flash and post-flash settings -->
<div data-bind="visible: !showPostflashConfig() && (showAvrdudeConfig() || showBossacConfig() || showLpc1768Config() || showDfuConfig() || showStm32flashConfig())">
<div data-bind="visible: !showPostflashConfig() && (showAvrdudeConfig() || showBossacConfig() || showLpc1768Config() || showDfuConfig() || showStm32flashConfig() || showMarlinBftConfig())">
<label data-bind="click: togglePostflashConfig" >
<i class="icon-chevron-right icon-fixed-width"></i>Pre-Flash and Post-Flash Settings
</label>
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
plugin_name = "OctoPrint-FirmwareUpdater"

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

# The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin
# module
Expand All @@ -33,7 +33,7 @@
plugin_license = "AGPLv3"

# Any additional requirements besides OctoPrint should be listed here
plugin_requires = ["pyserial>=3.5","marlin-binary-protocol>=0.0.7"]
plugin_requires = ["pyserial>=3.5"]

### --------------------------------------------------------------------------------------------------------------------
### More advanced options that you usually shouldn't have to touch follow after this point
Expand Down

0 comments on commit 2796d9f

Please sign in to comment.