Skip to content

Adding exit mode before reset #34

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

Closed
med1306 opened this issue Feb 9, 2023 · 2 comments
Closed

Adding exit mode before reset #34

med1306 opened this issue Feb 9, 2023 · 2 comments

Comments

@med1306
Copy link

med1306 commented Feb 9, 2023

If you leave python script while measuring the MLX90393 a power-on reset is needed to communicate again with the MLX90393.

For avoid that i just put before the reset command the exit command.

see page 23 in MLX90393-Datasheet-Melexis-953267.pdf
" It is recommended to perform an ‘EX’ command before issuing a ‘RT’ command"

here my implementation
def reset(self) -> None:
"""
Performs a software reset of the sensor.
"""
self.exitMode()

    if self._debug:
        print("Resetting sensor")
    time.sleep(2)
    self._transceive(bytes([_CMD_RT]))
    # burn a read post reset
    try:
        self.magnetic
    except OSError:
        pass
    return self._status_last

def exitMode(self) -> None:
    """
    Performs a Exit to cancel a measurement.
    """
    if self._debug:
        print("Exit mode")
    self._transceive(bytes([_CMD_EX]))
    return self._status_last

MLX90393-Datasheet-Melexis-953267.pdf

@jposada202020
Copy link
Contributor

@med1306 Hello :). You are right, I think it should be easier just to add the exit command before the RT, as the Reset is used to "warm-reset" the sensor is not used anywhere else.

I propose

        self._transceive(bytes([_CMD_EX]))
        self._transceive(bytes([_CMD_RT]))

@FoamyGuy
Copy link
Contributor

Resolved by #40

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

3 participants