Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[flake8]
max-line-length = 140
23 changes: 23 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Run Tests

on:
push:
branches-ignore:
- main
pull_request:

jobs:
pytest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install test dependencies
run: |
pip install OctoPrint
pip install .[test]
- name: Run pytest
run: pytest -v
126 changes: 126 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# Byte-compiled / optimized / DLL files
*__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json
11 changes: 11 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[FORMAT]
max-line-length=120

[MESSAGES CONTROL]
disable =
missing-module-docstring,
missing-class-docstring,
missing-function-docstring,
too-few-public-methods,
invalid-name,
too-many-instance-attributes,
19 changes: 16 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# OctoPrint Filament Scale
# OctoPrint Filament Scale Enhanced

This plugin allows connecting an HX711-based load cell to Octoprint to read out the current weight of the remaining filament.

Expand All @@ -8,17 +8,30 @@ See here for instructions on wiring up the load cell: https://tutorials-raspberr

This plugin assumes you connected the data pin to GPIO20, and the clock pin to GPIO21.

You will also need the bracket to connect the load cell to your printer: https://www.thingiverse.com/thing:3037926
You will also need the bracket to connect the load cell to your printer: i
- Regular Spool Holder: https://www.thingiverse.com/thing:3037926
- Spannerhands Spool Holder: https://www.thingiverse.com/thing:4834908

## Setup

Install via the bundled [Plugin Manager](https://github.com/foosel/OctoPrint/wiki/Plugin:-Plugin-Manager)
or manually using this URL:

https://github.com/dieki-n/OctoPrint-Filament-scale/archive/master.zip
https://github.com/techman83/OctoPrint-Filament-Scale/archive/main.zip


## Configuration

Once you have wired up the HX711, it must be calibrated. This is a pretty straightforward process, and all you will need is an object of known weight. Attach the load cell to your printer with the printed bracket, then follow the instructions on the plugin's settings page.

## Development

Python 3 + Python 3 Virtualenv recommended

```
python3 -m venv venv
source venv/bin/activate
pip install ".[development]"
```

Running Tests: `pytest -v`
3 changes: 0 additions & 3 deletions extras/filament_scale.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ compatibility:
# You can also remove the whole "octoprint" block. Removing it will default to all
# OctoPrint versions being supported.

octoprint:
- 1.2.0

# List of compatible operating systems
#
# Valid values:
Expand Down
7 changes: 7 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[mypy]
ignore_missing_imports = true
warn_redundant_casts = true
show_error_context = true
show_column_numbers = true
show_error_codes = true
pretty = true
Loading