From 1dccb4176e061ce66058ab8af3d7d727cad27906 Mon Sep 17 00:00:00 2001 From: Daniil Yastremskiy Date: Fri, 10 Sep 2021 17:11:08 +0300 Subject: [PATCH] Address review comments --- keyboards/elephant42/config.h | 16 +++++--- keyboards/elephant42/keymaps/default/keymap.c | 39 ++++++++----------- keyboards/elephant42/keymaps/via/keymap.c | 39 ++++++++----------- keyboards/elephant42/lib/glcdfont.c | 13 +------ keyboards/elephant42/readme.md | 3 ++ keyboards/elephant42/rules.mk | 4 +- 6 files changed, 49 insertions(+), 65 deletions(-) diff --git a/keyboards/elephant42/config.h b/keyboards/elephant42/config.h index fca9384e8c60..2fc013b3a065 100644 --- a/keyboards/elephant42/config.h +++ b/keyboards/elephant42/config.h @@ -59,7 +59,16 @@ along with this program. If not, see . # define RGBLIGHT_SAT_STEP 8 # define RGBLIGHT_VAL_STEP 8 # define RGBLIGHT_LIMIT_VAL 170 /* The maximum brightness level */ -# define RGBLIGHT_ANIMATIONS +# define RGBLIGHT_EFFECT_BREATHING +# define RGBLIGHT_EFFECT_RAINBOW_MOOD +# define RGBLIGHT_EFFECT_RAINBOW_SWIRL +# define RGBLIGHT_EFFECT_SNAKE +# define RGBLIGHT_EFFECT_KNIGHT +# define RGBLIGHT_EFFECT_CHRISTMAS +# define RGBLIGHT_EFFECT_STATIC_GRADIENT +# define RGBLIGHT_EFFECT_RGB_TEST +# define RGBLIGHT_EFFECT_ALTERNATING +# define RGBLIGHT_EFFECT_TWINKLE #endif #ifdef RGB_MATRIX_ENABLE @@ -79,11 +88,6 @@ along with this program. If not, see . /* define if matrix has ghost (lacks anti-ghosting diodes) */ //#define MATRIX_HAS_GHOST -/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ -#define LOCKING_SUPPORT_ENABLE -/* Locking resynchronize hack */ -#define LOCKING_RESYNC_ENABLE - /* disable these deprecated features by default */ #define NO_ACTION_MACRO #define NO_ACTION_FUNCTION diff --git a/keyboards/elephant42/keymaps/default/keymap.c b/keyboards/elephant42/keymaps/default/keymap.c index 00a66ef183ad..5b377f47e6d5 100644 --- a/keyboards/elephant42/keymaps/default/keymap.c +++ b/keyboards/elephant42/keymaps/default/keymap.c @@ -15,14 +15,9 @@ */ #include QMK_KEYBOARD_H -#ifdef OLED_ENABLE -# include -# include -#endif - -#define KC_VU KC__VOLUP -#define KC_VD KC__VOLDOWN -#define KC_MU KC__MUTE +#define KC_VU KC_AUDIO_VOL_UP +#define KC_VD KC_AUDIO_VOL_DOWN +#define KC_MU KC_AUDIO_MUTE #define KC_LSPC LT(_LOWER, KC_SPC) #define KC_RSPC LT(_RAISE, KC_SPC) @@ -87,7 +82,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { void oled_task_user(void) { if (is_keyboard_master()) { - char disp[21 * 4]; static char layer_names[NUMBER_OF_LAYERS][10] = {"Default", "Lower", "Raise"}; static char l1[] = " \x94\x95\x96\x97"; static char l2[] = " \xB4\xB5\xB6\xB7"; @@ -99,21 +93,20 @@ void oled_task_user(void) { } bool goingLeft = keypresses < STEPS / 2; - strcpy(disp, "Layer: "); - strcat(disp, layer_names[get_highest_layer(layer_state)]); - strcat(disp, "\n\n"); - strcat(disp, (goingLeft ? l1 : r1) + iconShift); - strcat(disp, "\n"); - strcat(disp, (goingLeft ? l2 : r2) + iconShift); - strcat(disp, "\n"); - - oled_write(disp, false); + oled_write_P(PSTR("Layer: "), false); + oled_write_ln(layer_names[get_highest_layer(layer_state)], false); + oled_advance_page(true); + oled_write_ln((goingLeft ? l1 : r1) + iconShift, false); + oled_write_ln((goingLeft ? l2 : r2) + iconShift, false); } else { - static char *logo = "\n" - "\x8f\x90\x91\x92\x93\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\n" - "\xaf\xb0\xb1\xb2\xb3\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\n" - "\xcf\xd0\xd1\xd2\xd3\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\n"; - oled_write(logo, false); + oled_advance_page(true); + static const char PROGMEM logo[] = { + 0x8f,0x90,0x91,0x92,0x93,0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x0a, + 0xaf,0xb0,0xb1,0xb2,0xb3,0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0x0a, + 0xcf,0xd0,0xd1,0xd2,0xd3,0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0 + }; + + oled_write_ln_P(logo, false); } } #endif diff --git a/keyboards/elephant42/keymaps/via/keymap.c b/keyboards/elephant42/keymaps/via/keymap.c index 81ec186cd593..ccbb73a3df02 100644 --- a/keyboards/elephant42/keymaps/via/keymap.c +++ b/keyboards/elephant42/keymaps/via/keymap.c @@ -15,14 +15,9 @@ */ #include QMK_KEYBOARD_H -#ifdef OLED_ENABLE -# include -# include -#endif - -#define KC_VU KC__VOLUP -#define KC_VD KC__VOLDOWN -#define KC_MU KC__MUTE +#define KC_VU KC_AUDIO_VOL_UP +#define KC_VD KC_AUDIO_VOL_DOWN +#define KC_MU KC_AUDIO_MUTE #define KC_LSPC LT(_LOWER, KC_SPC) #define KC_RSPC LT(_RAISE, KC_SPC) @@ -100,7 +95,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { void oled_task_user(void) { if (is_keyboard_master()) { - char disp[21 * 4]; static char layer_names[NUMBER_OF_LAYERS][10] = {"Default", "Lower", "Raise", "Adjust"}; static char l1[] = " \x94\x95\x96\x97"; static char l2[] = " \xB4\xB5\xB6\xB7"; @@ -112,21 +106,20 @@ void oled_task_user(void) { } bool goingLeft = keypresses < STEPS / 2; - strcpy(disp, "Layer: "); - strcat(disp, layer_names[get_highest_layer(layer_state)]); - strcat(disp, "\n\n"); - strcat(disp, (goingLeft ? l1 : r1) + iconShift); - strcat(disp, "\n"); - strcat(disp, (goingLeft ? l2 : r2) + iconShift); - strcat(disp, "\n"); - - oled_write(disp, false); + oled_write_P(PSTR("Layer: "), false); + oled_write_ln(layer_names[get_highest_layer(layer_state)], false); + oled_advance_page(true); + oled_write_ln((goingLeft ? l1 : r1) + iconShift, false); + oled_write_ln((goingLeft ? l2 : r2) + iconShift, false); } else { - static char *logo = "\n" - "\x8f\x90\x91\x92\x93\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\n" - "\xaf\xb0\xb1\xb2\xb3\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\n" - "\xcf\xd0\xd1\xd2\xd3\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\n"; - oled_write(logo, false); + oled_advance_page(true); + static const char PROGMEM logo[] = { + 0x8f,0x90,0x91,0x92,0x93,0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x0a, + 0xaf,0xb0,0xb1,0xb2,0xb3,0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0x0a, + 0xcf,0xd0,0xd1,0xd2,0xd3,0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0 + }; + + oled_write_ln_P(logo, false); } } #endif diff --git a/keyboards/elephant42/lib/glcdfont.c b/keyboards/elephant42/lib/glcdfont.c index f0e759d03366..31372e85d795 100755 --- a/keyboards/elephant42/lib/glcdfont.c +++ b/keyboards/elephant42/lib/glcdfont.c @@ -1,17 +1,9 @@ // This is the 'classic' fixed-space bitmap font for Adafruit_GFX since 1.0. // See gfxfont.h for newer custom bitmap font info. -#ifndef FONT5X7_H -#define FONT5X7_H +#pragma once -#ifdef __AVR__ - #include - #include -#elif defined(ESP8266) - #include -#else - #define PROGMEM -#endif +#include "progmem.h" static const unsigned char font[] PROGMEM = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -239,4 +231,3 @@ static const unsigned char font[] PROGMEM = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; -#endif // FONT5X7_H diff --git a/keyboards/elephant42/readme.md b/keyboards/elephant42/readme.md index 0f09ad75add5..855ccda1e0a2 100644 --- a/keyboards/elephant42/readme.md +++ b/keyboards/elephant42/readme.md @@ -20,5 +20,8 @@ See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_to ## Bootloader +Enter the bootloader in 3 ways: + +* **Bootmagic reset**: Hold down the key at (0,0) in the matrix (usually the top left key or Escape) and plug in the keyboard * **Physical reset button**: Briefly press the button on the back of the PCB - some may have pads you must short instead * **Keycode in layout**: Press the key mapped to `RESET` if it is available diff --git a/keyboards/elephant42/rules.mk b/keyboards/elephant42/rules.mk index 1c5d0bb76e37..16ab65608543 100644 --- a/keyboards/elephant42/rules.mk +++ b/keyboards/elephant42/rules.mk @@ -7,9 +7,9 @@ BOOTLOADER = caterina # Build Options # change yes to no to disable # -BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite +BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite MOUSEKEY_ENABLE = no # Mouse keys -EXTRAKEY_ENABLE = no # Audio control and System control +EXTRAKEY_ENABLE = yes # Audio control and System control CONSOLE_ENABLE = no # Console for debug COMMAND_ENABLE = no # Commands for debug and configuration # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE