Skip to content

Commit

Permalink
Extended the plugin to support Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
danieleborgo committed Feb 15, 2024
1 parent 1226f40 commit c40bd54
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ dist
*.egg*
.DS_Store
*.zip
/.venv/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ The _Filament Sensor_ module is different since it uses a Python module
specifically developed for the Raspberry boards, _gpiozero_, so it has
this board as prerequisite. Nevertheless, Marlin is not a requirement,
since it only uses OctoPrint functionalities. In the case FilamentBuddy
is not running on a Raspberry Pi, the plugin will disable this features.
is not running on a Raspberry Pi, the plugin will disable this feature.

## Setup

Expand Down
3 changes: 2 additions & 1 deletion extra/filamentbuddy.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ compatibility:

os:
- linux
- windows

# Compatible Python version
#
Expand Down Expand Up @@ -176,7 +177,7 @@ The _Filament Sensor_ module is different since it uses a Python module
specifically developed for the Raspberry boards, _gpiozero_, so it has
this board as prerequisite. Nevertheless, Marlin is not a requirement,
since it only uses OctoPrint functionalities. In the case FilamentBuddy
is not running on a Raspberry Pi, the plugin will disable this features.
is not running on a Raspberry Pi, the plugin will disable this feature.

## Setup

Expand Down
2 changes: 1 addition & 1 deletion octoprint_filamentbuddy/manager/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
try:
from RPi import GPIO
is_imported = True
except RuntimeError:
except (RuntimeError, ModuleNotFoundError):
is_imported = False


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,9 +292,12 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.

<div class="control-group gpio-unavailable-notification"
data-bind="visible: !filamentbuddy.is_gpio_available()">
Filament Sensor has been disabled since the GPIO has not been found.
This message should appear if FilamentBuddy is not running on a Raspberry Pi.<br>
It is still possible to use Filament Changer and Filament Remover.
Filament Sensor has been disabled since the GPIO has not been found. This message should appear
only when FilamentBuddy is not running on a Raspberry Pi.<br>
It is still possible to use Filament Changer and Filament Remover.<br><br>
In case this plugin is running on a Raspberry and this message is shown, it is suggested to
uninstall it, reboot OctoPrint and then install it again. If the problem persists, open an issue
<a href="https://github.com/danieleborgo/OctoPrint-FilamentBuddy" target="_blank">here</a>.
</div>

<div class="control-group">
Expand Down
7 changes: 6 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# coding=utf-8

from platform import system

########################################################################################################################
# Do not forget to adjust the following variables to your own plugin.

Expand Down Expand Up @@ -35,9 +37,12 @@

# Any additional requirements besides OctoPrint should be listed here
plugin_requires = [
"OctoPrint>=1.7.2", "RPi.GPIO>=0.7.1", "gpiozero>=1.6.2", "flask>=2.2.3", "paho-mqtt>=1.6.1",
"OctoPrint>=1.7.2", "flask>=2.2.3", "paho-mqtt>=1.6.1",
]

if system() != "Windows":
plugin_requires.extend(["gpiozero>=1.6.2", "RPi.GPIO>=0.7.1"])

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

0 comments on commit c40bd54

Please sign in to comment.