Skip to content

Commit

Permalink
Resolved issues
Browse files Browse the repository at this point in the history
  • Loading branch information
HorrorTroll committed Dec 15, 2022
1 parent 64dce94 commit 6de8dca
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 69 deletions.
25 changes: 0 additions & 25 deletions keyboards/phage_studio/pila87/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@

#include QMK_KEYBOARD_H

#include <string.h>
#include <math.h>

#include <lib/lib8tion/lib8tion.h>

// Each layer gets a name for readability, which is then used in the keymap matrix below.
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
// Layer names don't all need to be of the same length, obviously, and you can also skip them
Expand Down Expand Up @@ -178,23 +173,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
return true;
}

bool rgb_matrix_indicators_user(void) {
HSV hsv = rgb_matrix_config.hsv;
uint8_t time = scale16by8(g_rgb_timer, qadd8(32, 1));
hsv.h = time;
RGB rgb = hsv_to_rgb(hsv);

if ((rgb_matrix_get_flags() & LED_FLAG_ALL)) {
if (host_keyboard_led_state().caps_lock) {
rgb_matrix_set_color(40, rgb.r, rgb.g, rgb.b);
}
} else {
if (host_keyboard_led_state().caps_lock) {
rgb_matrix_set_color(40, rgb.r, rgb.g, rgb.b);
} else {
rgb_matrix_set_color(40, 0, 0, 0);
}
}
return false;
}
29 changes: 10 additions & 19 deletions keyboards/phage_studio/pila87/keymaps/horrortroll/keymap_stuff.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

#include <string.h>
#include <math.h>

#include <lib/lib8tion/lib8tion.h>

// Each layer gets a name for readability, which is then used in the keymap matrix below.
Expand Down Expand Up @@ -222,24 +221,16 @@ bool rgb_matrix_indicators_user(void) {
hsv.h = time;
RGB rgb = hsv_to_rgb(hsv);

if ((rgb_matrix_get_flags() & LED_FLAG_ALL)) {
if (host_keyboard_led_state().caps_lock) {
rgb_matrix_set_color(40, rgb.r, rgb.g, rgb.b);
}
if (host_keyboard_led_state().scroll_lock) {
rgb_matrix_set_color(89, rgb.r, rgb.g, rgb.b);
}
} else {
if (host_keyboard_led_state().caps_lock) {
rgb_matrix_set_color(40, rgb.r, rgb.g, rgb.b);
} else {
rgb_matrix_set_color(40, 0, 0, 0);
}
if (host_keyboard_led_state().scroll_lock) {
rgb_matrix_set_color(89, rgb.r, rgb.g, rgb.b);
} else {
rgb_matrix_set_color(89, 0, 0, 0);
}
if (host_keyboard_led_state().caps_lock) {
rgb_matrix_set_color(40, rgb.r, rgb.g, rgb.b);
} else if (!(rgb_matrix_get_flags() & LED_FLAG_INDICATOR)) {
rgb_matrix_set_color(40, 0, 0, 0);
}

if (host_keyboard_led_state().scroll_lock) {
rgb_matrix_set_color(89, rgb.r, rgb.g, rgb.b);
} else if (!(rgb_matrix_get_flags() & LED_FLAG_INDICATOR)) {
rgb_matrix_set_color(89, 0, 0, 0);
}
return false;
}
25 changes: 0 additions & 25 deletions keyboards/phage_studio/pila87/keymaps/via/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@

#include QMK_KEYBOARD_H

#include <string.h>
#include <math.h>

#include <lib/lib8tion/lib8tion.h>

// Each layer gets a name for readability, which is then used in the keymap matrix below.
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
// Layer names don't all need to be of the same length, obviously, and you can also skip them
Expand Down Expand Up @@ -178,23 +173,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
return true;
}

bool rgb_matrix_indicators_user(void) {
HSV hsv = rgb_matrix_config.hsv;
uint8_t time = scale16by8(g_rgb_timer, qadd8(32, 1));
hsv.h = time;
RGB rgb = hsv_to_rgb(hsv);

if ((rgb_matrix_get_flags() & LED_FLAG_ALL)) {
if (host_keyboard_led_state().caps_lock) {
rgb_matrix_set_color(40, rgb.r, rgb.g, rgb.b);
}
} else {
if (host_keyboard_led_state().caps_lock) {
rgb_matrix_set_color(40, rgb.r, rgb.g, rgb.b);
} else {
rgb_matrix_set_color(40, 0, 0, 0);
}
}
return false;
}
22 changes: 22 additions & 0 deletions keyboards/phage_studio/pila87/pila87.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@

#include "pila87.h"

#include <string.h>
#include <math.h>
#include <lib/lib8tion/lib8tion.h>

#ifdef RGB_MATRIX_ENABLE
led_config_t g_led_config = { {
{ 75, NO_LED, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90 },
Expand All @@ -41,3 +45,21 @@ led_config_t g_led_config = { {
1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 4,
} };
#endif

bool rgb_matrix_indicators_kb(void) {
if (!rgb_matrix_indicators_user()) {
return false;
}

HSV hsv = rgb_matrix_config.hsv;
uint8_t time = scale16by8(g_rgb_timer, qadd8(32, 1));
hsv.h = time;
RGB rgb = hsv_to_rgb(hsv);

if (host_keyboard_led_state().caps_lock) {
rgb_matrix_set_color(40, rgb.r, rgb.g, rgb.b);
} else if (!(rgb_matrix_get_flags() & LED_FLAG_INDICATOR)) {
rgb_matrix_set_color(40, 0, 0, 0);
}
return true;
}

0 comments on commit 6de8dca

Please sign in to comment.