-
Notifications
You must be signed in to change notification settings - Fork 104
Set adapter concurrency using chip info XNCP command #681
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
Changes from all commits
0afbbd6
781efd6
5ec973b
53621cf
5e6d71e
01de0ee
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -778,3 +778,21 @@ async def xncp_get_flow_control_type(self) -> FlowControlType: | |||||||||||||||||||||||||||||
| """Get flow control type.""" | ||||||||||||||||||||||||||||||
| rsp = await self.send_xncp_frame(xncp.GetFlowControlTypeReq()) | ||||||||||||||||||||||||||||||
| return rsp.flow_control_type | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| async def xncp_get_chip_info(self) -> xncp.GetChipInfoRsp: | ||||||||||||||||||||||||||||||
| """Get the part number.""" | ||||||||||||||||||||||||||||||
| return await self.send_xncp_frame(xncp.GetChipInfoReq()) | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| async def get_default_adapter_concurrency(self) -> int: | ||||||||||||||||||||||||||||||
| """Get the recommended concurrency based on chip information.""" | ||||||||||||||||||||||||||||||
| if FirmwareFeatures.CHIP_INFO not in self._xncp_features: | ||||||||||||||||||||||||||||||
| return 8 | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| chip_info = await self.xncp_get_chip_info() | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| # Usually 98304 bytes for MG21 | ||||||||||||||||||||||||||||||
| if chip_info.ram_size < 100000: | ||||||||||||||||||||||||||||||
| return 8 | ||||||||||||||||||||||||||||||
|
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 | |
| 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
AI
Jul 25, 2025
There was a problem hiding this comment.
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.
| return 32 | |
| return HIGH_RAM_CONCURRENCY |
There was a problem hiding this comment.
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.