From 32538a66b074072ca596fed01824b39ed0690533 Mon Sep 17 00:00:00 2001 From: sergiuToporjinschi Date: Mon, 31 Jan 2022 17:29:25 +0200 Subject: [PATCH] . --- .vscode/launch.json | 36 ++++++++++++++++++++++++++ .vscode/settings.json | 20 ++++++++++++++ .vscode/tasks.json | 17 ++++++++++++ octoprint_CalibrationTools/__init__.py | 5 ++-- octoprint_CalibrationTools/api.py | 3 +-- 5 files changed, 77 insertions(+), 4 deletions(-) create mode 100644 .vscode/launch.json create mode 100644 .vscode/settings.json create mode 100644 .vscode/tasks.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..509602c --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,36 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Odoo: Attach", + "type": "python", + "request": "attach", + "port": 5678, + "debugServer": 5678, + "host": "localhost", + "pathMappings": [ + { + "localRoot": "${workspaceFolder}", + "remoteRoot": "/octoprint/octoprint/plugins/OctoPrint-CalibrationTools", + } + ], + "cwd": "${workspaceFolder}/src", + "logToFile": true + }, + { + "name": "Python: Remote Attach", + "type": "python", + "request": "attach", + "connect": { + "host": "localhost", + "port": 5678 + }, + "pathMappings": [ + { + "localRoot": "${workspaceFolder}", + "remoteRoot": "/octoprint/octoprint/plugins/OctoPrint-CalibrationTools", + } + ], + }, + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..4e8078c --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,20 @@ +{ + // "python.defaultInterpreterPath": "venv3/bin/python", + "python.formatting.provider": "black", + "python.formatting.blackArgs": [ + "--config", + "black.toml" + ], + "editor.formatOnSave": true, + "python.sortImports.args": [ + "--profile=black", + ], + "[python]": { + "editor.codeActionsOnSave": { + "source.organizeImports": true + } + }, + "python.linting.pylintEnabled": false, + // "python.linting.flake8Enabled": true, + "python.linting.enabled": true +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..8826d8e --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,17 @@ +{ + // "version": "0.2.0", + // "configurations": [ + // { + // "name": "OctoPrint", + // "type": "python", + // "request": "launch", + // "module": "octoprint", + // "args": [ + // "serve", + // "--debug" + // ], + // "cwd": "${workspaceFolder}/octoprint_CalibrationTools", + // "preLaunchTask": "clean build artifacts" + // } + // ] +} \ No newline at end of file diff --git a/octoprint_CalibrationTools/__init__.py b/octoprint_CalibrationTools/__init__.py index 6fbaa0c..39c8be9 100644 --- a/octoprint_CalibrationTools/__init__.py +++ b/octoprint_CalibrationTools/__init__.py @@ -3,7 +3,7 @@ from __future__ import absolute_import, division, print_function, unicode_litera import octoprint.plugin -from octoprint_CalibrationTools import (api, hooks, models) +from octoprint_CalibrationTools import api, hooks, models defaultSettings = { "eSteps": { @@ -16,6 +16,7 @@ defaultSettings = { } } + class CalibrationtoolsPlugin( octoprint.plugin.StartupPlugin, octoprint.plugin.TemplatePlugin, @@ -32,7 +33,7 @@ class CalibrationtoolsPlugin( self.collectCommand = False def on_after_startup(self): - self._logger.debug("----------------[ CalibrationTools ]----------------") + self._logger.debug("---------------[ CalibrationTools ]---------------") self.data = self.getModel() self.collectCommand = True self._printer.commands("M92") diff --git a/octoprint_CalibrationTools/api.py b/octoprint_CalibrationTools/api.py index 28556fd..b9c8ab3 100644 --- a/octoprint_CalibrationTools/api.py +++ b/octoprint_CalibrationTools/api.py @@ -69,8 +69,7 @@ class API(octoprint.plugin.SimpleApiPlugin): if command == CMD_SAVE_E_STEPS: cmds = ["M92 E%(newESteps)s" % data, "M500"] - if self. - cmds = cmds + ["M104 S0"] + cmds = cmds + ["M104 S0"] self._printer.commands() return