Fix indicating bug
This commit is contained in:
parent
c3f7cee764
commit
5c61a8b0bc
5 changed files with 31 additions and 28 deletions
|
|
@ -24,11 +24,10 @@ enum {
|
||||||
BAT_LVL_ANI_BLINK_ON,
|
BAT_LVL_ANI_BLINK_ON,
|
||||||
};
|
};
|
||||||
|
|
||||||
static uint8_t animation_state;
|
static uint8_t animation_state = 0;
|
||||||
static uint32_t bat_lvl_ani_timer_buffer;
|
static uint32_t bat_lvl_ani_timer_buffer = 0;
|
||||||
static uint8_t bat_percentage;
|
static uint8_t bat_percentage;
|
||||||
static uint8_t cur_percentage;
|
static uint8_t cur_percentage;
|
||||||
static uint8_t bat_lvl_led_list[10] = BAT_LEVEL_LED_LIST;
|
|
||||||
static uint32_t time_interval;
|
static uint32_t time_interval;
|
||||||
#ifdef RGB_MATRIX_ENABLE
|
#ifdef RGB_MATRIX_ENABLE
|
||||||
static uint8_t r, g, b;
|
static uint8_t r, g, b;
|
||||||
|
|
@ -61,6 +60,8 @@ bool bat_level_animiation_actived(void) {
|
||||||
|
|
||||||
void bat_level_animiation_indicate(void) {
|
void bat_level_animiation_indicate(void) {
|
||||||
#ifdef LED_MATRIX_ENABLE
|
#ifdef LED_MATRIX_ENABLE
|
||||||
|
uint8_t bat_lvl_led_list[10] = BAT_LEVEL_LED_LIST;
|
||||||
|
|
||||||
for (uint8_t i = 0; i <= DRIVER_LED_TOTAL; i++) {
|
for (uint8_t i = 0; i <= DRIVER_LED_TOTAL; i++) {
|
||||||
led_matrix_set_value(i, 0);
|
led_matrix_set_value(i, 0);
|
||||||
}
|
}
|
||||||
|
|
@ -71,14 +72,17 @@ void bat_level_animiation_indicate(void) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef RGB_MATRIX_ENABLE
|
#ifdef RGB_MATRIX_ENABLE
|
||||||
|
uint8_t bat_lvl_led_list[10] = BAT_LEVEL_LED_LIST;
|
||||||
|
|
||||||
for (uint8_t i = 0; i <= DRIVER_LED_TOTAL; i++) {
|
for (uint8_t i = 0; i <= DRIVER_LED_TOTAL; i++) {
|
||||||
rgb_matrix_set_color(i, 0, 0, 0);
|
rgb_matrix_set_color(i, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (animation_state == BAT_LVL_ANI_GROWING || animation_state == BAT_LVL_ANI_BLINK_ON)
|
if (animation_state == BAT_LVL_ANI_GROWING || animation_state == BAT_LVL_ANI_BLINK_ON) {
|
||||||
for (uint8_t i = 0; i < cur_percentage / 10; i++) {
|
for (uint8_t i = 0; i < cur_percentage / 10; i++) {
|
||||||
rgb_matrix_set_color(bat_lvl_led_list[i], r, g, b);
|
rgb_matrix_set_color(bat_lvl_led_list[i], r, g, b);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -109,7 +113,7 @@ void bat_level_animiation_update(void) {
|
||||||
|
|
||||||
case BAT_LVL_ANI_BLINK_ON:
|
case BAT_LVL_ANI_BLINK_ON:
|
||||||
animation_state = BAT_LVL_ANI_NONE;
|
animation_state = BAT_LVL_ANI_NONE;
|
||||||
if (indicator_config.value == 0 && indicator_is_backlit_enabled_eeprom()) {
|
if (indicator_config.value == 0 && !indicator_is_backlit_enabled_eeprom()) {
|
||||||
indicator_disable();
|
indicator_disable();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,15 @@ extern report_buffer_t kb_rpt;
|
||||||
extern uint32_t retry_time_buffer;
|
extern uint32_t retry_time_buffer;
|
||||||
extern uint8_t retry;
|
extern uint8_t retry;
|
||||||
|
|
||||||
|
#ifdef NKRO_ENABLE
|
||||||
|
typedef struct {
|
||||||
|
bool usb : 1;
|
||||||
|
bool bluetooth : 1;
|
||||||
|
} nkro_t;
|
||||||
|
|
||||||
|
extern nkro_t nkro;
|
||||||
|
#endif
|
||||||
|
|
||||||
static uint8_t host_index = 0;
|
static uint8_t host_index = 0;
|
||||||
static uint8_t led_state = 0;
|
static uint8_t led_state = 0;
|
||||||
|
|
||||||
|
|
@ -198,7 +207,7 @@ static void bluetooth_enter_connected(uint8_t host_idx) {
|
||||||
|
|
||||||
/* Enable NKRO since it may be disabled in pin code entry */
|
/* Enable NKRO since it may be disabled in pin code entry */
|
||||||
#if defined(NKRO_ENABLE) && defined(BLUETOOTH_NKRO_ENABLE)
|
#if defined(NKRO_ENABLE) && defined(BLUETOOTH_NKRO_ENABLE)
|
||||||
keymap_config.nkro = true;
|
keymap_config.nkro = nkro.bluetooth;
|
||||||
#else
|
#else
|
||||||
keymap_config.nkro = false;
|
keymap_config.nkro = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -179,42 +179,30 @@ void process_record_factory_reset(uint16_t keycode, keyrecord_t *record) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef LED_MATRIX_ENABLE
|
#ifdef LED_MATRIX_ENABLE
|
||||||
void led_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
|
void led_matrix_indicators_user(void) {
|
||||||
if (factory_reset_ind_state) {
|
if (factory_reset_ind_state) {
|
||||||
for (uint8_t i = led_min; i <= led_max; i++) {
|
led_matrix_set_value_all(factory_reset_ind_state % 2 ? 0 : 255)
|
||||||
led_matrix_set_value(i, factory_reset_ind_state % 2 ? 0 : 255);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef RGB_MATRIX_ENABLE
|
#ifdef RGB_MATRIX_ENABLE
|
||||||
void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
|
void rgb_matrix_indicators_user(void) {
|
||||||
if (factory_reset_ind_state) {
|
if (factory_reset_ind_state) {
|
||||||
for (uint8_t i = led_min; i <= led_max; i++) {
|
rgb_matrix_set_color_all(factory_reset_ind_state % 2 ? 0 : 255, 0, 0);
|
||||||
rgb_matrix_set_color(i, factory_reset_ind_state % 2 ? 0 : 255, 0, 0);
|
|
||||||
}
|
|
||||||
} else if (backlight_test_mode) {
|
} else if (backlight_test_mode) {
|
||||||
switch (backlight_test_mode) {
|
switch (backlight_test_mode) {
|
||||||
case BACKLIGHT_TEST_WHITE:
|
case BACKLIGHT_TEST_WHITE:
|
||||||
for (uint8_t i = led_min; i <= led_max; i++) {
|
rgb_matrix_set_color_all(255, 255, 255);
|
||||||
rgb_matrix_set_color(i, 255, 255, 255);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case BACKLIGHT_TEST_RED:
|
case BACKLIGHT_TEST_RED:
|
||||||
for (uint8_t i = led_min; i <= led_max; i++) {
|
rgb_matrix_set_color_all(255, 0, 0);
|
||||||
rgb_matrix_set_color(i, 255, 0, 0);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case BACKLIGHT_TEST_GREEN:
|
case BACKLIGHT_TEST_GREEN:
|
||||||
for (uint8_t i = led_min; i <= led_max; i++) {
|
rgb_matrix_set_color_all(0, 255, 0);
|
||||||
rgb_matrix_set_color(i, 0, 255, 0);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case BACKLIGHT_TEST_BLUE:
|
case BACKLIGHT_TEST_BLUE:
|
||||||
for (uint8_t i = led_min; i <= led_max; i++) {
|
rgb_matrix_set_color_all(0, 0, 255);
|
||||||
rgb_matrix_set_color(i, 0, 0, 255);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ indicator_config_t indicator_config;
|
||||||
static bluetooth_state_t indicator_state;
|
static bluetooth_state_t indicator_state;
|
||||||
static uint16_t next_period;
|
static uint16_t next_period;
|
||||||
static indicator_type_t type;
|
static indicator_type_t type;
|
||||||
static uint32_t indicator_timer_buffer;
|
static uint32_t indicator_timer_buffer = 0;
|
||||||
static uint32_t battery_low_indicator = 0;
|
static uint32_t battery_low_indicator = 0;
|
||||||
|
|
||||||
#if defined(LED_MATRIX_ENABLE) || defined(RGB_MATRIX_ENABLE)
|
#if defined(LED_MATRIX_ENABLE) || defined(RGB_MATRIX_ENABLE)
|
||||||
|
|
@ -79,6 +79,8 @@ static pin_t host_led_pin_list[HOST_DEVICES_COUNT] = HOST_LED_PIN_LIST;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void indicator_init(void) {
|
void indicator_init(void) {
|
||||||
|
memset(&indicator_config, 0, sizeof(indicator_config));
|
||||||
|
|
||||||
#ifdef HOST_LED_PIN_LIST
|
#ifdef HOST_LED_PIN_LIST
|
||||||
for (uint8_t i = 0; i < HOST_DEVICES_COUNT; i++) {
|
for (uint8_t i = 0; i < HOST_DEVICES_COUNT; i++) {
|
||||||
setPinOutput(host_led_pin_list[i]);
|
setPinOutput(host_led_pin_list[i]);
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ extern keymap_config_t keymap_config;
|
||||||
static transport_t transport = TRANSPORT_USB;
|
static transport_t transport = TRANSPORT_USB;
|
||||||
|
|
||||||
#ifdef NKRO_ENABLE
|
#ifdef NKRO_ENABLE
|
||||||
static nkro_t nkro = {false, false};
|
nkro_t nkro = {false, false};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void transport_changed(transport_t new_transport);
|
static void transport_changed(transport_t new_transport);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue