Skip to content

Bluetooth: Controller: Use PHY_FLAGS_S2/S8 defines instead of magic numbers#17

Draft
cvinayak with Copilot wants to merge 2 commits into
mainfrom
copilot/use-defined-phy-flags
Draft

Bluetooth: Controller: Use PHY_FLAGS_S2/S8 defines instead of magic numbers#17
cvinayak with Copilot wants to merge 2 commits into
mainfrom
copilot/use-defined-phy-flags

Conversation

Copilot AI commented Jan 30, 2026

Copy link
Copy Markdown

Replace hardcoded 0 and 1 values with PHY_FLAGS_S2 and PHY_FLAGS_S8 defines when specifying Coded PHY coding schemes. The defines are already present in pdu.h:

#define PHY_FLAGS_S2 0      // S2 coding scheme
#define PHY_FLAGS_S8 BIT(0) // S8 coding scheme

Changes

  • radio.c: Updated delay calculations in sw_switch() to use defines instead of literals
  • lll_scan_aux.c: Updated radio_switch_complete_and_tx() calls to use defines for RX/TX flag parameters

Example

Before:

hal_radio_rx_chain_delay_ns_get(phy_curr, 1));  // S8 coding
hal_radio_rx_chain_delay_ns_get(phy_curr, 0));  // S2 coding

After:

hal_radio_rx_chain_delay_ns_get(phy_curr, PHY_FLAGS_S8));
hal_radio_rx_chain_delay_ns_get(phy_curr, PHY_FLAGS_S2));
Original prompt

This section details on the original issue you should resolve

<issue_title>Bluetooth: Controller: Use defined for phy flags for S2 and S8 Coded PHY options</issue_title>
<issue_description>Is your enhancement proposal related to a problem? Please describe.
_ A clear and concise description of what the problem is._

Use defines in

  • radio_phy_set
  • radio_switch_complete_and_tx
  • and so on

Refer to:
https://github.com/zephyrproject-rtos/zephyr/pull/37283/files#r680822843

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or graphics (drag-and-drop an image) about the feature request here.
</issue_description>

<agent_instructions>Create a pull request to fix the issue, please refer to how some of the refactoring is done in this PR zephyrproject-rtos#103158... take the commits from that PR as well as initial starting commits</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Replace hardcoded values 0 and 1 with PHY_FLAGS_S2 and PHY_FLAGS_S8
defines respectively in radio.c and lll_scan_aux.c to improve code
readability and maintainability.

Co-authored-by: cvinayak <6350656+cvinayak@users.noreply.github.com>
Copilot AI changed the title [WIP] Use defined for phy flags in S2 and S8 Coded PHY options Bluetooth: Controller: Use PHY_FLAGS_S2/S8 defines instead of magic numbers Jan 30, 2026
Copilot AI requested a review from cvinayak January 30, 2026 09:25
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.

Bluetooth: Controller: Use defined for phy flags for S2 and S8 Coded PHY options

2 participants