From 39b38917d00a41b049947ae7cd240ee616d988fd Mon Sep 17 00:00:00 2001 From: Pascal Sachs Date: Mon, 6 Jan 2025 17:54:16 +0100 Subject: [PATCH] Fix update setpoint function A internally a wrong argument is provided to the update setpoint call, causing it to throw and exception instead of updating the setpoint. This commit fixes this issue and updates the version and changelog for a 1.0.1 bugfix release. --- CHANGELOG.md | 9 ++++++++- sensirion_i2c_sfx6xxx/device.py | 2 +- sensirion_i2c_sfx6xxx/result_types.py | 2 +- sensirion_i2c_sfx6xxx/version.py | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d244015..fa7fa24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,11 +5,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [1.0.1] - 2025-1-07 + +### Fixed + +- Fix update setpoint shows wrong argument + ## [1.0.0] - 2024-4-22 ### Added - Initial release -[Unreleased]: https://github.com/Sensirion/python-i2c-sfx6xxx/compare/1.0.0...HEAD +[Unreleased]: https://github.com/Sensirion/python-i2c-sfx6xxx/compare/1.0.1...HEAD +[1.0.1]: https://github.com/Sensirion/python-i2c-sfx6xxx/compare/1.0.0...1.0.1 [1.0.0]: https://github.com/Sensirion/python-i2c-sfx6xxx/releases/tag/1.0.0 \ No newline at end of file diff --git a/sensirion_i2c_sfx6xxx/device.py b/sensirion_i2c_sfx6xxx/device.py index cf4c578..e45008d 100644 --- a/sensirion_i2c_sfx6xxx/device.py +++ b/sensirion_i2c_sfx6xxx/device.py @@ -513,5 +513,5 @@ def update_setpoint(self, flow): - Only applicable for SFC6xxx mass flow controllers. """ raw_flow = SignalRawFlow(flow, self._flow_scale_factor, self._flow_offset) - self.sfx6xxx.update_setpoint(raw_flow) + self.sfx6xxx.update_setpoint(raw_flow.value) return self.sfx6xxx.reset_pointer_to_measurement_buffer() diff --git a/sensirion_i2c_sfx6xxx/result_types.py b/sensirion_i2c_sfx6xxx/result_types.py index 9e8fab0..06ab025 100644 --- a/sensirion_i2c_sfx6xxx/result_types.py +++ b/sensirion_i2c_sfx6xxx/result_types.py @@ -53,7 +53,7 @@ class SignalRawFlow(AbstractSignal): """This signal converts a user flow input from float into the twos-complement representation""" def __init__(self, flow, flow_scale_factor, flow_offset): - self._raw_flow = int(flow * flow_scale_factor) + flow_offset + self._raw_flow = int(flow * flow_scale_factor + flow_offset) @property def value(self): diff --git a/sensirion_i2c_sfx6xxx/version.py b/sensirion_i2c_sfx6xxx/version.py index e5ed854..f16d59e 100644 --- a/sensirion_i2c_sfx6xxx/version.py +++ b/sensirion_i2c_sfx6xxx/version.py @@ -2,4 +2,4 @@ # -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function -version = "1.0.0" +version = "1.0.1"