From 9ad9aa5ead7bd24a06836bae5f27e95fe5eda523 Mon Sep 17 00:00:00 2001 From: Sergey Vlasov Date: Fri, 24 Feb 2023 19:45:09 +0300 Subject: [PATCH] onekey: Fix console output on AVR Plain `printf()` does not work for console output on AVR (the `xprintf` code does not replace `printf()`, and QMK does not set up `stdout` for the avr-libc `printf` implementation). Use `uprintf()` instead, which should work for all supported platforms. Note that `uprintf()` requires the format string to be a constant (on AVR it uses `PSTR()` internally to put the format string into PROGMEM), therefore `uprintf(buffer)` cannot be used (and it would be wrong anyway if the buffer has some chance to contain any format characters). --- keyboards/handwired/onekey/keymaps/adc/keymap.c | 2 +- keyboards/handwired/onekey/keymaps/hardware_id/keymap.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/keyboards/handwired/onekey/keymaps/adc/keymap.c b/keyboards/handwired/onekey/keymaps/adc/keymap.c index f9302a42b247..57125e01ed97 100644 --- a/keyboards/handwired/onekey/keymaps/adc/keymap.c +++ b/keyboards/handwired/onekey/keymaps/adc/keymap.c @@ -19,7 +19,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { char buffer[50]; sprintf(buffer, "ADC:%u\n", val); #ifdef CONSOLE_ENABLE - printf(buffer); + uprintf("%s", buffer); #else send_string(buffer); #endif diff --git a/keyboards/handwired/onekey/keymaps/hardware_id/keymap.c b/keyboards/handwired/onekey/keymaps/hardware_id/keymap.c index bcec8b3ca1b9..018b9215f87a 100644 --- a/keyboards/handwired/onekey/keymaps/hardware_id/keymap.c +++ b/keyboards/handwired/onekey/keymaps/hardware_id/keymap.c @@ -17,7 +17,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { char buffer[100]; sprintf(buffer, "ID:%lu:%lu:%lu:%lu\n", id.data[0], id.data[1], id.data[2], id.data[3]); #ifdef CONSOLE_ENABLE - printf(buffer); + uprintf("%s", buffer); #else send_string(buffer); #endif