From 571a9794af0249ef23a0af2ed2ee64191299faa7 Mon Sep 17 00:00:00 2001 From: Joshua Diamond Date: Thu, 15 Dec 2022 03:18:54 -0500 Subject: Fix non-functional RGBLIGHT_EFFECT_TWINKLE on ARM (#19335) --- quantum/rgblight/rgblight.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/quantum/rgblight/rgblight.c b/quantum/rgblight/rgblight.c index f832854c5f..19d80e0097 100644 --- a/quantum/rgblight/rgblight.c +++ b/quantum/rgblight/rgblight.c @@ -1480,6 +1480,8 @@ void rgblight_effect_twinkle(animation_status_t *anim) { return (v * scale) >> 8; } + const uint8_t trigger = scale((uint16_t)0xFF * RGBLIGHT_EFFECT_TWINKLE_PROBABILITY, 127 + rgblight_config.val / 2); + for (uint8_t i = 0; i < rgblight_ranges.effect_num_leds; i++) { TwinkleState *t = &(led_twinkle_state[i]); HSV * c = &(t->hsv); @@ -1498,7 +1500,7 @@ void rgblight_effect_twinkle(animation_status_t *anim) { t->life--; uint8_t unscaled = frac(breathe_calc(frac(t->life, t->max_life)) - bottom, top - bottom); c->v = scale(rgblight_config.val, unscaled); - } else if (rand() < scale((uint16_t)RAND_MAX * RGBLIGHT_EFFECT_TWINKLE_PROBABILITY, 127 + rgblight_config.val / 2)) { + } else if ((rand() % 0xFF) < trigger) { // This LED is off, but was randomly selected to start brightening if (random_color) { c->h = rand() % 0xFF; -- cgit v1.2.3 From 33cc81f36efd255447b47428f3198ef3793c1d41 Mon Sep 17 00:00:00 2001 From: jotix <69703151+jotix@users.noreply.github.com> Date: Thu, 15 Dec 2022 05:19:39 -0300 Subject: [Keymap] Simplifying ortho-4x12 jotix's layout (#19336) --- layouts/community/ortho_4x12/jotix/keymap.c | 36 +++++++++-------------------- layouts/community/ortho_4x12/jotix/rules.mk | 1 + 2 files changed, 12 insertions(+), 25 deletions(-) diff --git a/layouts/community/ortho_4x12/jotix/keymap.c b/layouts/community/ortho_4x12/jotix/keymap.c index 92e697ded3..54667c7e7c 100644 --- a/layouts/community/ortho_4x12/jotix/keymap.c +++ b/layouts/community/ortho_4x12/jotix/keymap.c @@ -2,17 +2,16 @@ enum layers { _QWERTY, - _TCURSOR, _LOWER, _RAISE, _NUMPAD, _ADJUST, }; -#define TCURSOR TG(_TCURSOR) -#define LOWER MO(_LOWER) -#define RAISE MO(_RAISE) -#define NUMPAD MO(_NUMPAD) +#define LOWER MO(_LOWER) +#define RAISE MO(_RAISE) +#define NUMPAD TG(_NUMPAD) +#define ADJUST MO(_ADJUST) const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { @@ -24,19 +23,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // ├───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤ KC_LSFT,KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH,KC_ENT, // ├───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤ - KC_LCTL,KC_LGUI,KC_LALT,NUMPAD, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT,KC_DOWN,KC_UP, KC_RGHT -// └───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┘ -), - -[_TCURSOR] = LAYOUT_ortho_4x12 ( -// ┌───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┐ - _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, -// ├───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤ - _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, -// ├───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤ - _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,KC_UP, _______, -// ├───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤ - _______,_______,_______,_______,_______,_______,_______,_______,KC_SLSH,KC_LEFT,KC_DOWN,KC_RGHT + KC_LCTL,KC_LGUI,KC_LALT,KC_RALT,LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT,KC_DOWN,KC_UP, KC_RGHT // └───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┘ ), @@ -60,13 +47,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // ├───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤ _______,KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_UNDS,KC_PLUS,KC_LCBR,KC_RCBR,KC_PIPE, // ├───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤ - _______,_______,_______,_______,_______,_______,_______,_______,KC_HOME,KC_PGDN,KC_PGUP,KC_END + _______,_______,_______,_______,ADJUST, _______,NUMPAD, _______,KC_HOME,KC_PGDN,KC_PGUP,KC_END // └───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┘ ), [_NUMPAD] = LAYOUT_ortho_4x12 ( // ┌───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┐ - _______,KC_BTN1,KC_MS_U,KC_BTN2,KC_WH_U,_______,_______,KC_P7, KC_P8, KC_P9, KC_PMNS,_______, + NUMPAD, KC_BTN1,KC_MS_U,KC_BTN2,KC_WH_U,_______,_______,KC_P7, KC_P8, KC_P9, KC_PMNS,_______, // ├───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤ _______,KC_MS_L,KC_MS_D,KC_MS_R,KC_WH_D,_______,_______,KC_P4, KC_P5, KC_P6, KC_PPLS,_______, // ├───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤ @@ -78,11 +65,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_ADJUST] = LAYOUT_ortho_4x12 ( // ┌───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┐ - _______,QK_BOOT,_______,_______,RGB_TOG,RGB_M_P,RGB_M_B,RGB_M_R,RGB_M_SW,_______,_______,_______, + _______,QK_BOOT,_______,_______,QK_RBT, _______,_______,_______,_______,_______,_______,_______, // ├───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤ - _______,_______,RGB_SAI,RGB_SAD,_______,_______,RGB_HUI,RGB_HUD,_______,_______,_______,_______, + _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, // ├───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤ - _______,_______,_______,_______,_______,RGB_VAI,RGB_VAD,_______,RGB_MOD,RGB_RMOD,TCURSOR,_______, + _______,_______,_______,_______,_______,_______,_______,QK_MAKE,_______,_______,_______,_______, // ├───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤ _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______ // └───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┘ @@ -90,9 +77,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; layer_state_t layer_state_set_user(layer_state_t state) { - state = update_tri_layer_state(state, _NUMPAD, _RAISE, _ADJUST); #ifdef JOTANCK_LEDS - writePin(JOTANCK_LED2, (IS_LAYER_ON(_TCURSOR))); + writePin(JOTANCK_LED2, (IS_LAYER_ON_STATE(state, _NUMPAD))); #endif return state; } diff --git a/layouts/community/ortho_4x12/jotix/rules.mk b/layouts/community/ortho_4x12/jotix/rules.mk index 9e6797ed30..ab2f67b7a4 100644 --- a/layouts/community/ortho_4x12/jotix/rules.mk +++ b/layouts/community/ortho_4x12/jotix/rules.mk @@ -1 +1,2 @@ DYNAMIC_MACRO_ENABLE = yes +BOOTMAGIC_ENABLE = yes -- cgit v1.2.3