feat: moonlight — light-control module for upcycled keyboards - #8
Open
ezuk wants to merge 17 commits into
Open
Conversation
…e light on Module config.h is included before keymap config.h in QMK's config chain, so a keymap-level #define MOONLIGHT_LAMP_ONLY 0 collided with the module's own #ifndef default under -Werror. Move the tunable #ifndef blocks (MOONLIGHT_LAMP_ONLY, MOONLIGHT_MIN_BOOT_BRIGHTNESS, MOONLIGHT_MIN_BRIGHTNESS) from config.h into moonlight.c, alongside the other already-there tunables, so a keymap's config.h define wins as intended. config.h now only carries NO_USB_STARTUP_CHECK. Also make presets turn the light on (rgb_matrix_enable() before rgb_matrix_mode()), matching MOONLIGHT_ANIM_START's symmetry: press a color, get that color, even if the light was off.
- README: note that hand-rolled keymap.json files must keep "modules": ["zsa/defaults", "zsa/moonlight"] (zsa/defaults is required by ZSA board code, not optional). - README: fix the indices 54-71 prose describing moonlander_lamp.json's layers formatting — the lines actually group 5/1/1/5/3/3 entries, not one KC_NO per line. bring both up to date with the config.h -> moonlight.c move: tunables now default in moonlight.c, and presets also turn the light on. - CI: add timeout-minutes: 30 and strategy.fail-fast: false to the build_moonlight workflow so a hung job can't block the run indefinitely and one matrix leg failing doesn't cancel the other. - Spec doc: correct the "keymap config is included after module config" claim (it's the reverse) and describe the actual mechanism — tunables default in moonlight.c under #ifndef — plus the preset-enables-light behavior.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Turns a broken ZSA keyboard into a USB-powered room light. The board lights up on any power source — wall charger, power bank, or computer — with no enumeration needed, and by default never sends a keystroke to a host, so a shorting matrix can't type garbage.
How: the module's
config.hdefinesNO_USB_STARTUP_CHECK, compiling out the ChibiOS suspend trap that otherwise parks un-enumerated boards insuspend_power_down()forever. Everything else is hooks: 19 keycodes (MNL_ON/OFF, brightness, hue, animation start/stop/next/faster/slower, 8 preset color slots) driving the standard rgb_matrix API, akeyboard_post_initthat guarantees the lamp always comes on at power-up (with a brightness floor and a snap away from stale/reactive EEPROM modes), runtime exclusion of all keypress-reactive animations, and apre_process_recordthat swallows every non-moonlight keycode exceptQK_BOOT.Ships with ready-to-compile example keymaps for Voyager and Moonlander (rev B) and CI that builds both against
firmware25.Test plan
-DMOONLIGHT_LAMP_ONLY=0compile)