@@ -175,6 +175,16 @@ const uint32_t rgb_backlight_rainbow_wide_value[RGB_BACKLIGHT_RAINBOW_WIDE_COUNT
175175 50 ,
176176};
177177
178+ #define RGB_BACKLIGHT_INDIVIDUAL_LED_COUNT 2
179+ const char * const rgb_backlight_individual_led_text [RGB_BACKLIGHT_INDIVIDUAL_LED_COUNT ] = {
180+ "OFF" ,
181+ "ON" ,
182+ };
183+ const bool rgb_backlight_individual_value [RGB_BACKLIGHT_INDIVIDUAL_LED_COUNT ] = {
184+ false,
185+ true,
186+ };
187+
178188typedef enum {
179189 MainViewId ,
180190 RGBViewId ,
@@ -291,7 +301,7 @@ static void rgb_backlight_installed_changed(VariableItem* item) {
291301 if (furi_hal_rtc_is_flag_set (FuriHalRtcFlagDebug )) {
292302 slide = 1 ;
293303 }
294- for (int i = slide ; i < (slide + 8 ); i ++ ) {
304+ for (int i = slide ; i < (slide + 9 ); i ++ ) {
295305 VariableItem * t_item = variable_item_list_get (app -> variable_item_list_rgb , i );
296306 if (index == 0 ) {
297307 variable_item_set_locked (t_item , true, "RGB\nOFF!" );
@@ -301,6 +311,32 @@ static void rgb_backlight_installed_changed(VariableItem* item) {
301311 }
302312}
303313
314+ static void individual_led_changed (VariableItem * item ){
315+ NotificationAppSettings * app = variable_item_get_context (item );
316+ uint8_t index = variable_item_get_current_value_index (item );
317+
318+ variable_item_set_current_value_text (item ,rgb_backlight_individual_led_text [index ]);
319+ app -> notification -> rgb_srv -> settings -> individual_led = index ;
320+
321+ // if individual led OFF - set led0 and led1 colors indexes as led2 index
322+ if (index == 0 ) {
323+ app -> notification -> rgb_srv -> settings -> led_1_color_index = app -> notification -> rgb_srv -> settings -> led_2_color_index ;
324+ app -> notification -> rgb_srv -> settings -> led_0_color_index = app -> notification -> rgb_srv -> settings -> led_2_color_index ;
325+ }
326+
327+ // enable/disable led0 and led1 color settings
328+ for (int i = 2 ; i < 4 ; i ++ ) {
329+ VariableItem * t_item = variable_item_list_get (app -> variable_item_list_rgb , i );
330+ if (index == 0 ) {
331+ variable_item_set_locked (t_item , true, "Individual\nleds OFF!" );
332+ } else {
333+ variable_item_set_locked (t_item , false, "Individual\nleds OFF!" );
334+ }
335+ }
336+ rgb_backlight_update (app -> notification -> rgb_srv -> settings -> brightness );
337+ //rgb_backlight_settings_save(app->notification->rgb_srv->settings);
338+ }
339+
304340static void led_2_color_changed (VariableItem * item ) {
305341 NotificationAppSettings * app = variable_item_get_context (item );
306342 uint8_t index = variable_item_get_current_value_index (item );
@@ -550,6 +586,22 @@ static NotificationAppSettings* alloc_settings(void) {
550586 }
551587
552588 // We (humans) are numbering LEDs from left to right as 1..3, but hardware have another order from right to left 2..0
589+
590+ // Individual led color switch
591+ item = variable_item_list_add (
592+ app -> variable_item_list_rgb ,
593+ "Individual leds colors" ,
594+ RGB_BACKLIGHT_INDIVIDUAL_LED_COUNT ,
595+ individual_led_changed ,
596+ app );
597+ value_index = app -> notification -> rgb_srv -> settings -> individual_led ;
598+ variable_item_set_current_value_index (item , value_index );
599+ variable_item_set_current_value_text (item , rgb_backlight_individual_led_text [value_index ]);
600+ variable_item_set_locked (
601+ item ,
602+ (app -> notification -> rgb_srv -> settings -> rgb_backlight_installed == 0 ),
603+ "RGB MOD \nOFF!" );
604+
553605 // led_1 color
554606 item = variable_item_list_add (
555607 app -> variable_item_list_rgb ,
@@ -579,6 +631,10 @@ static NotificationAppSettings* alloc_settings(void) {
579631 item ,
580632 (app -> notification -> rgb_srv -> settings -> rgb_backlight_installed == 0 ),
581633 "RGB MOD \nOFF!" );
634+ variable_item_set_locked (
635+ item ,
636+ (!app -> notification -> rgb_srv -> settings -> individual_led ),
637+ "Individual\nleds OFF!" );
582638
583639 // led 3 color
584640 item = variable_item_list_add (
@@ -594,11 +650,15 @@ static NotificationAppSettings* alloc_settings(void) {
594650 item ,
595651 (app -> notification -> rgb_srv -> settings -> rgb_backlight_installed == 0 ),
596652 "RGB MOD \nOFF!" );
653+ variable_item_set_locked (
654+ item ,
655+ (!app -> notification -> rgb_srv -> settings -> individual_led ),
656+ "Individual\nleds OFF!" );
597657
598658 // Rainbow mode
599659 item = variable_item_list_add (
600660 app -> variable_item_list_rgb ,
601- "Rainbow mode" ,
661+ "Dynamic colors mode" ,
602662 RGB_BACKLIGHT_RAINBOW_MODE_COUNT ,
603663 rgb_backlight_rainbow_changed ,
604664 app );
@@ -615,7 +675,7 @@ static NotificationAppSettings* alloc_settings(void) {
615675
616676 item = variable_item_list_add (
617677 app -> variable_item_list_rgb ,
618- "Rainbow speed" ,
678+ "Mode speed" ,
619679 RGB_BACKLIGHT_RAINBOW_SPEED_COUNT ,
620680 rgb_backlight_rainbow_speed_changed ,
621681 app );
@@ -632,7 +692,7 @@ static NotificationAppSettings* alloc_settings(void) {
632692
633693 item = variable_item_list_add (
634694 app -> variable_item_list_rgb ,
635- "Rainbow step" ,
695+ "Colors step" ,
636696 RGB_BACKLIGHT_RAINBOW_STEP_COUNT ,
637697 rgb_backlight_rainbow_step_changed ,
638698 app );
0 commit comments