Skip to content

Conversation

@puddly
Copy link
Contributor

@puddly puddly commented Jul 24, 2025

See NabuCasa/silabs-firmware-builder#121. The current default will remain 8, we can bump it higher for newer adapters.

@codecov
Copy link

codecov bot commented Jul 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.51%. Comparing base (07d7cf0) to head (01de0ee).
⚠️ Report is 1 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev     #681   +/-   ##
=======================================
  Coverage   99.51%   99.51%           
=======================================
  Files          58       58           
  Lines        3924     3951   +27     
=======================================
+ Hits         3905     3932   +27     
  Misses         19       19           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@puddly puddly requested a review from Copilot July 25, 2025 16:48
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements functionality to dynamically set adapter concurrency based on chip information retrieved via an XNCP command. The implementation detects newer adapters with more RAM (like MG24) and increases their concurrency from the default 8 to 32 for better performance, while maintaining backward compatibility.

Key changes:

  • Added XNCP command support for retrieving chip information (RAM size and part number)
  • Implemented logic to determine optimal concurrency based on available RAM
  • Enhanced network metadata to include chip information when available

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
bellows/ezsp/xncp.py Added new XNCP command definitions for chip info retrieval
bellows/ezsp/init.py Implemented chip info query and concurrency determination logic
bellows/zigbee/application.py Integrated dynamic concurrency setting and chip info metadata
tests/test_ezsp.py Added comprehensive tests for chip info functionality
tests/test_application.py Added tests for concurrency setting and metadata inclusion

chip_info = await self.xncp_get_chip_info()

# Usually 98304 bytes for MG21
if chip_info.ram_size < 100000:
Copy link

Copilot AI Jul 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The magic number 100000 should be defined as a named constant to improve maintainability and make the threshold explicit.

Suggested change
if chip_info.ram_size < 100000:
if chip_info.ram_size < RAM_SIZE_THRESHOLD:

Copilot uses AI. Check for mistakes.
return 8

# Usually 262144 bytes for MG24
return 32
Copy link

Copilot AI Jul 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The return value 32 should be defined as a named constant (e.g., HIGH_RAM_CONCURRENCY) to make the concurrency levels explicit and configurable.

Suggested change
return 32
return HIGH_RAM_CONCURRENCY

Copilot uses AI. Check for mistakes.
Comment on lines +789 to +795
return 8

chip_info = await self.xncp_get_chip_info()

# Usually 98304 bytes for MG21
if chip_info.ram_size < 100000:
return 8
Copy link

Copilot AI Jul 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The return value 8 should be defined as a named constant (e.g., DEFAULT_CONCURRENCY) to match the pattern used elsewhere and improve maintainability.

Suggested change
return 8
chip_info = await self.xncp_get_chip_info()
# Usually 98304 bytes for MG21
if chip_info.ram_size < 100000:
return 8
return DEFAULT_CONCURRENCY
chip_info = await self.xncp_get_chip_info()
# Usually 98304 bytes for MG21
if chip_info.ram_size < 100000:
return DEFAULT_CONCURRENCY

Copilot uses AI. Check for mistakes.
@puddly puddly merged commit 2ec05d0 into zigpy:dev Sep 11, 2025
14 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.

1 participant