@@ -273,8 +273,8 @@ static int zmk_led_generate_status(void) { return 0; }
273
273
274
274
const uint8_t underglow_layer_state [] = DT_PROP (UNDERGLOW_INDICATORS , layer_state );
275
275
const uint8_t underglow_ble_state [] = DT_PROP (UNDERGLOW_INDICATORS , ble_state );
276
- const uint8_t underglow_bat_lhs [] = DT_PROP (UNDERGLOW_INDICATORS , bat_lhs );
277
- const uint8_t underglow_bat_rhs [] = DT_PROP (UNDERGLOW_INDICATORS , bat_rhs );
276
+ const uint8_t underglow_bat_self [] = DT_PROP (UNDERGLOW_INDICATORS , bat_self );
277
+ const uint8_t underglow_bat_other [] = DT_PROP (UNDERGLOW_INDICATORS , bat_other );
278
278
279
279
#define HEXRGB (R , G , B ) \
280
280
((struct led_rgb){ \
@@ -327,31 +327,32 @@ static int zmk_led_generate_status(void) {
327
327
}
328
328
329
329
// BATTERY STATUS
330
- zmk_led_battery_level (zmk_battery_state_of_charge (), underglow_bat_lhs ,
331
- DT_PROP_LEN (UNDERGLOW_INDICATORS , bat_lhs ));
330
+ zmk_led_battery_level (zmk_battery_state_of_charge (), underglow_bat_self ,
331
+ DT_PROP_LEN (UNDERGLOW_INDICATORS , bat_self ));
332
332
333
333
#if IS_ENABLED (CONFIG_ZMK_SPLIT_BLE_CENTRAL_BATTERY_LEVEL_FETCHING )
334
334
uint8_t peripheral_level = 0 ;
335
335
int rc = zmk_split_get_peripheral_battery_level (0 , & peripheral_level );
336
336
337
337
if (rc == 0 ) {
338
- zmk_led_battery_level (peripheral_level , underglow_bat_rhs ,
339
- DT_PROP_LEN (UNDERGLOW_INDICATORS , bat_rhs ));
338
+ zmk_led_battery_level (peripheral_level , underglow_bat_other ,
339
+ DT_PROP_LEN (UNDERGLOW_INDICATORS , bat_other ));
340
340
} else if (rc == - ENOTCONN ) {
341
- zmk_led_fill (red , underglow_bat_rhs , DT_PROP_LEN (UNDERGLOW_INDICATORS , bat_rhs ));
341
+ zmk_led_fill (red , underglow_bat_other , DT_PROP_LEN (UNDERGLOW_INDICATORS , bat_other ));
342
342
} else if (rc == - EINVAL ) {
343
343
LOG_ERR ("Invalid peripheral index requested for battery level read: 0" );
344
344
}
345
345
#endif
346
346
347
+ #if !IS_ENABLED (CONFIG_ZMK_SPLIT ) || IS_ENABLED (CONFIG_ZMK_SPLIT_ROLE_CENTRAL )
347
348
// CAPSLOCK/NUMLOCK/SCROLLOCK STATUS
348
349
zmk_hid_indicators_t led_flags = zmk_hid_indicators_get_current_profile ();
349
350
350
- if (led_flags & ZMK_LED_CAPSLOCK_BIT )
351
+ if (led_flags & ZMK_LED_CAPSLOCK_BIT && DT_PROP ( UNDERGLOW_INDICATORS , capslock ) != -1 )
351
352
status_pixels [DT_PROP (UNDERGLOW_INDICATORS , capslock )] = red ;
352
- if (led_flags & ZMK_LED_NUMLOCK_BIT )
353
+ if (led_flags & ZMK_LED_NUMLOCK_BIT && DT_PROP ( UNDERGLOW_INDICATORS , numlock ) != -1 )
353
354
status_pixels [DT_PROP (UNDERGLOW_INDICATORS , numlock )] = red ;
354
- if (led_flags & ZMK_LED_SCROLLLOCK_BIT )
355
+ if (led_flags & ZMK_LED_SCROLLLOCK_BIT && DT_PROP ( UNDERGLOW_INDICATORS , scrolllock ) != -1 )
355
356
status_pixels [DT_PROP (UNDERGLOW_INDICATORS , scrolllock )] = red ;
356
357
357
358
// LAYER STATUS
@@ -362,7 +363,7 @@ static int zmk_led_generate_status(void) {
362
363
363
364
struct zmk_endpoint_instance active_endpoint = zmk_endpoints_selected ();
364
365
365
- if (!zmk_endpoints_preferred_transport_is_active ())
366
+ if (DT_PROP ( UNDERGLOW_INDICATORS , output_fallback ) != -1 && !zmk_endpoints_preferred_transport_is_active ())
366
367
status_pixels [DT_PROP (UNDERGLOW_INDICATORS , output_fallback )] = red ;
367
368
368
369
int active_ble_profile_index = zmk_ble_active_profile_index ();
@@ -382,17 +383,20 @@ static int zmk_led_generate_status(void) {
382
383
}
383
384
}
384
385
385
- enum zmk_usb_conn_state usb_state = zmk_usb_get_conn_state ();
386
- if (usb_state == ZMK_USB_CONN_HID &&
387
- active_endpoint .transport == ZMK_TRANSPORT_USB ) { // connected AND active
388
- status_pixels [DT_PROP (UNDERGLOW_INDICATORS , usb_state )] = white ;
389
- } else if (usb_state == ZMK_USB_CONN_HID ) { // connected
390
- status_pixels [DT_PROP (UNDERGLOW_INDICATORS , usb_state )] = dull_green ;
391
- } else if (usb_state == ZMK_USB_CONN_POWERED ) { // powered
392
- status_pixels [DT_PROP (UNDERGLOW_INDICATORS , usb_state )] = red ;
393
- } else if (usb_state == ZMK_USB_CONN_NONE ) { // disconnected
394
- status_pixels [DT_PROP (UNDERGLOW_INDICATORS , usb_state )] = lilac ;
386
+ if (DT_PROP (UNDERGLOW_INDICATORS , usb_state ) != -1 ) {
387
+ enum zmk_usb_conn_state usb_state = zmk_usb_get_conn_state ();
388
+ if (usb_state == ZMK_USB_CONN_HID &&
389
+ active_endpoint .transport == ZMK_TRANSPORT_USB ) { // connected AND active
390
+ status_pixels [DT_PROP (UNDERGLOW_INDICATORS , usb_state )] = white ;
391
+ } else if (usb_state == ZMK_USB_CONN_HID ) { // connected
392
+ status_pixels [DT_PROP (UNDERGLOW_INDICATORS , usb_state )] = dull_green ;
393
+ } else if (usb_state == ZMK_USB_CONN_POWERED ) { // powered
394
+ status_pixels [DT_PROP (UNDERGLOW_INDICATORS , usb_state )] = red ;
395
+ } else if (usb_state == ZMK_USB_CONN_NONE ) { // disconnected
396
+ status_pixels [DT_PROP (UNDERGLOW_INDICATORS , usb_state )] = lilac ;
397
+ }
395
398
}
399
+ #endif
396
400
397
401
int16_t blend = 256 ;
398
402
if (state .status_animation_step < (500 / 25 )) {
0 commit comments