mirror of
https://github.com/qmk/qmk_firmware.git
synced 2024-11-25 12:46:41 +00:00
[Keymap] fixed oled turn-off issue for crkbd:gotham (#16748)
This commit is contained in:
parent
6d816d94f7
commit
935af9e999
@ -10,7 +10,6 @@ My take on the 40% layout with programming in mind. Do read about the layers, it
|
|||||||
|
|
||||||
## Custom OLED
|
## Custom OLED
|
||||||
This keymap includes custom OLED font and code. The font contains some logos and status indidcators for some of the features I use (RGB and Audio). Enable OLED in rukes.mk to check it out. Feel free to reuse the font or parts of it.
|
This keymap includes custom OLED font and code. The font contains some logos and status indidcators for some of the features I use (RGB and Audio). Enable OLED in rukes.mk to check it out. Feel free to reuse the font or parts of it.
|
||||||
__KNOWN BUG:__ When the computer sleeps, one of the OLEDs is always on (they don't turn off on their own, and the timeout doesn't work). I haven't been able to figure out what's going on there and am open to suggestions/PRs.
|
|
||||||
|
|
||||||
## Flashing
|
## Flashing
|
||||||
Flash using `make crkbd:gotham:avrdude` for Pro Micro and `make crkbd:gotham:dfu` for Elite-C.
|
Flash using `make crkbd:gotham:avrdude` for Pro Micro and `make crkbd:gotham:dfu` for Elite-C.
|
||||||
|
@ -20,7 +20,16 @@
|
|||||||
# define AUDIO_CLICKY
|
# define AUDIO_CLICKY
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define OLED_FONT_H "keyboards/crkbd/keymaps/gotham/glcdfont.c"
|
#ifdef OLED_ENABLE
|
||||||
|
# define OLED_FONT_H "keyboards/crkbd/keymaps/gotham/glcdfont.c"
|
||||||
|
# define SPLIT_LAYER_STATE_ENABLE
|
||||||
|
# define SPLIT_LED_STATE_ENABLE
|
||||||
|
# define SPLIT_MODS_ENABLE
|
||||||
|
# define SPLIT_OLED_ENABLE
|
||||||
|
# undef OLED_TIMEOUT
|
||||||
|
// due to timer_read() for render_prompt(), we have own implementation of oled time out
|
||||||
|
# define OLED_KEY_TIMEOUT 30000
|
||||||
|
#endif
|
||||||
|
|
||||||
#define RGBLIGHT_SLEEP
|
#define RGBLIGHT_SLEEP
|
||||||
|
|
||||||
|
@ -81,6 +81,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||||||
#ifdef OLED_ENABLE
|
#ifdef OLED_ENABLE
|
||||||
if (record->event.pressed) {
|
if (record->event.pressed) {
|
||||||
oled_timer = timer_read();
|
oled_timer = timer_read();
|
||||||
|
is_key_processed = true;
|
||||||
add_keylog(keycode);
|
add_keylog(keycode);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -144,6 +144,7 @@ void render_feature_status(void) {
|
|||||||
// Keylogger
|
// Keylogger
|
||||||
#define KEYLOGGER_LENGTH 5
|
#define KEYLOGGER_LENGTH 5
|
||||||
static uint16_t oled_timer = 0;
|
static uint16_t oled_timer = 0;
|
||||||
|
static bool is_key_processed = true;
|
||||||
static char keylog_str[KEYLOGGER_LENGTH + 1] = {"\n"};
|
static char keylog_str[KEYLOGGER_LENGTH + 1] = {"\n"};
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static const char PROGMEM code_to_name[0xFF] = {
|
static const char PROGMEM code_to_name[0xFF] = {
|
||||||
@ -247,18 +248,13 @@ oled_rotation_t oled_init_user(oled_rotation_t rotation) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool oled_task_user(void) {
|
bool oled_task_user(void) {
|
||||||
if (timer_elapsed(oled_timer) > 10000) {
|
|
||||||
oled_off();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#ifndef SPLIT_KEYBOARD
|
|
||||||
else {
|
|
||||||
oled_on();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (is_keyboard_master()) {
|
if (is_keyboard_master()) {
|
||||||
|
if (is_key_processed && (timer_elapsed(oled_timer) < OLED_KEY_TIMEOUT)) {
|
||||||
render_status_main();
|
render_status_main();
|
||||||
|
} else {
|
||||||
|
is_key_processed = false;
|
||||||
|
oled_off();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
render_status_secondary();
|
render_status_secondary();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user