fixes, most notably bug with losing base letter settings on keyboard restart
This commit is contained in:
parent
7c39c7540c
commit
34da4646e0
|
|
@ -33,6 +33,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#ifdef RGBLIGHT_ENABLE
|
||||
#undef RGBLED_NUM
|
||||
#define RGBLED_NUM 27
|
||||
#define RGBLIGHT_LIMIT_VAL 120
|
||||
#define RGBLIGHT_LAYERS
|
||||
#define RGBLIGHT_SPLIT
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,3 +1,2 @@
|
|||
OLED_DRIVER_ENABLE = yes
|
||||
RGBLIGHT_ENABLE = yes
|
||||
MOUSEKEY_ENABLE = yes
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
MIDI_ENABLE = no # MIDI controls
|
||||
AUDIO_ENABLE = yes # Audio output on port C6
|
||||
RGBLIGHT_ENABLE = yes
|
||||
#CONSOLE_ENABLE = yes
|
||||
MOUSEKEY_ENABLE = yes
|
||||
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
RGBLIGHT_ENABLE = yes
|
||||
MOUSEKEY_ENABLE = yes
|
||||
|
|
|
|||
|
|
@ -2,16 +2,12 @@
|
|||
|
||||
#ifdef RGBLIGHT_ENABLE
|
||||
# undef RGBLIGHT_ANIMATIONS
|
||||
//# if defined(__AVR__) && !defined(__AVR_AT90USB1286__)
|
||||
# define RGBLIGHT_SLEEP
|
||||
# define RGBLIGHT_EFFECT_BREATHING
|
||||
# define RGBLIGHT_EFFECT_RAINBOW_MOOD
|
||||
# define RGBLIGHT_EFFECT_RAINBOW_SWIRL
|
||||
# define RGBLIGHT_EFFECT_STATIC_GRADIENT
|
||||
# define RGBLIGHT_EFFECT_TWINKLE
|
||||
//# else
|
||||
//# define RGBLIGHT_ANIMATIONS
|
||||
//# endif
|
||||
# define RGBLIGHT_SLEEP
|
||||
# define RGBLIGHT_EFFECT_BREATHING
|
||||
# define RGBLIGHT_EFFECT_RAINBOW_MOOD
|
||||
# define RGBLIGHT_EFFECT_RAINBOW_SWIRL
|
||||
# define RGBLIGHT_EFFECT_STATIC_GRADIENT
|
||||
# define RGBLIGHT_EFFECT_TWINKLE
|
||||
# define RGBLIGHT_HUE_STEP 2
|
||||
# define RGBLIGHT_SAT_STEP 8
|
||||
# define RGBLIGHT_VAL_STEP 8
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||
#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
|
||||
if (record->event.pressed) {
|
||||
userspace_config.rgb_layer_change ^= 1;
|
||||
dprintf("rgblight layer change [EEPROM]: %u\n", userspace_config.rgb_layer_change);
|
||||
xprintf("rgblight layer change [EEPROM]: %u\n", userspace_config.rgb_layer_change);
|
||||
eeconfig_update_user(userspace_config.raw);
|
||||
if (userspace_config.rgb_layer_change) {
|
||||
# if defined(RGBLIGHT_ENABLE) && defined(RGB_MATRIX_ENABLE)
|
||||
|
|
@ -88,11 +88,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||
# if defined(RGBLIGHT_ENABLE) && defined(RGB_MATRIX_ENABLE)
|
||||
} else {
|
||||
rgblight_disable_noeeprom();
|
||||
// TODO: Right now, when disabling rgb_layer_change, it doesn't remember
|
||||
// the current rgb hsv and mode. It just uses the current color of
|
||||
// the current layer for this keycode. Tried the code below to force
|
||||
// it, but it's not working
|
||||
//rgblight_set_hsv_and_mode(userspace_config.hue, userspace_config.sat, userspace_config.val, userspace_config.mode);
|
||||
# endif
|
||||
}
|
||||
}
|
||||
|
|
@ -102,7 +97,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||
#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
|
||||
if (record->event.pressed) {
|
||||
userspace_config.rgb_base_layer_override ^= 1;
|
||||
dprintf("rgblight base layer override change [EEPROM]: %u\n", userspace_config.rgb_base_layer_override);
|
||||
xprintf("rgblight base layer override change [EEPROM]: %u\n", userspace_config.rgb_base_layer_override);
|
||||
eeconfig_update_user(userspace_config.raw);
|
||||
if (userspace_config.rgb_base_layer_override) {
|
||||
# if defined(RGBLIGHT_ENABLE) && defined(RGB_MATRIX_ENABLE)
|
||||
|
|
@ -138,18 +133,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||
case RGB_MODE_FORWARD ... RGB_MODE_GRADIENT: // quantum_keycodes.h L400 for definitions
|
||||
if (record->event.pressed) {
|
||||
bool is_eeprom_updated = false;
|
||||
# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES)
|
||||
// // This disables layer indication, as it's assumed that if you're changing this ... you want that disabled
|
||||
// if (userspace_config.rgb_layer_change) {
|
||||
// userspace_config.rgb_layer_change = false;
|
||||
// dprintf("rgblight layer change [EEPROM]: %u\n", userspace_config.rgb_layer_change);
|
||||
// is_eeprom_updated = true;
|
||||
// }
|
||||
# endif
|
||||
|
||||
# if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS)
|
||||
if (userspace_config.rgb_matrix_idle_anim) {
|
||||
userspace_config.rgb_matrix_idle_anim = false;
|
||||
dprintf("RGB Matrix Idle Animation [EEPROM]: %u\n", userspace_config.rgb_matrix_idle_anim);
|
||||
xprintf("RGB Matrix Idle Animation [EEPROM]: %u\n", userspace_config.rgb_matrix_idle_anim);
|
||||
is_eeprom_updated = true;
|
||||
}
|
||||
# endif
|
||||
|
|
|
|||
|
|
@ -79,6 +79,10 @@ layer_state_t layer_state_set_rgb_light(layer_state_t state) {
|
|||
if (is_caps_lock_on) {
|
||||
rgblight_set_hsv_and_mode(HSV_RED, mode);
|
||||
} else if (userspace_config.rgb_base_layer_override) {
|
||||
xprintf("layer set: userspace_config.hue [EEPROM]: %u\n", userspace_config.hue);
|
||||
xprintf("layer set: userspace_config.sat [EEPROM]: %u\n", userspace_config.sat);
|
||||
xprintf("layer set: userspace_config.val [EEPROM]: %u\n", userspace_config.val);
|
||||
xprintf("layer set: userspace_config.mode [EEPROM]: %u\n", userspace_config.mode);
|
||||
rgblight_set_hsv_and_mode(userspace_config.hue, userspace_config.sat, userspace_config.val, userspace_config.mode);
|
||||
} else {
|
||||
rgblight_set_hsv_and_mode(HSV_BLUE, mode);
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
SRC += sadekbaroudi.c \
|
||||
process_records.c
|
||||
|
||||
BOOTLOADER = atmel-dfu
|
||||
COMMAND_ENABLE = no # Commands for debug and configuration
|
||||
UNICODE_ENABLE = no # Unicode
|
||||
SWAP_HANDS_ENABLE= no # Allow swapping hands of keyboard
|
||||
MOUSEKEY_ENABLE = yes
|
||||
|
||||
SPACE_CADET_ENABLE = no
|
||||
GRAVE_ESC_ENABLE = no
|
||||
|
|
|
|||
|
|
@ -3,10 +3,21 @@
|
|||
userspace_config_t userspace_config;
|
||||
bool is_caps_lock_on;
|
||||
|
||||
|
||||
void handle_caps_lock_change(void) {
|
||||
#if defined(RGBLIGHT_ENABLE) // We only do this because we want the layer color to change
|
||||
layer_state_set_user(layer_state);
|
||||
#endif // RGBLIGHT_ENABLE
|
||||
}
|
||||
|
||||
__attribute__((weak)) void keyboard_pre_init_keymap(void) {}
|
||||
|
||||
void keyboard_pre_init_user(void) {
|
||||
userspace_config.raw = eeconfig_read_user();
|
||||
|
||||
// hack for a weird issue where userspace_config.val gets set to 0 on keyboard restart
|
||||
userspace_config.val = 255;
|
||||
|
||||
keyboard_pre_init_keymap();
|
||||
}
|
||||
// Add reconfigurable functions here, for keymap customization
|
||||
|
|
@ -71,15 +82,18 @@ void matrix_scan_user(void) {
|
|||
startup_user();
|
||||
}
|
||||
|
||||
|
||||
#if defined(RGBLIGHT_ENABLE)
|
||||
matrix_scan_rgb_light();
|
||||
#endif // RGBLIGHT_ENABLE
|
||||
|
||||
// We do this in matrix scan in case there are two keyboards connected and we
|
||||
// need to make sure this keyboard is aware
|
||||
led_t led_state = host_keyboard_led_state();
|
||||
if (led_state.caps_lock != is_caps_lock_on) {
|
||||
is_caps_lock_on = led_state.caps_lock;
|
||||
layer_state_set_user(layer_state);
|
||||
handle_caps_lock_change();
|
||||
}
|
||||
#endif // RGBLIGHT_ENABLE
|
||||
|
||||
#if defined(RGB_MATRIX_ENABLE)
|
||||
matrix_scan_rgb_matrix();
|
||||
#endif
|
||||
|
|
@ -126,7 +140,7 @@ void eeconfig_init_user(void) {
|
|||
userspace_config.rgb_base_layer_override = false;
|
||||
userspace_config.rgb_layer_change = true;
|
||||
userspace_config.mode = RGBLIGHT_MODE_STATIC_LIGHT;
|
||||
userspace_config.hue = 169; // BLUE
|
||||
userspace_config.hue = 167; // BLUE
|
||||
userspace_config.sat = 255;
|
||||
userspace_config.val = 255;
|
||||
userspace_config.speed = 1;
|
||||
|
|
|
|||
|
|
@ -58,11 +58,11 @@ typedef union {
|
|||
bool rgb_layer_change :1;
|
||||
bool rgb_base_layer_override :1;
|
||||
bool rgb_matrix_idle_anim :1;
|
||||
uint8_t mode; //:default 1; RGBLIGHT_MODE_STATIC_LIGHT;
|
||||
uint8_t hue; //:0-255;
|
||||
uint8_t sat; //:0-255;
|
||||
uint8_t val; //:0-255;
|
||||
uint8_t speed; //:default 1;
|
||||
uint8_t mode;
|
||||
uint8_t hue;
|
||||
uint8_t sat;
|
||||
uint8_t val;
|
||||
uint8_t speed;
|
||||
};
|
||||
} userspace_config_t;
|
||||
// clang-format on
|
||||
|
|
|
|||
Loading…
Reference in New Issue