Skip to content

Add proper guarding via the FACTORY_TEST_ENABLE def to allow proper user space enhancements#441

Open
MarqueIV wants to merge 1 commit intoKeychron:wireless_playgroundfrom
MarqueIV:wireless_playground_test_fix
Open

Add proper guarding via the FACTORY_TEST_ENABLE def to allow proper user space enhancements#441
MarqueIV wants to merge 1 commit intoKeychron:wireless_playgroundfrom
MarqueIV:wireless_playground_test_fix

Conversation

@MarqueIV
Copy link
Copy Markdown

Description

Guard factory_reset_indicating and dip_switch_update_user with FACTORY_TEST_ENABLE conditional compilation flag.

In its current state, factory_test.c unconditionally defines dip_switch_update_user, preventing userspace configurations from overriding the Mac/Win DIP switch layer mapping. This goes against QMK coding practices as users are blocked from adding their own functionality.

Wrapping the existing code with #ifdef FACTORY_TEST_ENABLE allows users to #undef the define in their own keymap config.h and thus, they can provide their own implementation for this function, better following proper QMK code etiquette/style.

These changes also guard all factory_reset_indicating() calls across every board file (34 boards) which would fail to compile when FACTORY_TEST_ENABLE is undefined by a user, since factory_test.h includes are already conditionally guarded.

For default builds, these are no-op changes as FACTORY_TEST_ENABLE is currently always defined. This only affects user builds where users explicitly undef FACTORY_TEST_ENABLE to be able to properly define their own dip_switch_update_user call.

Testing: No new tests are needed as the existing tests cover this code. Again, this should effectively be a no-op. This only affects custom user configurations where this value is explicitly undefined.

Types of Changes

  • Core
  • Bugfix
  • New feature
  • Enhancement/optimization
  • Keyboard (addition or update)
  • Keymap/layout (addition or update)
  • Documentation

Issues Fixed or Closed by This PR

n/a

Checklist

  • My code follows the code style of this project: C, Python
  • I have read the PR Checklist document and have made the appropriate changes.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • I have tested the changes and verified that they work and don't break anything (as well as I can manage).

…CTORY_TEST_ENABLE conditional compilation flag.

In its current state, `factory_test.c` unconditionally defines `dip_switch_update_user`, preventing userspace configurations from overriding the Mac/Win DIP switch layer mapping. Wrapping it with `#ifdef FACTORY_TEST_ENABLE` allows users to #undef the define in their keymap config.h and provide their own implementation, better following proper QMK code etiquette/style.

Also guards all `factory_reset_indicating()` calls across every board file (34 boards) which would fail to compile when `FACTORY_TEST_ENABLE` is undefined, since `factory_test.h` includes are already conditionally guarded.

For default builds, these are no-op changes as `FACTORY_TEST_ENABLE` is always defined.  This only affects builds where users explicitly undef that value for the aforementioned reasons.
@github-actions
Copy link
Copy Markdown

Thank you for your contribution!
This pull request has been automatically marked as stale because it has not had activity in the last 45 days. It will be closed in 30 days if no further activity occurs. Please feel free to give a status update now, or re-open when it's ready.
For maintainers: Please label with bug, awaiting review, breaking_change, in progress, or on hold to prevent the issue from being re-flagged.

@github-actions github-actions Bot added the stale label Apr 29, 2026
@MarqueIV
Copy link
Copy Markdown
Author

Is there some reason this isn't being merged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant