Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transfer of values UpdateSetpoint #4

Open
lschib01 opened this issue Dec 6, 2024 · 2 comments
Open

Transfer of values UpdateSetpoint #4

lschib01 opened this issue Dec 6, 2024 · 2 comments

Comments

@lschib01
Copy link

lschib01 commented Dec 6, 2024

I work with a SFC6000D via I2C with a RPi 5 and Python 3.11. I think there is a problem with the transfer of values in the UpdateSetpoint function.

The processing of the input values of update_setpoint fails with t.pack() in transfer.py. A pointer address is passed here instead of the value. I'm not sure if this is the case for all functions in which a value is passed to the controller. However, I have not checked this. All functions without value transfer work perfectly.

I have implemented the following solution, but it is not ideal as it does not solve the actual problem but deals with the symptoms. The pack() function is defined in rx_tx_data.py. Here I enter the further processing of the value (update_setpoint), which is passed as arg in argument_list[]. If the CMD_ID = 0xf054 (UpdateSetpoint), arg = arg.value is set. This ensures that the value and not the address is passed.

If I output the argument_list[] without the customisation, the output looks like this:
<sensirion_i2c_sfx6xxx.result_types.SignalRawFlow object at 0x7ffebff2d150>

After the adjustment, the value is output instead of the address. (e.g. as rawFlow = -18381)

def pack(self, argument_list=[]):
data_to_pack = [self._cmd_id]
for arg in argument_list:
if self._cmd_id == 0xf054:
arg = arg.value
if isinstance(arg, str):
data_to_pack.append(self._string_to_bytes(arg))
elif isinstance(arg, (list, tuple)):
data_to_pack.extend(arg)
else:
data_to_pack.append(arg)

@psachs
Copy link
Member

psachs commented Dec 11, 2024

I think the problem, is that it is not clear how to work with the returned signals from the driver.

As you already figured out, you get the a SignalRawFlow when you do a measurement. If you want to use this signal as a setpoint you have to provide the .value and not the whole signal.
Here is some pseudo code on what I refer to.

sfc6000 = Sfx6xxxDevice(channel)
flow = sfc6000.read_flow()
sfc6000.update_setpoint(flow.value)

I am also not sure if I understand your problem correctly. I don't think you want to set the set_point to the measured flow since the set point controls the flow, resp. the measured flow should follow the configured setpoint.

@psachs
Copy link
Member

psachs commented Jan 6, 2025

Hi I just had some more time looking into the issue and opened a pull request that should hopefully fix the issue with update setpoint and another issue with reading the product identifier.

I hope I can release a bugfix version tomorrow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants