summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjonavin <71780717+Jonavin@users.noreply.github.com>2022-07-21 08:44:51 -0400
committerGitHub <noreply@github.com>2022-07-21 13:44:51 +0100
commit7f0581cd3520a22fbec7994ee122d6a253272392 (patch)
tree14df892d817105856b3dddce9e269e04ea48eb74
parenta6d70de96a6d06d7c9443ce75a38808e2550317b (diff)
Jonavin mercutio - reduce mem footprint (#17498)
* Reduce mem footprint - remove sprintf * remove stdio reference and use get_u8_str Co-authored-by: Jonavin <=>
-rwxr-xr-xkeyboards/mechwild/mercutio/keymaps/jonavin/keymap.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/keyboards/mechwild/mercutio/keymaps/jonavin/keymap.c b/keyboards/mechwild/mercutio/keymaps/jonavin/keymap.c
index 869a9f73ab..e4d0ab49ef 100755
--- a/keyboards/mechwild/mercutio/keymaps/jonavin/keymap.c
+++ b/keyboards/mechwild/mercutio/keymaps/jonavin/keymap.c
@@ -17,7 +17,6 @@
#include QMK_KEYBOARD_H
-#include <stdio.h>
#include "jonavin.h"
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
@@ -54,7 +53,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
Defaults never changes if no encoder present to change it
*/
typedef struct {
- char keydesc[6]; // this will be displayed on OLED
+ char keydesc[6]; // this will be displayed on OLED
uint16_t keycode; // this is the keycode that will be sent when activted
} keycodedescType;
@@ -69,7 +68,7 @@ static const keycodedescType PROGMEM keyselection[] = {
{"C-A-D", KC_CAD}, // Ctrl-Alt-Del
{"AltF4", KC_AF4},
{"PLAY", KC_MEDIA_PLAY_PAUSE},
- {"RESET", RESET}, // firmware flash mode
+ {"FLASH", RESET}, // firmware flash mode
};
#define MAX_KEYSELECTION sizeof(keyselection)/sizeof(keyselection[0])
@@ -201,15 +200,13 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
}
render_logo();
oled_set_cursor(8,2);
- char fn_str[12];
switch(get_selected_layer()){
case 0:
oled_write_P(PSTR("BASE"), false);
break;
case 1:
- sprintf(fn_str, "FN %5s", selectedkey_rec.keydesc);
- oled_write(fn_str, false);
- //oled_write_P(PSTR("FN "), false);
+ oled_write_P(PSTR("FN "), false);
+ oled_write(selectedkey_rec.keydesc, false);
break;
case 2:
oled_write_P(PSTR("LOWER"), false);
@@ -230,8 +227,8 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
oled_write_P(PSTR("Temp BASE"), false);
break;
case 1:
- sprintf(fn_str, "Temp FN %5s", selectedkey_rec.keydesc);
- oled_write(fn_str, false);
+ oled_write_P(PSTR("Temp FN "), false);
+ oled_write(selectedkey_rec.keydesc, false);
break;
case 2:
oled_write_P(PSTR("Temp LOWER"), false);
@@ -246,12 +243,11 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
led_t led_state = host_keyboard_led_state();
oled_set_cursor(8,0);
uint8_t wpm_count;
- char wpm_str[10];
wpm_count=get_current_wpm();
if (wpm_count > 020) { // how wpm when > 20
- sprintf(wpm_str, " WPM: %03d", wpm_count);
- oled_write(wpm_str, false);
+ oled_write_P(PSTR(" WPM: "), false);
+ oled_write(get_u8_str(wpm_count, ' '), false);
} else {
oled_write_P(PSTR(" JONAVIN "), false); // otherwise display keymap name
}