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
6 changes: 2 additions & 4 deletions .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
on:
push:
branches:
- master
- main
tags:
- "[0-9]+.[0-9]+.[0-9]+"

jobs:
build_and_deploy:
uses: sensirion/.github/.github/workflows/driver.python.pypi_publish.yml@main
secrets:
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}

secrets: inherit
4 changes: 2 additions & 2 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ on:
workflow_dispatch:
push:
branches:
- master
- main

jobs:
documentation:
uses: sensirion/.github/.github/workflows/driver.python.documentation.yml@main
with:
build-python-version: 3.8
use-project-requirements: true
11 changes: 11 additions & 0 deletions .github/workflows/gh_workflow_metadata_update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Driver Index Metadata Update

on:
push:
branches:
- main

jobs:
driver-index-metadata-update:
uses: sensirion/.github/.github/workflows/driver.common.di_metadata_update.yml@main
secrets: inherit
8 changes: 6 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@ name: Validate and Test Python Package
on:
pull_request:
branches:
- master
- main
push:
branches:
- master
- main

jobs:
dg-metadata-validation:
if: github.event_name == 'push' && github.ref != 'refs/head/main'
uses: sensirion/.github/.github/workflows/driver.generated.metadata_check.yml@main

test:
uses: sensirion/.github/.github/workflows/driver.python.test.yml@main
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# CHANGELOG

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]


## [2.0.3] - 2023-11-15


### Added

- function get_product_type_as_int as get_product_type has no longer a parameter as_int

### Changed

- Renamed from svm41 to svm4x

### ### Removed

- SetNoxState and GetNoxState are not supported in newer firmware


## [0.1.0] - 2023-10-23

### Added

- Initial release

[Unreleased]: https://github.com/Sensirion/python-uart-svm4x/compare/2.0.3...HEAD
[2.0.3]: https://github.com/Sensirion/python-uart-svm4x/releases/tag/2.0.3
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 3-Clause License

Copyright (c) 2023, Sensirion AG
Copyright (c) 2026, Sensirion AG
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Click [here](https://www.sensirion.com/my-sgp-ek/) to learn more about the Sensi


The SVM4x evaluation kit covers evaluation of the SGP40 and SGP41 sensors.
This driver supports SVM4x firmware version 3.1.0 and above.



Expand Down Expand Up @@ -45,12 +46,6 @@ See the [documentation page](https://sensirion.github.io/python-uart-svm4x) for

## Contributing

We develop and test this driver using our company internal tools (version
control, continuous integration, code review etc.) and automatically
synchronize the `master` branch with GitHub. But this doesn't mean that we
don't respond to issues or don't accept pull requests on GitHub. In fact,
you're very welcome to open issues or create pull requests :-)

### Check coding style

The coding style can be checked with [`flake8`](http://flake8.pycqa.org/):
Expand Down
10 changes: 0 additions & 10 deletions README.rst

This file was deleted.

9 changes: 2 additions & 7 deletions docs/build-documentation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,5 @@ The documentation is built with `Sphinx <http://www.sphinx-doc.org>`_:

.. code-block:: bash

python setup.py install # Install package
pip install -r docs/requirements.txt # Install requirements
cd docs # Change to docs folder
make html # Build documentation


The generated documentation is located in docs/_build/html.
python -m pip install .[docs] # Install doc requirements
sphinx-build -b html docs docs/_build/html # Build documentation
14 changes: 9 additions & 5 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html


import os
import sys
from datetime import datetime

import pkg_resources
import importlib.metadata as metadata
import sphinx_tabs.tabs

import sphinx.ext.autodoc

import sensirion_uart_svm4x
Expand All @@ -17,16 +20,16 @@
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))

# -- Project information -----------------------------------------------------
distribution = pkg_resources.get_distribution('sensirion_uart_svm4x')
distribution = metadata.distribution("sensirion_uart_svm4x")

project = u'sensirion_uart_svm4x'
project = distribution.name
copyright = u'{} Sensirion AG, Switzerland'.format(datetime.now().year)
author = 'Sensirion AG'

# The short X.Y version
version = sensirion_uart_svm4x.__version__
version = distribution.version
# The full version, including alpha/beta/rc tags
release = sensirion_uart_svm4x.__version__
release = distribution.version

# -- General configuration ---------------------------------------------------

Expand All @@ -36,6 +39,7 @@
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.viewcode',
'sphinx_tabs.tabs',
'sphinx.ext.inheritance_diagram',
'sphinx.ext.githubpages',
'sphinx.ext.intersphinx',
Expand Down
45 changes: 45 additions & 0 deletions docs/dev-setup.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
To prepare your development environment, check out the repository,
create a Python virtual environment, and activate it.
Then install the driver in editable mode using `pip`.

Check out the Git repository to your local machine:

.. code-block:: console

git clone <url-of-driver-repository>
cd <checkout-folder>

Create a Python virtual environment:

.. code-block:: console

python -m venv .venv

Activate the virtual environment:

.. tabs::

.. group-tab:: Bash

.. code-block:: console

source .venv/bin/activate

.. group-tab:: PowerShell

.. code-block:: console

.venv\Scripts\Activate.ps1

.. group-tab:: Command Prompt

.. code-block:: console

.venv\Scripts\activate.bat

Install the driver in editable mode together with the development dependencies:

.. code-block:: console

python -m pip install -e .

4 changes: 4 additions & 0 deletions docs/development.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Development
===========

For development, you first need to prepare your setup.

.. include:: dev-setup.rst

.. toctree::

run-tests
Expand Down
37 changes: 37 additions & 0 deletions docs/driver-installation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
The driver installation consists of creating a Python virtual environment,
activating it, and installing the driver using `pip`.

Create a Python virtual environment:

.. code-block:: console

python -m venv .venv

Activate the virtual environment:

.. tabs::

.. group-tab:: Bash


.. code-block:: console

source .venv/bin/activate

.. group-tab:: PowerShell

.. code-block:: console

.venv\Scripts\Activate.ps1

.. group-tab:: Command Prompt

.. code-block:: console

.venv\Scripts\activate.bat

Install the driver:

.. code-block:: console

python -m pip install sensirion_uart_svm4x
16 changes: 9 additions & 7 deletions docs/execute-measurements.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
Execute measurements
====================
Install the SVM4X Driver
------------------------

The following steps show how to use this driver to execute a simple measurement on a Windows system.
.. include:: driver-installation.rst

1. Install the SVM4X sensor driver and all required packages as described in :ref:`Installation`.
2. Connect the SVM4X sensor to your system with the serial USB cable.
3. Run the example script from the root of the repository.
Run Usage-Example
-----------------

1. Connect the SVM4X sensor to your system with the serial USB cable.
2. Run the example script from the root of the repository.

By default the script assumes the sensor is connected to COM1 serial port. If this is different on your system,
pass the port in use with the :code:`--serial-port` parameter as outlined below.
Expand All @@ -15,7 +17,7 @@ The following steps show how to use this driver to execute a simple measurement
python examples/example_usage_uart_svm4x.py --serial-port <your COM port>

Example script
--------------
~~~~~~~~~~~~~~

.. literalinclude:: ../examples/example_usage_uart_svm4x.py
:language: python
9 changes: 3 additions & 6 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
Installation
============

The package can be installed with pip:
It is assumed that you have a working Python installation on your system.
If not, please install Python first including `pip <https://pip.pypa.io/en/stable/installation/>`_.

.. sourcecode:: bash

pip install sensirion_uart_svm4x

Recommended usage is within a virtualenv.
.. include:: driver-installation.rst
4 changes: 4 additions & 0 deletions docs/quickstart.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Quick Start
===========

Learn how to quickly get started with the SVM4X and perform your first measurements using
the provided usage examples.


.. toctree::

execute-measurements
Expand Down
7 changes: 4 additions & 3 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
click==8.0.4
jinja2==3.0.1
sphinx~=4.2.0
sphinx_rtd_theme~=1.0.0
jinja2~=3.1.0
sphinx~=7.1.0
sphinx-tabs~=3.5.0
sphinx_rtd_theme~=1.3.0
2 changes: 1 addition & 1 deletion examples/algorithm_tuning_example_uart_svm4x.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
parser.add_argument('--serial-port', '-p', default='COM1')
args = parser.parse_args()

with ShdlcSerialPort(port=args.serial_port, baudrate=115200) as port:
with ShdlcSerialPort(port=args.serial_port, baudrate=115200, additional_response_time=0.02) as port:
channel = ShdlcChannel(port)
sensor = Svm4xDevice(channel)
sensor.device_reset()
Expand Down
6 changes: 3 additions & 3 deletions examples/example_usage_uart_svm4x.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
parser.add_argument('--serial-port', '-p', default='COM1')
args = parser.parse_args()

with ShdlcSerialPort(port=args.serial_port, baudrate=115200) as port:
with ShdlcSerialPort(port=args.serial_port, baudrate=115200, additional_response_time=0.02) as port:
channel = ShdlcChannel(port)
sensor = Svm4xDevice(channel)
sensor.device_reset()
Expand All @@ -44,8 +44,8 @@
f"protocol_major: {protocol_major}; "
f"protocol_minor: {protocol_minor}; "
)
t_offset = sensor.get_temperature_offset_for_rht_measurements()
print(f"t_offset: {t_offset}; "
temperature_offset = sensor.get_temperature_offset_for_rht_measurements()
print(f"temperature_offset: {temperature_offset}; "
)
sensor.set_temperature_offset_for_rht_measurements(0)
sensor.start_measurement()
Expand Down
11 changes: 5 additions & 6 deletions metadata.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# driver generation metadata
generator_version: 0.33.0
model_version: 2.0.3
dg_status:
- released
generator_version: 1.7.0
model_version: 2.0.4
dg_status: released
is_manually_modified: true
first_generated: '2022-09-27 17:04'
last_generated: '2023-11-14 09:35'
first_generated: '2026-10-19 11:14'
last_generated: '2026-10-19 11:14'
Loading
Loading