Skip to content

Commit

Permalink
Merge pull request #2 from Lauszus/fix/python3.8
Browse files Browse the repository at this point in the history
Fix some minor issues
  • Loading branch information
Lauszus authored Jan 29, 2024
2 parents 5028111 + b2c9dc9 commit ea92c37
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-3.8-${{ hashFiles('requirements.txt') }}
key: ${{ runner.os }}-3.8-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('requirements.txt') }}
- name: Update pip
run: pip install .[extra]
- name: Check formatting with Black
Expand Down
11 changes: 6 additions & 5 deletions pybldc/pybldc.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ def reset(self) -> None:

def _wait_for_packet_response(
self,
packet_queue: queue.Queue[List[int]],
packet_queue: queue.Queue,
comm_packet_id: CommPacketId,
expected_response: List[int],
timeout: float,
Expand All @@ -329,7 +329,7 @@ def _wait_for_packet_response(
return False

try:
response = packet_queue.get(timeout=timeout - dt)
response: List[int] = packet_queue.get(timeout=timeout - dt)
self._logger.debug(f"PyBldcBase: Received packet response: {response}, expected: {expected_response}")

# Make sure it replies with the command as the first byte and "OK" as the second byte
Expand All @@ -350,7 +350,7 @@ def __init__(self, can_id: int, controller_id: int, logger: logging.Logger) -> N
self._controller_id = controller_id
self._logger = logger
self._is_stopped = False
self.packet_queue: queue.Queue[List[int]] = queue.Queue()
self.packet_queue: queue.Queue = queue.Queue()
self.pong_event = threading.Event()
self._hw_type: Optional[HwType] = None

Expand Down Expand Up @@ -524,7 +524,7 @@ def __init__(
# Open the serial port, but read from it in a thread, so we are not blocking the main loop
self._serial = serial.Serial(port=port, baudrate=baudrate, timeout=0.5, exclusive=True)
self._shutdown_thread = threading.Event()
self._packet_queue: queue.Queue[List[int]] = queue.Queue()
self._packet_queue: queue.Queue = queue.Queue()
self._thread = threading.Thread(
target=self._serial_read_thread,
name="_serial_read_thread",
Expand Down Expand Up @@ -596,7 +596,7 @@ def _serial_read_thread(
ser: Any,
shutdown_event: threading.Event,
logger: logging.Logger,
packet_queue: queue.Queue[List[int]],
packet_queue: queue.Queue,
) -> None:
try:
data_buffer = bytearray()
Expand Down Expand Up @@ -745,6 +745,7 @@ def cli() -> None:
"-b",
"--baudrate",
"--bitrate",
type=int,
help="The baudrate/bitrate to use for serial/can (defaults to 115200 for serial and 500000 for CAN)",
)
optional.add_argument(
Expand Down

0 comments on commit ea92c37

Please sign in to comment.