fossasia / pslab-python

Python Library for PSLab Desktop: https://pslab.io
GNU General Public License v3.0
1.63k stars 225 forks source link

Add get_firmware_version #233

Closed bessman closed 3 months ago

bessman commented 3 months ago

Summary by Sourcery

Add functionality to retrieve the firmware version in the serial handler by introducing a new method get_firmware_version and a corresponding command GET_FW_VERSION in the protocol.

New Features:

Enhancements:

sourcery-ai[bot] commented 3 months ago

Reviewer's Guide by Sourcery

This pull request adds functionality to retrieve the firmware version of the PSLab device. It introduces a new method get_firmware_version() in the Handler class and updates the initialization process to store the firmware version. The changes also include adding a new command code for getting the firmware version in the protocol file.

File-Level Changes

Files Changes
pslab/serial_handler.py Added a new method get_firmware_version() to retrieve the firmware version as a tuple of integers (major, minor, patch)
pslab/serial_handler.py Updated the __init__ method to store the firmware version upon initialization
pslab/serial_handler.py Added error handling for devices with firmware versions older than 3.0.0
pslab/protocol.py Added a new command code GET_FW_VERSION in the protocol file
pslab/serial_handler.py Added from __future__ import annotations for forward reference support

Tips - Trigger a new Sourcery review by commenting `@sourcery-ai review` on the pull request. - Continue your discussion with Sourcery by replying directly to review comments. - You can change your review settings at any time by accessing your [dashboard](https://app.sourcery.ai): - Enable or disable the Sourcery-generated pull request summary or reviewer's guide; - Change the review language; - You can always [contact us](mailto:support@sourcery.ai) if you have any questions or feedback.