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

Fix some minor issues #2

Merged
merged 3 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading