Skip to content

[Bug] Add proper guarding via the FACTORY_TEST_ENABLE def to allow proper user space enhancements #461

@MarqueIV

Description

@MarqueIV

Describe the Bug

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

Note: I've already opened a PR with a fix for this issue, but it's just sitting there and has now been flagged with the 'stale' label. Please consider reviewing this.

PR: #441

Issue description:

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.

Keyboard Used

All Keychron QMK-based boards

Link to product page (if applicable)

n/a

Operating System

QMK

qmk doctor Output

n/a

Is AutoHotKey / Karabiner installed

  • AutoHotKey (Windows)
  • Karabiner (macOS)

Other keyboard-related software installed

n/a

Additional Context

Again, I've already opened a PR with this fix, but it's since gotten stale. Please consider reviewing it. Again, this is a no-op for your existing code, but allows people like me to heavily customize your firmware with your hardware. Thanks!

#441

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions