Merged
Conversation
…xecution on rising edges
…ggers and ensure callback execution on rising edges
…alized access through GPIOPinManager
…streamline terminal interrupt processing
…hod for improved consistency and reliability
…rupt handler and improving logging for CAD operations
…t trampoline for GPIO interrupts and capturing the event loop for thread-safe operations.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes interrupt handling in the SX1262 LoRa radio driver by implementing thread-safe interrupt processing and refining RX interrupt logic. The changes migrate from gpiozero to python-periphery GPIO library, introduce a trampoline pattern for bridging GPIO interrupts to the asyncio event loop, and improve distinction between terminal and progress RX interrupts to prevent spurious wake-ups.
Key changes:
- Implemented thread-safe interrupt trampoline pattern that schedules handlers on the event loop via
call_soon_threadsafe - Refactored RX interrupt handling to distinguish terminal interrupts (RX_DONE, CRC_ERR, TIMEOUT, HEADER_ERR) from progress interrupts (PREAMBLE, SYNC, HEADER_VALID)
- Migrated from gpiozero to python-periphery GPIO API with centralized GPIO manager shared between driver layers
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| src/pymc_core/node/dispatcher.py | Removed debug logging statements from packet reception path |
| src/pymc_core/hardware/sx1262_wrapper.py | Added interrupt trampoline for thread-safety, refactored RX interrupt handling to distinguish terminal vs progress interrupts, improved CAD result storage, fixed TX timeout calculation, changed setRx to request method calls, and corrected IRQ clearing order |
| src/pymc_core/hardware/lora/LoRaRF/SX126x.py | Migrated from gpiozero to python-periphery API (off/on → write(False/True), value → read()), integrated centralized GPIO manager via set_gpio_manager(), removed local GPIO pin tracking |
| src/pymc_core/hardware/gpio_manager.py | Added EdgeEvent import, updated edge detection to consume events from kernel queue via read_event(), added Any type import (unused) |
Comments suppressed due to low confidence (1)
src/pymc_core/hardware/gpio_manager.py:12
- Import of 'Any' is not used.
from typing import Any, Callable, Dict, Optional
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes interrupt handling in the SX1262 LoRa radio driver by implementing thread-safe interrupt processing and refining RX interrupt logic. The changes migrate from gpiozero to python-periphery GPIO library, introduce a trampoline pattern for bridging GPIO interrupts to the asyncio event loop, and improve distinction between terminal and progress RX interrupts to prevent spurious wake-ups.
Key changes: