Add proper guarding via the FACTORY_TEST_ENABLE def to allow proper user space enhancements#441
Conversation
…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.
|
Thank you for your contribution! |
|
Is there some reason this isn't being merged? |
|
Thank you for your contribution! |
Description
Guard
factory_reset_indicatinganddip_switch_update_userwith FACTORY_TEST_ENABLE conditional compilation flag.In its current state,
factory_test.cunconditionally definesdip_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_ENABLEallows 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 whenFACTORY_TEST_ENABLEis undefined by a user, sincefactory_test.hincludes are already conditionally guarded.For default builds, these are no-op changes as
FACTORY_TEST_ENABLEis 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
Issues Fixed or Closed by This PR
n/a
Checklist