qmk_firmware/quantum
Liyang HU 383fae55c5
Refactor `quantum/command.{c,h}` for code size & {read,maintain}ability (#11842)
* quantum/command.c: coalesce `print()`s in `command_common_help()` & `print_version()`

Also undo some damage by clang-format in b624f32f94

* quantum/command.c: replace `print(…); print_{,val_}{dec,hex}*(…);` sequences with single `xprintf(…)`

`print_{dec,hex}*(…)` are just `#define`s for `xprintf(…)` anyway.

Each additional `xprintf(…)` costs ~8 bytes: the call instructions,
plus an additional NUL terminator.

This _really_ adds up: this commit saves 814 bytes on my ATmega32.

* quantum/command.c: optimise `mousekey_console()` for size & legibility

Made various tweaks to the interface, but still functionally identical.

Assume `KC_1`…`KC_0` to be contiguous, and removed `numkey2num(…)` entirely.
It was exported in `command.h` by 1a0bac8bcc for no obvious reason, before
which it was `static`. I doubt anyone uses it.

`mousekey_console()` is now enabled regardless of `MK_3_SPEED`.
Needs fleshing out for things other than the X11 variant though.

This commit saves 638 bytes on my ATmega32.
2021-08-07 17:12:57 +10:00
..
api
audio
backlight
bootmagic
debounce
keymap_extras
led_matrix
logging
process_keycode
rgb_matrix
rgblight
sequencer
serial_link
split_common
template
tools
visualizer
api.c
api.h
bitwise.c
bitwise.h
color.c
color.h
command.c Refactor `quantum/command.{c,h}` for code size & {read,maintain}ability (#11842) 2021-08-07 17:12:57 +10:00
command.h Refactor `quantum/command.{c,h}` for code size & {read,maintain}ability (#11842) 2021-08-07 17:12:57 +10:00
config_common.h
crc.c
crc.h
debounce.h
dip_switch.c
dip_switch.h
dynamic_keymap.c
dynamic_keymap.h
dynamic_macro.h
encoder.c
encoder.h
haptic.c
haptic.h
joystick.c
joystick.h
keycode_config.c
keycode_config.h
keymap.h
keymap_common.c
led.c
led.h
led_tables.c
led_tables.h
matrix.c
matrix.h
matrix_common.c
mcu_selection.mk
mousekey.c
mousekey.h
pointing_device.c
pointing_device.h
quantum.c
quantum.h
quantum_keycodes.h
ring_buffer.h
send_string.c
send_string.h
send_string_keycodes.h
util.h
variable_trace.c
variable_trace.h
velocikey.c
velocikey.h
via.c
via.h
via_ensure_keycode.h
wpm.c
wpm.h