Skip to content

pyMC_core Updates v1.0.9#59

Merged
rightup merged 150 commits intomainfrom
dev
Apr 24, 2026
Merged

pyMC_core Updates v1.0.9#59
rightup merged 150 commits intomainfrom
dev

Conversation

@rightup
Copy link
Copy Markdown
Collaborator

@rightup rightup commented Apr 24, 2026

pyMC_core Updates

Improved SX1262 radio handling (IRQ, RX flow, timing, gain)
LBT (Listen Before Talk) + RX/interrupt fixes
CH341 USB-to-SPI/GPIO support + gpiod backend
KISS modem support with async + spec-compliant handling
Ed25519 identity + shared secret improvements
Companion protocol + frame server (core implementation)
Multi-hop routing, path handling & deduplication
CRC error tracking + enhanced diagnostics & logging
Improved packet building, hashing & flood routing
Better error handling, validation & stability

rightup and others added 30 commits January 15, 2026 21:02
…update related documentation

- Updated radio type choices in various example scripts to include 'kiss-modem'.
- Enhanced the create_radio function to support 'kiss-modem' with specific configuration and identity handling.
- Added conditional imports for KissSerialWrapper and KissModemWrapper in the hardware module.
- Updated documentation to reflect changes in radio type options and identity creation logic.
…packet metrics

- Updated the RX callback to accept both (data) and (data, rssi, snr) signatures for improved flexibility.
- Implemented a helper function to invoke the callback with the appropriate number of arguments.
- Modified the dispatcher to handle per-packet RSSI and SNR values, ensuring accurate metrics without race conditions.
- Added a test to verify that the RX callback correctly receives per-packet RSSI and SNR values.
…allbacks

- Introduced a method to set an asyncio event loop for safe callback invocation from background threads.
- Updated the RX callback dispatcher to utilize the event loop when set, ensuring proper async integration.
- Modified the constructor and documentation to reflect changes in callback handling and configuration options.
- Added tests to verify event loop functionality and compatibility with radio configuration keys.
This commit introduces a new driver for the CH341 USB-to-SPI/GPIO interface, utilizing ctypes to directly call libusb for asynchronous operations. The implementation includes support for SPI transfers, GPIO control, and proper handling of USB transfers with error management. Key features include:

- Singleton pattern for driver instance management.
- Asynchronous transfer handling with callbacks.
- GPIO pin manipulation methods for setting direction and state.
- SPI transfer methods with support for both output and input operations.
- Comprehensive error handling and logging throughout the driver.

This driver aims to provide a reliable interface for interacting with CH341 devices in Python.
…rmance; remove unused code and streamline CAD logic
…e; remove unnecessary debug code and enhance edge detection handling
…ulation

- Changed method signature of calc_shared_secret to accept a 32-byte Ed25519 public key instead of X25519.
- Updated documentation to clarify the internal conversion from Ed25519 to X25519 by the modem.
- Added validation to ensure the provided public key is the correct length.
- Enhanced comments for better understanding of the key exchange process.
…ions

- Adjusted command constants for KISS Modem to reflect the correct values as per firmware documentation.
- Renumbered CMD and RESP constants to ensure consistency and avoid conflicts with firmware commands.
- Enhanced comments for clarity regarding the changes made to the command structure.
- Implemented LBT mechanism to check channel availability before transmission, aligning with MeshCore firmware specifications.
- Introduced LBT retry delays and maximum wait time to manage channel busy states.
- Updated send method to return detailed transmission metadata, including LBT metrics.
- Refactored timestamp retrieval in Dispatcher to use asyncio.get_running_loop for better compatibility.
- Added a cleanup method to release modem resources by disconnecting the serial and stopping threads.
- Added a check_radio_health method to verify modem connectivity and respond to pings, enhancing reliability.
- Added a get_status method to retrieve comprehensive radio status, including configuration and statistics.
- Updated command and response constants to align with the new SetHardware protocol.
- Introduced new sub-commands and responses for hardware interactions.
- Enhanced error handling and validation for frame sizes.
- Improved test cases to cover new command structures and ensure correct frame decoding.
agessaman and others added 28 commits March 17, 2026 21:15
- Enhanced the _cmd_set_flood_scope method to correctly process the flood scope data by adjusting the expected data length and updating the slicing logic to align with firmware requirements.
- Added detailed docstring to clarify the wire format for flood scope data.
- Introduced integration tests to verify the correct behavior of channel messages with flood scope, ensuring compatibility with firmware expectations.
Refine path length handling and validation in ACK processing and packets
…d async wrapper

- Changed push_trace_data from async to sync for immediate enqueueing, aligning with usage patterns.
- Introduced push_trace_data_async as an optional async wrapper for compatibility with existing async call sites.
- Updated documentation and tests to reflect changes in trace data handling and ensure correct functionality.
fix(companion): refactor push_trace_data to synchronous method and add async wrapper
- Updated the _cmd_add_update_contact method to maintain command/response parity by returning only a single OK response frame, preventing desynchronization issues with companion clients.
- Removed unnecessary frame writing logic for contact updates to streamline the response process.
- Added a new test to verify that the correct response frame is emitted when adding or updating a contact.
Replay the cached raw ADVERT blob for the selected contact instead of generating a new advert signed by the companion identity. This preserves the contact pubkey on zero-hop share, matches MeshCore firmware behavior, and avoids malformed share semantics when no cached advert exists.

Add contact blob persistence/capture paths, update share logic to enforce direct zero-hop normalization, and include tests/docs for blob-required sharing and pubkey preservation.
Fix CMD_ADD_UPDATE_CONTACT and CMD_SHARE_CONTACT behaviors
…duplication and raw hash blacklisting

- Updated the Dispatcher class to use a raw-frame hash for blacklisting known malformed packets before parsing, enhancing error handling.
- Changed deduplication logic to utilize a payload-based hash, ensuring compatibility with firmware and improving packet processing accuracy.
- Added tests to verify that packets with the same payload but different paths are deduplicated correctly, while different payloads are processed independently.
- Ensured malformed packets are blacklisted by their raw hash to prevent repeated parsing attempts.
refactor(dispatcher): improve packet processing with payload-based deduplication and raw hash blacklisting
- Updated the client_idle_timeout_sec parameter from 120 seconds to 8 hours (28800 seconds) to accommodate longer idle periods without disconnecting clients.
- This change aims to improve user experience by allowing more flexibility in client connections.
fix(companion): extend client idle timeout for CompanionFrameServer
Guard frame-server cleanup by connection ownership so an evicted client handler cannot cancel or clear the newly connected client’s writer queue/task. Add regression and disconnect-path tests to verify eviction churn, idle timeout, and connection reset remain stable.
- Added a confirmation response before sending a channel message to ensure the client is aware of the operation's status.
- Implemented a warning log for failed message sends after an OK response
fix(companion): improve error handling for channel message sending
…dvert flags

- Updated the CompanionBase class to reset contact flags to 0 for new contacts, preventing wire protocol advert flags from being stored as local contact flags.
- Added a regression test to verify that auto-added chat contacts do not appear as favourites due to inherited flags.
fix(companion): ensure auto-added chat contacts do not inherit wire advert flags
- Introduced TXT_TYPE_CLI_DATA to modify how delivery ACK is processed for CLI_DATA messages, ensuring that ACK tracking is bypassed for MeshCore repeaters.
- Adjusted the flags byte in the packet creation to accommodate the text type, affecting both message sending and CRC calculation.
- Added a test to verify the correct behavior of the flags byte for CLI_DATA messages.
fix(gpio): support Rockchip global GPIO numbering
@rightup rightup changed the title pyMC_core Updates v1.0.8 pyMC_core Updates v1.0.9 Apr 24, 2026
@rightup rightup merged commit 1acfc4e into main Apr 24, 2026
3 checks passed
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

Successfully merging this pull request may close these issues.

5 participants