diff options
author | Joel Challis <git@zvecr.com> | 2021-01-20 18:46:01 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-20 18:46:01 +0000 |
commit | 4e8166750b21cfd3feaba0d6024087fb5c76bca9 (patch) | |
tree | c124714e565321818485b96509fd70026fe49f84 /docs/newbs_testing_debugging.md | |
parent | 1328ab7c7defdca40872273147f387618b1a48c3 (diff) | |
download | qmk_firmware-4e8166750b21cfd3feaba0d6024087fb5c76bca9.tar.gz qmk_firmware-4e8166750b21cfd3feaba0d6024087fb5c76bca9.zip |
Small tweaks to docs to make them more user friendly (#11518)
* first pass
* firmware firmware?
* Split out debug + testing docs
* tidy up duplicate css
* Add extra info to debug example
Co-authored-by: Drashna Jaelre <drashna@live.com>
Co-authored-by: Drashna Jaelre <drashna@live.com>
Diffstat (limited to 'docs/newbs_testing_debugging.md')
-rw-r--r-- | docs/newbs_testing_debugging.md | 91 |
1 files changed, 2 insertions, 89 deletions
diff --git a/docs/newbs_testing_debugging.md b/docs/newbs_testing_debugging.md index 834fed7163..c3550489e5 100644 --- a/docs/newbs_testing_debugging.md +++ b/docs/newbs_testing_debugging.md @@ -1,96 +1,9 @@ # Testing and Debugging -Once you've flashed your keyboard with a custom firmware you're ready to test it out. With a little bit of luck everything will work perfectly, but if not this document will help you figure out what's wrong. - ## Testing -Testing your keyboard is usually pretty straightforward. Press every single key and make sure it sends the keys you expect. You can use [QMK Configurator](https://config.qmk.fm/#/test/)'s test mode to check your keyboard, even if it doesn't run QMK. +[Moved here](faq_misc.md#testing) ## Debugging :id=debugging -Your keyboard will output debug information if you have `CONSOLE_ENABLE = yes` in your `rules.mk`. By default the output is very limited, but you can turn on debug mode to increase the amount of debug output. Use the `DEBUG` keycode in your keymap, use the [Command](feature_command.md) feature to enable debug mode, or add the following code to your keymap. - -```c -void keyboard_post_init_user(void) { - // Customise these values to desired behaviour - debug_enable=true; - debug_matrix=true; - //debug_keyboard=true; - //debug_mouse=true; -} -``` - -## Debugging Tools - -There are two different tools you can use to debug your keyboard. - -### Debugging With QMK Toolbox - -For compatible platforms, [QMK Toolbox](https://github.com/qmk/qmk_toolbox) can be used to display debug messages from your keyboard. - -### Debugging With hid_listen - -Prefer a terminal based solution? [hid_listen](https://www.pjrc.com/teensy/hid_listen.html), provided by PJRC, can also be used to display debug messages. Prebuilt binaries for Windows,Linux,and MacOS are available. - -## Sending Your Own Debug Messages - -Sometimes it's useful to print debug messages from within your [custom code](custom_quantum_functions.md). Doing so is pretty simple. Start by including `print.h` at the top of your file: - -```c -#include "print.h" -``` - -After that you can use a few different print functions: - -* `print("string")`: Print a simple string. -* `uprintf("%s string", var)`: Print a formatted string -* `dprint("string")` Print a simple string, but only when debug mode is enabled -* `dprintf("%s string", var)`: Print a formatted string, but only when debug mode is enabled - -## Debug Examples - -Below is a collection of real world debugging examples. For additional information, refer to [Debugging/Troubleshooting QMK](faq_debug.md). - -### Which matrix position is this keypress? - -When porting, or when attempting to diagnose pcb issues, it can be useful to know if a keypress is scanned correctly. To enable logging for this scenario, add the following code to your keymaps `keymap.c` - -```c -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - // If console is enabled, it will print the matrix position and status of each key pressed -#ifdef CONSOLE_ENABLE - uprintf("KL: kc: %u, col: %u, row: %u, pressed: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed); -#endif - return true; -} -``` - -Example output -```text -Waiting for device:....... -Listening: -KL: kc: 169, col: 0, row: 0, pressed: 1 -KL: kc: 169, col: 0, row: 0, pressed: 0 -KL: kc: 174, col: 1, row: 0, pressed: 1 -KL: kc: 174, col: 1, row: 0, pressed: 0 -KL: kc: 172, col: 2, row: 0, pressed: 1 -KL: kc: 172, col: 2, row: 0, pressed: 0 -``` - -### How long did it take to scan for a keypress? - -When testing performance issues, it can be useful to know the frequency at which the switch matrix is being scanned. To enable logging for this scenario, add the following code to your keymaps `config.h` - -```c -#define DEBUG_MATRIX_SCAN_RATE -``` - -Example output -```text - > matrix scan frequency: 315 - > matrix scan frequency: 313 - > matrix scan frequency: 316 - > matrix scan frequency: 316 - > matrix scan frequency: 316 - > matrix scan frequency: 316 -``` +[Moved here](faq_debug.md#debugging) |