From 5fb0f9c6e08e2a25ec48f453648e1dcd663e94ce Mon Sep 17 00:00:00 2001 From: "mattia.gallacchi" Date: Tue, 12 Mar 2024 10:27:14 +0100 Subject: [PATCH 1/3] Add ci file Signed-off-by: mattia.gallacchi --- .gitlab-ci.yml | 67 +++++++++++++++++++++++++++++++++++++++++++++++++ ms210/driver.py | 53 +++++++++++++++++++++++--------------- poetry.lock | 8 +++--- pyproject.toml | 2 +- 4 files changed, 105 insertions(+), 25 deletions(-) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..0269507 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,67 @@ +# This file is a template, and might need editing before it works on your project. +# This is a sample GitLab CI/CD configuration file that should run without any modifications. +# It demonstrates a basic 3 stage CI/CD pipeline. Instead of real tests or scripts, +# it uses echo commands to simulate the pipeline execution. +# +# A pipeline is composed of independent jobs that run scripts, grouped into stages. +# Stages run in sequential order, but jobs within stages run in parallel. +# +# For more information, see: https://docs.gitlab.com/ee/ci/yaml/index.html#stages +# +# You can copy and paste this template into a new `.gitlab-ci.yml` file. +# You should not add this template to an existing `.gitlab-ci.yml` file by using the `include:` keyword. +# +# To contribute improvements to CI/CD templates, please follow the Development guide at: +# https://docs.gitlab.com/ee/development/cicd/templates.html +# This specific template is located at: +# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Getting-Started.gitlab-ci.yml + +stages: # List of stages for jobs, and their order of execution + - lint + - deploy + +default: + image: + name: labinfo.ing.he-arc.ch:5050/igib/shared/ci-docker/poetry1.2.0-python3.10 + entrypoint: [ "" ] + +lint-black: + stage: lint + tags: + - docker + rules: + - if: $CI_PIPELINE_SOURCE == "merge_request_event" + when: always + allow_failure: false + script: + - poetry install --only lint + - poetry run black --check ms210/ + +lint-pylint: + stage: lint + tags: + - docker + rules: + - if: $CI_PIPELINE_SOURCE == "merge_request_event" + when: always + allow_failure: false + script: + - poetry install --only lint + - poetry run pylint --fail-under=8 ms210/ + +deploy-job: # This job runs only when the merge is accepted + stage: deploy # It only runs when *both* jobs in the test stage complete successfully. + tags: + - docker + environment: production + rules: + - if: $CI_COMMIT_BRANCH == "main" && $CI_PIPELINE_SOURCE == "push" + when: always + - when: never + + script: + - poetry install --only main + - poetry config repositories.gitlab https://labinfo.ing.he-arc.ch/gitlab/api/v4/projects/$CI_PROJECT_ID/packages/pypi + - poetry config http-basic.gitlab gitlab-ci-token "$CI_JOB_TOKEN" + - poetry build + - poetry publish --repository gitlab \ No newline at end of file diff --git a/ms210/driver.py b/ms210/driver.py index 8d3c729..dc6054a 100644 --- a/ms210/driver.py +++ b/ms210/driver.py @@ -1,24 +1,33 @@ -# This module contains a class to control the MS210 device +"""This module contains a class to control the MS210 device +""" -import serial from typing import Literal from dataclasses import dataclass +import serial _BAUD = 19200 _CHANNELS = ["IR", "R", "B", "G"] _MAX_VALUE = 1000 _MIN_VALUE = 0 + @dataclass class Channel: - name : str - index : int - value : int + """Holds channel attributes + """ + + name: str + index: int + value: int + class MS210InitFailed(Exception): - pass + """MS210 serial communication failed + """ class MS210: + """MS210 driver class + """ def __init__(self, port: str = "/dev/ttyUSB0"): """Constructor of the MS210 object @@ -30,13 +39,13 @@ class MS210: Raises ------ - MS210InitFailed if device not found + MS210InitFailed if device not found """ - + self._ser = serial.Serial(timeout=2) self._ser.port = port self._ser.baudrate = _BAUD - + self.channels = [] for index, channel in enumerate(_CHANNELS): self.channels.append(Channel(channel, index, 0)) @@ -52,11 +61,10 @@ class MS210: raise MS210InitFailed(msg) def __del__(self): - """Destructor - """ + """Destructor""" for channel in _CHANNELS: self.set_value(channel, 0) - + self._ser.close() def __check_limits(self, value: int) -> bool: @@ -74,10 +82,10 @@ class MS210: if value > _MAX_VALUE: return False - + if value < _MIN_VALUE: return False - + return True def __get_current_values(self) -> tuple[bool, str]: @@ -90,7 +98,7 @@ class MS210: """ buf = "" - + for channel in self.channels: try: self._ser.write(f"R{channel.index}".encode()) @@ -108,7 +116,7 @@ class MS210: channel.value = int(buf[2:].decode().strip()) return (True, "OK") - + def get_value(self, channel: Literal["IR", "R", "B", "G"]) -> int: """Get the value of a channel @@ -124,7 +132,9 @@ class MS210: return [x for x in self.channels if x.name == channel][0].value - def set_value(self, channel: Literal["IR", "R", "B", "G"], value : int = 0) -> tuple[bool, str]: + def set_value( + self, channel: Literal["IR", "R", "B", "G"], value: int = 0 + ) -> tuple[bool, str]: """Set the value of a channel Parameters @@ -139,9 +149,12 @@ class MS210: tuple: bool, str success, an error msg in not success """ - + if not self.__check_limits(value): - return (False, f"Value {value} is out of bound. {_MIN_VALUE} < value < {_MAX_VALUE}") + return ( + False, + f"Value {value} is out of bound. {_MIN_VALUE} < value < {_MAX_VALUE}", + ) _channel = [x for x in self.channels if x.name == channel][0] if value == _channel.value: @@ -160,4 +173,4 @@ class MS210: _channel.value = int(buf[2:].decode().strip()) - return (True, "OK") \ No newline at end of file + return (True, "OK") diff --git a/poetry.lock b/poetry.lock index bad3dbe..7328805 100644 --- a/poetry.lock +++ b/poetry.lock @@ -148,7 +148,7 @@ testutils = ["gitpython (>3)"] name = "PyQt6" version = "6.4.2" description = "Python bindings for the Qt cross platform application toolkit" -category = "main" +category = "dev" optional = false python-versions = ">=3.6.1" @@ -174,7 +174,7 @@ qt6-tools = ">=6.4.3.1.2,<6.4.3.2" name = "PyQt6-Qt6" version = "6.4.3" description = "The subset of a Qt installation needed by PyQt6." -category = "main" +category = "dev" optional = false python-versions = "*" @@ -182,7 +182,7 @@ python-versions = "*" name = "PyQt6-sip" version = "13.6.0" description = "The sip module support for PyQt6" -category = "main" +category = "dev" optional = false python-versions = ">=3.7" @@ -269,7 +269,7 @@ python-versions = ">=3.8" [metadata] lock-version = "1.1" python-versions = "^3.10" -content-hash = "4bbcc48f2001eebe9ea479fb0e898e9b60db95e30d73173cace2241b922edadf" +content-hash = "5c5b64c360238d047ead8cb0b9f4a25f0af1e8b4baaf737fad2838b3db4dc40f" [metadata.files] astroid = [ diff --git a/pyproject.toml b/pyproject.toml index d77d235..8c603da 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,11 +8,11 @@ readme = "README.md" [tool.poetry.dependencies] python = "^3.10" pyserial = "^3.5" -PyQt6 = "6.4.2" [tool.poetry.group.dev.dependencies] pyqt6-tools = "^6.4.2.3.3" +PyQt6 = "6.4.2" [tool.poetry.group.lint.dependencies] -- GitLab From e6f2e05af612acbc114538ea46089efcf68a915a Mon Sep 17 00:00:00 2001 From: "mattia.gallacchi" Date: Tue, 12 Mar 2024 10:48:18 +0100 Subject: [PATCH 2/3] Update readme Signed-off-by: mattia.gallacchi --- README.md | 66 ++++++++++++++++++++++++++++++++++++---- app/ms210_controller.py | 16 +++++++--- img/ms210_ui.png | Bin 0 -> 10456 bytes ms210/driver.py | 10 +++--- pyproject.toml | 6 ++++ 5 files changed, 82 insertions(+), 16 deletions(-) create mode 100644 img/ms210_ui.png diff --git a/README.md b/README.md index 3eb5efe..f31d272 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,14 @@ This repository contains a small python module to control the MS210 Channel Mixer by Advanced Illumination +> **NOTE**: +> +> For linux user add your user to the *dialout* group to access the serial port +> +> ```bash +> sudo usermod -aG dialout $USER +> ``` + ## Dependencies | Name | Version | @@ -9,13 +17,59 @@ This repository contains a small python module to control the MS210 Channel Mixe | Python | >= 3.10 | | Poetry | >= 1.2.0 | -## Add package +Install python dependencies: -TODO: +```bash +poetry install +``` -## Linux -For linux user add your user to the *dialout* group to access the serial port +## App + +A QT based graphical interface to control the **MS210** is available and can be run with the following command: + +```bash +poetry run controller +``` + +![UI](img/ms210_ui.png) + +## Add the MS210 package + +Instructions to add the MS210 package to your project + +### Poetry + +Add a secondary source to your poetry project ```bash -sudo usermod -aG dialout $USER -``` \ No newline at end of file +poetry source add -s igib https://labinfo.ing.he-arc.ch/gitlab/api/v4/projects/2417/packages/pypi/simple +``` + +Add **ms210** package + +```bash +poetry add ms210 --source igib +``` + +### PIP + +```bash +pip install pyrsvp --index-url https://labinfo.ing.he-arc.ch/gitlab/api/v4/projects/2417/packages/pypi/simple/ +``` + +## Usage + +```python +dev = MS210("/dev/ttyUSB0") + +# Set the red value +success, msg = dev.set_value("R", 500) +if not success: + print(msg) + +# Get the green value +green = dev.get_value("G") +print(green) +``` + +## Linux diff --git a/app/ms210_controller.py b/app/ms210_controller.py index fdde689..6f88cc6 100644 --- a/app/ms210_controller.py +++ b/app/ms210_controller.py @@ -1,8 +1,9 @@ import sys from typing import Literal +from PyQt6.QtGui import QCloseEvent from PyQt6.QtWidgets import QApplication, QMainWindow, QMessageBox -from ms210_ui import Ui_MainWindow +from app.ms210_ui import Ui_MainWindow from ms210.driver import MS210, MS210InitFailed import serial.tools.list_ports @@ -139,11 +140,18 @@ class Window(QMainWindow, Ui_MainWindow): self.blue_slider.setValue(self.blue_sb.value()) def error_msg(self, msg : str): - QMessageBox.critical(None, "Error", msg) + QMessageBox.critical(None, "Error", msg) -if "__main__" == __name__: + def closeEvent(self, a0: QCloseEvent) -> None: + self._ms210 = None + return super().closeEvent(a0) + +def main(): app = QApplication(sys.argv) win = Window() win.show() - sys.exit(app.exec()) \ No newline at end of file + sys.exit(app.exec()) + +if "__main__" == __name__: + main() \ No newline at end of file diff --git a/img/ms210_ui.png b/img/ms210_ui.png new file mode 100644 index 0000000000000000000000000000000000000000..bb48fb3e25012a88d7ef7c39fe535a43147ef168 GIT binary patch literal 10456 zcmeHtXIN8dw|49WMaKf8bfkzhc~N=*LBU9qE+|1nk&g6Etl)?OB2uJT5Ts`4Ef5hA z1f+x#Awr}E2%XS^fwQ(VzTbP!kMDZ_eAjoba~-Z3XV`hne)f9Sy6=14YyWXkUwiNF zqq|Wk)LzW_vqmV?COrJxwR1aM(IR=J!+*AVYG6!u!cWl7>kr}gBVOk&c^SLedHLFS z+(6xQb#u8P>1pe6 z`O-~~e8SV6Tq;$ab9)z2oVj&x7T>8BnU?kr=Br#(xm1_y=^&9jh>Mejts!SgR?!EJ5ssr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p&Hb(#e literal 0 HcmV?d00001 diff --git a/ms210/driver.py b/ms210/driver.py index dc6054a..200b6de 100644 --- a/ms210/driver.py +++ b/ms210/driver.py @@ -13,8 +13,7 @@ _MIN_VALUE = 0 @dataclass class Channel: - """Holds channel attributes - """ + """Holds channel attributes""" name: str index: int @@ -22,12 +21,11 @@ class Channel: class MS210InitFailed(Exception): - """MS210 serial communication failed - """ + """MS210 serial communication failed""" + class MS210: - """MS210 driver class - """ + """MS210 driver class""" def __init__(self, port: str = "/dev/ttyUSB0"): """Constructor of the MS210 object diff --git a/pyproject.toml b/pyproject.toml index 8c603da..69c8f13 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,6 +4,9 @@ version = "0.1.0" description = "Drive the MS210 device" authors = ["Mattia Gallacchi "] readme = "README.md" +packages = [ + {include = "app/"} +] [tool.poetry.dependencies] python = "^3.10" @@ -22,3 +25,6 @@ pylint = "^3.1.0" [build-system] requires = ["poetry-core"] build-backend = "poetry.core.masonry.api" + +[tool.poetry.scripts] +controller = "app.ms210_controller:main" -- GitLab From b838e9e822e4cf77700608b4a8ebf918182658c9 Mon Sep 17 00:00:00 2001 From: "mattia.gallacchi" Date: Tue, 12 Mar 2024 10:51:15 +0100 Subject: [PATCH 3/3] Correct README Signed-off-by: mattia.gallacchi --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index f31d272..f0a62e8 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,4 @@ if not success: # Get the green value green = dev.get_value("G") print(green) -``` - -## Linux +``` \ No newline at end of file -- GitLab