mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-19 04:44:47 -07:00
End of static colors settings, next rainbow
This commit is contained in:
@@ -28,6 +28,20 @@
|
|||||||
|
|
||||||
#define TAG "RGB_BACKLIGHT_SRV"
|
#define TAG "RGB_BACKLIGHT_SRV"
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
char* name;
|
||||||
|
uint8_t red;
|
||||||
|
uint8_t green;
|
||||||
|
uint8_t blue;
|
||||||
|
} RGBBacklightColor;
|
||||||
|
|
||||||
|
//use one type RGBBacklightColor for current_leds_settings and for static colors definition
|
||||||
|
static RGBBacklightColor current_led [] = {
|
||||||
|
{"LED0",255,60,0},
|
||||||
|
{"LED1",255,60,0},
|
||||||
|
{"LED2",255,60,0},
|
||||||
|
};
|
||||||
|
|
||||||
static const RGBBacklightColor colors[] = {
|
static const RGBBacklightColor colors[] = {
|
||||||
{"Orange", 255, 60, 0},
|
{"Orange", 255, 60, 0},
|
||||||
{"Yellow", 255, 144, 0},
|
{"Yellow", 255, 144, 0},
|
||||||
@@ -42,7 +56,7 @@ static const RGBBacklightColor colors[] = {
|
|||||||
{"Pink", 255, 0, 127},
|
{"Pink", 255, 0, 127},
|
||||||
{"Red", 255, 0, 0},
|
{"Red", 255, 0, 0},
|
||||||
{"White", 254, 210, 200},
|
{"White", 254, 210, 200},
|
||||||
{"White1", 255, 255, 255},
|
{"OFF", 0, 0, 0},
|
||||||
};
|
};
|
||||||
|
|
||||||
uint8_t rgb_backlight_get_color_count(void) {
|
uint8_t rgb_backlight_get_color_count(void) {
|
||||||
@@ -54,47 +68,43 @@ const char* rgb_backlight_get_color_text(uint8_t index) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// use RECORD for acces to rgb service instance and update current colors by static
|
// use RECORD for acces to rgb service instance and update current colors by static
|
||||||
void rgb_backlight_set_static_color(uint8_t index, uint8_t vd) {
|
void rgb_backlight_set_led_static_color(uint8_t led, uint8_t index) {
|
||||||
RGBBacklightApp* app = furi_record_open(RECORD_RGB_BACKLIGHT);
|
// RGBBacklightApp* app = furi_record_open(RECORD_RGB_BACKLIGHT);
|
||||||
|
// float brightness = app->settings->brightness;
|
||||||
|
|
||||||
if(vd < SK6805_get_led_count()) {
|
if(led < SK6805_get_led_count()) {
|
||||||
uint8_t r = colors[index].red;
|
uint8_t r = colors[index].red;
|
||||||
uint8_t g = colors[index].green;
|
uint8_t g = colors[index].green;
|
||||||
uint8_t b = colors[index].blue;
|
uint8_t b = colors[index].blue;
|
||||||
SK6805_set_led_color(vd, r, g, b);
|
|
||||||
SK6805_update();
|
current_led[led].red = r;
|
||||||
|
current_led[led].green =g;
|
||||||
|
current_led[led].blue = b;
|
||||||
|
|
||||||
|
SK6805_set_led_color(led, r, g, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
//if user select "custom" value then set current colors by custom values
|
// furi_record_close(RECORD_RGB_BACKLIGHT);
|
||||||
if(index == 13) {
|
|
||||||
app->current_red = app->settings->custom_red;
|
|
||||||
app->current_green = app->settings->custom_green;
|
|
||||||
app->current_blue = app->settings->custom_blue;
|
|
||||||
} else {
|
|
||||||
app->current_red = colors[index].red;
|
|
||||||
app->current_green = colors[index].green;
|
|
||||||
app->current_blue = colors[index].blue;
|
|
||||||
}
|
|
||||||
furi_record_close(RECORD_RGB_BACKLIGHT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// use RECORD for acces to rgb service instance and update current colors by custom
|
// use RECORD for acces to rgb service instance and update current colors by custom
|
||||||
void rgb_backlight_set_custom_color(uint8_t red, uint8_t green, uint8_t blue) {
|
// void rgb_backlight_set_custom_color(uint8_t red, uint8_t green, uint8_t blue) {
|
||||||
RGBBacklightApp* app = furi_record_open(RECORD_RGB_BACKLIGHT);
|
// RGBBacklightApp* app = furi_record_open(RECORD_RGB_BACKLIGHT);
|
||||||
app->current_red = red;
|
// app->current_red = red;
|
||||||
app->current_green = green;
|
// app->current_green = green;
|
||||||
app->current_blue = blue;
|
// app->current_blue = blue;
|
||||||
furi_record_close(RECORD_RGB_BACKLIGHT);
|
// furi_record_close(RECORD_RGB_BACKLIGHT);
|
||||||
}
|
// }
|
||||||
|
|
||||||
// use RECORD for acces to rgb service instance, use current_* colors and update backlight
|
// use RECORD for acces to rgb service instance, use current_* colors and update backlight
|
||||||
void rgb_backlight_update(float brightness) {
|
void rgb_backlight_update(float brightness) {
|
||||||
RGBBacklightApp* app = furi_record_open(RECORD_RGB_BACKLIGHT);
|
RGBBacklightApp* app = furi_record_open(RECORD_RGB_BACKLIGHT);
|
||||||
if(app->settings->rgb_backlight_mode > 0) {
|
|
||||||
|
if(app->settings->rgb_backlight_installed) {
|
||||||
for(uint8_t i = 0; i < SK6805_get_led_count(); i++) {
|
for(uint8_t i = 0; i < SK6805_get_led_count(); i++) {
|
||||||
uint8_t r = app->current_red * (brightness / 1.0f);
|
uint8_t r = current_led[i].red * (brightness * 1.0f);
|
||||||
uint8_t g = app->current_green * (brightness / 1.0f);
|
uint8_t g = current_led[i].green * (brightness * 1.0f);
|
||||||
uint8_t b = app->current_blue * (brightness / 1.0f);
|
uint8_t b = current_led[i].blue * (brightness * 1.0f);
|
||||||
SK6805_set_led_color(i, r, g, b);
|
SK6805_set_led_color(i, r, g, b);
|
||||||
}
|
}
|
||||||
SK6805_update();
|
SK6805_update();
|
||||||
@@ -126,59 +136,14 @@ static void rainbow_timer_callback(void* context) {
|
|||||||
furi_assert(context);
|
furi_assert(context);
|
||||||
RGBBacklightApp* app = context;
|
RGBBacklightApp* app = context;
|
||||||
|
|
||||||
// if rainbow_mode is rainbow do rainbow effect
|
if (app->settings->rgb_backlight_installed) {
|
||||||
if(app->settings->rainbow_mode == 1) {
|
switch(app->settings->rainbow_mode) {
|
||||||
switch(app->rainbow_stage) {
|
case 1:
|
||||||
// from red to yellow (255,0,0) - (255,255,0)
|
break;
|
||||||
case 1:
|
case 2:
|
||||||
app->current_green += app->settings->rainbow_step;
|
break;
|
||||||
if(app->current_green >= 255) {
|
default:
|
||||||
app->current_green = 255;
|
break;
|
||||||
app->rainbow_stage++;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
// yellow to green (255,255,0) - (0,255,0)
|
|
||||||
case 2:
|
|
||||||
app->current_red -= app->settings->rainbow_step;
|
|
||||||
if(app->current_red <= 0) {
|
|
||||||
app->current_red = 0;
|
|
||||||
app->rainbow_stage++;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
// from green to light blue (0,255,0) - (0,255,255)
|
|
||||||
case 3:
|
|
||||||
app->current_blue += app->settings->rainbow_step;
|
|
||||||
if(app->current_blue >= 255) {
|
|
||||||
app->current_blue = 255;
|
|
||||||
app->rainbow_stage++;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
//from light blue to blue (0,255,255) - (0,0,255)
|
|
||||||
case 4:
|
|
||||||
app->current_green -= app->settings->rainbow_step;
|
|
||||||
if(app->current_green <= 0) {
|
|
||||||
app->current_green = 0;
|
|
||||||
app->rainbow_stage++;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
//from blue to violet (0,0,255) - (255,0,255)
|
|
||||||
case 5:
|
|
||||||
app->current_red += app->settings->rainbow_step;
|
|
||||||
if(app->current_red >= 255) {
|
|
||||||
app->current_red = 255;
|
|
||||||
app->rainbow_stage++;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
//from violet to red (255,0,255) - (255,0,0)
|
|
||||||
case 6:
|
|
||||||
app->current_blue -= app->settings->rainbow_step;
|
|
||||||
if(app->current_blue <= 0) {
|
|
||||||
app->current_blue = 0;
|
|
||||||
app->rainbow_stage = 1;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
rgb_backlight_update(app->settings->brightness);
|
rgb_backlight_update(app->settings->brightness);
|
||||||
}
|
}
|
||||||
@@ -186,6 +151,7 @@ static void rainbow_timer_callback(void* context) {
|
|||||||
// if rainbow_mode is ..... do another effect
|
// if rainbow_mode is ..... do another effect
|
||||||
// if(app->settings.rainbow_mode == ...) {
|
// if(app->settings.rainbow_mode == ...) {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t rgb_backlight_srv(void* p) {
|
int32_t rgb_backlight_srv(void* p) {
|
||||||
@@ -202,40 +168,33 @@ int32_t rgb_backlight_srv(void* p) {
|
|||||||
app->settings = malloc(sizeof(RGBBacklightSettings));
|
app->settings = malloc(sizeof(RGBBacklightSettings));
|
||||||
rgb_backlight_settings_load(app->settings);
|
rgb_backlight_settings_load(app->settings);
|
||||||
|
|
||||||
// Init app variables
|
|
||||||
app->rainbow_stage = 1;
|
|
||||||
|
|
||||||
furi_record_create(RECORD_RGB_BACKLIGHT, app);
|
furi_record_create(RECORD_RGB_BACKLIGHT, app);
|
||||||
|
|
||||||
// if rgb mod installed - start rainbow or set static color from settings (default index = 0)
|
//if rgb_backlight_installed then start rainbow or set leds colors from saved settings (default index = 0)
|
||||||
//
|
if(app->settings->rgb_backlight_installed) {
|
||||||
// TODO запуск сохраненного режима
|
if(app->settings->rainbow_mode > 0) {
|
||||||
if(app->settings->rgb_backlight_mode > 0) {
|
// rainbow_timer_starter(app);
|
||||||
// if(app->settings->rainbow_mode > 0) {
|
} else {
|
||||||
// rainbow_timer_starter(app);
|
rgb_backlight_set_led_static_color (2,app->settings->led_2_color_index);
|
||||||
// } else {
|
rgb_backlight_set_led_static_color (1,app->settings->led_1_color_index);
|
||||||
// rgb_backlight_set_static_color(app->settings->static_color_index);
|
rgb_backlight_set_led_static_color (0,app->settings->led_0_color_index);
|
||||||
// rgb_backlight_update(app->settings->brightness);
|
rgb_backlight_update (app->settings->brightness);
|
||||||
// }
|
|
||||||
// if rgb mode = 0 (rgb_backlight not installed) then set default static orange color (index=0) and light on default color
|
|
||||||
} else {
|
|
||||||
rgb_backlight_set_static_color(0);
|
|
||||||
for(uint8_t i = 0; i < SK6805_get_led_count(); i++) {
|
|
||||||
uint8_t r = app->current_red * 1.0f;
|
|
||||||
uint8_t g = app->current_green * 1.0f;
|
|
||||||
uint8_t b = app->current_blue * 1.0f;
|
|
||||||
SK6805_set_led_color(i, r, g, b);
|
|
||||||
}
|
}
|
||||||
|
// if rgb_backlight not installed then set default static orange color(index=0) to all leds (0-2) and force light on
|
||||||
|
} else {
|
||||||
|
rgb_backlight_set_led_static_color (2,0);
|
||||||
|
rgb_backlight_set_led_static_color (1,0);
|
||||||
|
rgb_backlight_set_led_static_color (0,0);
|
||||||
SK6805_update();
|
SK6805_update();
|
||||||
}
|
}
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
// place for message queue and other future options
|
// place for message queue and other future options
|
||||||
furi_delay_ms(5000);
|
furi_delay_ms (5000);
|
||||||
if(app->settings->rgb_backlight_mode > 0) {
|
if(app->settings->rgb_backlight_installed) {
|
||||||
FURI_LOG_D(TAG, "Mod is enabled - serivce is running");
|
FURI_LOG_D(TAG, "RGB backlight enabled - serivce is running");
|
||||||
} else {
|
} else {
|
||||||
FURI_LOG_D(TAG, "Mod is DISABLED - serivce is running");
|
FURI_LOG_D(TAG, "RGB backlight DISABLED - serivce is running");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -26,20 +26,12 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
char* name;
|
|
||||||
uint8_t red;
|
|
||||||
uint8_t green;
|
|
||||||
uint8_t blue;
|
|
||||||
} RGBBacklightColor;
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
FuriTimer* rainbow_timer;
|
FuriTimer* rainbow_timer;
|
||||||
|
|
||||||
int16_t current_red;
|
// int16_t current_red;
|
||||||
int16_t current_green;
|
// int16_t current_green;
|
||||||
int16_t current_blue;
|
// int16_t current_blue;
|
||||||
uint8_t rainbow_stage;
|
|
||||||
|
|
||||||
RGBBacklightSettings* settings;
|
RGBBacklightSettings* settings;
|
||||||
|
|
||||||
@@ -48,8 +40,8 @@ typedef struct {
|
|||||||
#define RECORD_RGB_BACKLIGHT "rgb_backlight"
|
#define RECORD_RGB_BACKLIGHT "rgb_backlight"
|
||||||
|
|
||||||
void rgb_backlight_update(float brightness);
|
void rgb_backlight_update(float brightness);
|
||||||
void rgb_backlight_set_custom_color(uint8_t red, uint8_t green, uint8_t blue);
|
// void rgb_backlight_set_custom_color(uint8_t red, uint8_t green, uint8_t blue);
|
||||||
void rgb_backlight_set_static_color(uint8_t index);
|
void rgb_backlight_set_led_static_color(uint8_t led, uint8_t index);
|
||||||
void rainbow_timer_stop(RGBBacklightApp* app);
|
void rainbow_timer_stop(RGBBacklightApp* app);
|
||||||
void rainbow_timer_start(RGBBacklightApp* app);
|
void rainbow_timer_start(RGBBacklightApp* app);
|
||||||
void rainbow_timer_starter(RGBBacklightApp* app);
|
void rainbow_timer_starter(RGBBacklightApp* app);
|
||||||
|
|||||||
@@ -16,19 +16,13 @@
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
//Common settings
|
//Common settings
|
||||||
uint8_t version;
|
uint8_t version;
|
||||||
bool rgb_backlight_installed;
|
uint8_t rgb_backlight_installed;
|
||||||
float brightness;
|
float brightness;
|
||||||
|
|
||||||
//static and custom colors mode settings
|
|
||||||
uint8_t static_color_index;
|
|
||||||
uint8_t custom_red;
|
|
||||||
uint8_t custom_green;
|
|
||||||
uint8_t custom_blue;
|
|
||||||
|
|
||||||
// static gradient mode settings
|
// static gradient mode settings
|
||||||
uint8_t static_vd1_index;
|
uint8_t led_2_color_index;
|
||||||
uint8_t static_vd2_index;
|
uint8_t led_1_color_index;
|
||||||
uint8_t static_vd3_index;
|
uint8_t led_0_color_index;
|
||||||
|
|
||||||
// rainbow mode setings
|
// rainbow mode setings
|
||||||
uint32_t rainbow_mode;
|
uint32_t rainbow_mode;
|
||||||
@@ -88,9 +82,6 @@ void rgb_backlight_settings_load(RGBBacklightSettings* settings) {
|
|||||||
settings->brightness = 1.0f;
|
settings->brightness = 1.0f;
|
||||||
settings->rainbow_speed_ms = 100;
|
settings->rainbow_speed_ms = 100;
|
||||||
settings->rainbow_step = 1;
|
settings->rainbow_step = 1;
|
||||||
settings->custom_red=255;
|
|
||||||
settings->custom_green = 255;
|
|
||||||
settings->custom_blue=255;
|
|
||||||
rgb_backlight_settings_save(settings);
|
rgb_backlight_settings_save(settings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ typedef struct {
|
|||||||
float brightness;
|
float brightness;
|
||||||
|
|
||||||
// static gradient mode settings
|
// static gradient mode settings
|
||||||
uint8_t static_vd1_index;
|
uint8_t led_2_color_index;
|
||||||
uint8_t static_vd2_index;
|
uint8_t led_1_color_index;
|
||||||
uint8_t static_vd3_index;
|
uint8_t led_0_color_index;
|
||||||
|
|
||||||
// rainbow mode setings
|
// rainbow mode setings
|
||||||
uint32_t rainbow_mode;
|
uint32_t rainbow_mode;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ typedef struct {
|
|||||||
VariableItemList* variable_item_list_rgb;
|
VariableItemList* variable_item_list_rgb;
|
||||||
} NotificationAppSettings;
|
} NotificationAppSettings;
|
||||||
|
|
||||||
static VariableItem* temp_item;
|
//static VariableItem* temp_item;
|
||||||
|
|
||||||
static const NotificationSequence sequence_note_c = {
|
static const NotificationSequence sequence_note_c = {
|
||||||
&message_note_c5,
|
&message_note_c5,
|
||||||
@@ -236,12 +236,33 @@ static void rgb_backlight_installed_changed(VariableItem* item) {
|
|||||||
variable_item_set_current_value_text(item, rgb_backlight_installed_text[index]);
|
variable_item_set_current_value_text(item, rgb_backlight_installed_text[index]);
|
||||||
app->notification->rgb_srv->settings->rgb_backlight_installed = rgb_backlight_installed_value[index];
|
app->notification->rgb_srv->settings->rgb_backlight_installed = rgb_backlight_installed_value[index];
|
||||||
rgb_backlight_settings_save(app->notification->rgb_srv->settings);
|
rgb_backlight_settings_save(app->notification->rgb_srv->settings);
|
||||||
|
|
||||||
|
// In case of user playing with rgb_backlight_installed swith:
|
||||||
|
// if user swith_off rgb_backlight_installed then force set default orange color
|
||||||
|
if (index == 0) {
|
||||||
|
rgb_backlight_set_led_static_color (2,0);
|
||||||
|
rgb_backlight_set_led_static_color (1,0);
|
||||||
|
rgb_backlight_set_led_static_color (0,0);
|
||||||
|
SK6805_update();
|
||||||
|
// if user swith_on rgb_backlight_installed then start rainbow if its ON or set saved static colors
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (app->notification->rgb_srv->settings->rainbow_mode >0) {
|
||||||
|
rainbow_timer_starter (app->notification->rgb_srv);
|
||||||
|
} else {
|
||||||
|
rgb_backlight_set_led_static_color (2,app->notification->rgb_srv->settings->led_2_color_index);
|
||||||
|
rgb_backlight_set_led_static_color (1,app->notification->rgb_srv->settings->led_1_color_index);
|
||||||
|
rgb_backlight_set_led_static_color (0,app->notification->rgb_srv->settings->led_0_color_index);
|
||||||
|
rgb_backlight_update (app->notification->settings.display_brightness);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Lock/Unlock all rgb settings depent from rgb_backlight_installed switch
|
// Lock/Unlock all rgb settings depent from rgb_backlight_installed switch
|
||||||
int slide = 0;
|
int slide = 0;
|
||||||
if(furi_hal_rtc_is_flag_set(FuriHalRtcFlagDebug)) {
|
if(furi_hal_rtc_is_flag_set(FuriHalRtcFlagDebug)) {
|
||||||
slide = 1;
|
slide = 1;
|
||||||
}
|
}
|
||||||
for(int i = slide; i < (slide + 7); i++) {
|
for(int i = slide; i < (slide + 6); i++) {
|
||||||
VariableItem* t_item = variable_item_list_get(app->variable_item_list_rgb, i);
|
VariableItem* t_item = variable_item_list_get(app->variable_item_list_rgb, i);
|
||||||
if(index == 0) {
|
if(index == 0) {
|
||||||
variable_item_set_locked(t_item, true, "RGB\nOFF!");
|
variable_item_set_locked(t_item, true, "RGB\nOFF!");
|
||||||
@@ -251,6 +272,54 @@ static void rgb_backlight_installed_changed(VariableItem* item) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void led_2_color_changed(VariableItem* item) {
|
||||||
|
NotificationAppSettings* app = variable_item_get_context(item);
|
||||||
|
uint8_t index = variable_item_get_current_value_index(item);
|
||||||
|
|
||||||
|
variable_item_set_current_value_text(item, rgb_backlight_get_color_text(index));
|
||||||
|
app->notification->rgb_srv->settings->led_2_color_index = index;
|
||||||
|
|
||||||
|
rgb_backlight_set_led_static_color(2,index);
|
||||||
|
rgb_backlight_update(app->notification->rgb_srv->settings->brightness);
|
||||||
|
|
||||||
|
// dont update display color if rainbow working
|
||||||
|
if (!furi_timer_is_running(app->notification->rgb_srv->rainbow_timer)) {
|
||||||
|
rgb_backlight_settings_save(app->notification->rgb_srv->settings);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void led_1_color_changed(VariableItem* item) {
|
||||||
|
NotificationAppSettings* app = variable_item_get_context(item);
|
||||||
|
uint8_t index = variable_item_get_current_value_index(item);
|
||||||
|
|
||||||
|
variable_item_set_current_value_text(item, rgb_backlight_get_color_text(index));
|
||||||
|
app->notification->rgb_srv->settings->led_1_color_index = index;
|
||||||
|
|
||||||
|
rgb_backlight_set_led_static_color(1,index);
|
||||||
|
rgb_backlight_settings_save(app->notification->rgb_srv->settings);
|
||||||
|
|
||||||
|
// dont update display color if rainbow working
|
||||||
|
if (!furi_timer_is_running(app->notification->rgb_srv->rainbow_timer)) {
|
||||||
|
rgb_backlight_settings_save(app->notification->rgb_srv->settings);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void led_0_color_changed(VariableItem* item) {
|
||||||
|
NotificationAppSettings* app = variable_item_get_context(item);
|
||||||
|
uint8_t index = variable_item_get_current_value_index(item);
|
||||||
|
|
||||||
|
variable_item_set_current_value_text(item, rgb_backlight_get_color_text(index));
|
||||||
|
app->notification->rgb_srv->settings->led_0_color_index = index;
|
||||||
|
|
||||||
|
rgb_backlight_set_led_static_color(0,index);
|
||||||
|
rgb_backlight_settings_save(app->notification->rgb_srv->settings);
|
||||||
|
|
||||||
|
// dont update display color if rainbow working
|
||||||
|
if (!furi_timer_is_running(app->notification->rgb_srv->rainbow_timer)) {
|
||||||
|
rgb_backlight_settings_save(app->notification->rgb_srv->settings);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void rgb_backlight_rainbow_changed(VariableItem* item) {
|
static void rgb_backlight_rainbow_changed(VariableItem* item) {
|
||||||
NotificationAppSettings* app = variable_item_get_context(item);
|
NotificationAppSettings* app = variable_item_get_context(item);
|
||||||
uint8_t index = variable_item_get_current_value_index(item);
|
uint8_t index = variable_item_get_current_value_index(item);
|
||||||
@@ -263,7 +332,9 @@ static void rgb_backlight_rainbow_changed(VariableItem* item) {
|
|||||||
|
|
||||||
// restore saved rgb backlight settings if we switch_off rainbow mode
|
// restore saved rgb backlight settings if we switch_off rainbow mode
|
||||||
if(app->notification->rgb_srv->settings->rainbow_mode == 0) {
|
if(app->notification->rgb_srv->settings->rainbow_mode == 0) {
|
||||||
rgb_backlight_set_static_color(app->notification->rgb_srv->settings->static_color_index);
|
rgb_backlight_set_led_static_color (2,app->notification->rgb_srv->settings->led_2_color_index);
|
||||||
|
rgb_backlight_set_led_static_color (1,app->notification->rgb_srv->settings->led_1_color_index);
|
||||||
|
rgb_backlight_set_led_static_color (0,app->notification->rgb_srv->settings->led_0_color_index);
|
||||||
rgb_backlight_update(app->notification->rgb_srv->settings->brightness);
|
rgb_backlight_update(app->notification->rgb_srv->settings->brightness);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -292,42 +363,6 @@ static void rgb_backlight_rainbow_step_changed(VariableItem* item) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void vd1_color_changed(VariableItem* item) {
|
|
||||||
NotificationAppSettings* app = variable_item_get_context(item);
|
|
||||||
uint8_t index = variable_item_get_current_value_index(item);
|
|
||||||
|
|
||||||
variable_item_set_current_value_text(item, rgb_backlight_get_color_text(index));
|
|
||||||
app->notification->rgb_srv->settings->static_color_index = index;
|
|
||||||
|
|
||||||
rgb_backlight_set_static_color(index);
|
|
||||||
rgb_backlight_update(app->notification->rgb_srv->settings->brightness);
|
|
||||||
rgb_backlight_settings_save(app->notification->rgb_srv->settings);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void vd2_color_changed(VariableItem* item) {
|
|
||||||
NotificationAppSettings* app = variable_item_get_context(item);
|
|
||||||
uint8_t index = variable_item_get_current_value_index(item);
|
|
||||||
|
|
||||||
variable_item_set_current_value_text(item, rgb_backlight_get_color_text(index));
|
|
||||||
app->notification->rgb_srv->settings->static_color_index = index;
|
|
||||||
|
|
||||||
rgb_backlight_set_static_color(index);
|
|
||||||
rgb_backlight_update(app->notification->rgb_srv->settings->brightness);
|
|
||||||
rgb_backlight_settings_save(app->notification->rgb_srv->settings);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void vd3_color_changed(VariableItem* item) {
|
|
||||||
NotificationAppSettings* app = variable_item_get_context(item);
|
|
||||||
uint8_t index = variable_item_get_current_value_index(item);
|
|
||||||
|
|
||||||
variable_item_set_current_value_text(item, rgb_backlight_get_color_text(index));
|
|
||||||
app->notification->rgb_srv->settings->static_color_index = index;
|
|
||||||
|
|
||||||
rgb_backlight_set_static_color(index);
|
|
||||||
rgb_backlight_update(app->notification->rgb_srv->settings->brightness);
|
|
||||||
rgb_backlight_settings_save(app->notification->rgb_srv->settings);
|
|
||||||
}
|
|
||||||
|
|
||||||
// open rgb_settings_view if user press OK on first (index=0) menu string and (debug mode or rgb_backlight_installed is true)
|
// open rgb_settings_view if user press OK on first (index=0) menu string and (debug mode or rgb_backlight_installed is true)
|
||||||
void variable_item_list_enter_callback(void* context, uint32_t index) {
|
void variable_item_list_enter_callback(void* context, uint32_t index) {
|
||||||
UNUSED(context);
|
UNUSED(context);
|
||||||
@@ -458,38 +493,50 @@ static NotificationAppSettings* alloc_settings(void) {
|
|||||||
variable_item_set_current_value_text(item, rgb_backlight_installed_text[value_index]);
|
variable_item_set_current_value_text(item, rgb_backlight_installed_text[value_index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// vd1 color
|
// led_1 color
|
||||||
item = variable_item_list_add(
|
item = variable_item_list_add(
|
||||||
app->variable_item_list_rgb,
|
app->variable_item_list_rgb,
|
||||||
"VD1 Color",
|
"LED 1 Color",
|
||||||
rgb_backlight_get_color_count(),
|
rgb_backlight_get_color_count(),
|
||||||
vd1_color_changed,
|
led_2_color_changed,
|
||||||
app);
|
app);
|
||||||
value_index = app->notification->rgb_srv->settings->static_color_index;
|
value_index = app->notification->rgb_srv->settings->led_2_color_index;
|
||||||
variable_item_set_current_value_index(item, value_index);
|
variable_item_set_current_value_index(item, value_index);
|
||||||
variable_item_set_current_value_text(item, rgb_backlight_get_color_text(value_index));
|
variable_item_set_current_value_text(item, rgb_backlight_get_color_text(value_index));
|
||||||
|
variable_item_set_locked(
|
||||||
|
item,
|
||||||
|
(app->notification->rgb_srv->settings->rgb_backlight_installed == 0),
|
||||||
|
"RGB MOD \nOFF!");
|
||||||
|
|
||||||
// vd2 color
|
// led_2 color
|
||||||
item = variable_item_list_add(
|
item = variable_item_list_add(
|
||||||
app->variable_item_list_rgb,
|
app->variable_item_list_rgb,
|
||||||
"VD2 Color",
|
"LED 2 Color",
|
||||||
rgb_backlight_get_color_count(),
|
rgb_backlight_get_color_count(),
|
||||||
vd2_color_changed,
|
led_1_color_changed,
|
||||||
app);
|
app);
|
||||||
value_index = app->notification->rgb_srv->settings->static_color_index;
|
value_index = app->notification->rgb_srv->settings->led_1_color_index;
|
||||||
variable_item_set_current_value_index(item, value_index);
|
variable_item_set_current_value_index(item, value_index);
|
||||||
variable_item_set_current_value_text(item, rgb_backlight_get_color_text(value_index));
|
variable_item_set_current_value_text(item, rgb_backlight_get_color_text(value_index));
|
||||||
|
variable_item_set_locked(
|
||||||
|
item,
|
||||||
|
(app->notification->rgb_srv->settings->rgb_backlight_installed == 0),
|
||||||
|
"RGB MOD \nOFF!");
|
||||||
|
|
||||||
// vd 3 color
|
// led 3 color
|
||||||
item = variable_item_list_add(
|
item = variable_item_list_add(
|
||||||
app->variable_item_list_rgb,
|
app->variable_item_list_rgb,
|
||||||
"VD3 Color",
|
"LED 3 Color",
|
||||||
rgb_backlight_get_color_count(),
|
rgb_backlight_get_color_count(),
|
||||||
vd3_color_changed,
|
led_0_color_changed,
|
||||||
app);
|
app);
|
||||||
value_index = app->notification->rgb_srv->settings->static_color_index;
|
value_index = app->notification->rgb_srv->settings->led_0_color_index;
|
||||||
variable_item_set_current_value_index(item, value_index);
|
variable_item_set_current_value_index(item, value_index);
|
||||||
variable_item_set_current_value_text(item, rgb_backlight_get_color_text(value_index));
|
variable_item_set_current_value_text(item, rgb_backlight_get_color_text(value_index));
|
||||||
|
variable_item_set_locked(
|
||||||
|
item,
|
||||||
|
(app->notification->rgb_srv->settings->rgb_backlight_installed == 0),
|
||||||
|
"RGB MOD \nOFF!");
|
||||||
|
|
||||||
// Rainbow mode
|
// Rainbow mode
|
||||||
item = variable_item_list_add(
|
item = variable_item_list_add(
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
entry,status,name,type,params
|
entry,status,name,type,params
|
||||||
Version,+,83.1,,
|
Version,+,86.0,,
|
||||||
Header,+,applications/drivers/subghz/cc1101_ext/cc1101_ext_interconnect.h,,
|
Header,+,applications/drivers/subghz/cc1101_ext/cc1101_ext_interconnect.h,,
|
||||||
Header,+,applications/services/bt/bt_service/bt.h,,
|
Header,+,applications/services/bt/bt_service/bt.h,,
|
||||||
Header,+,applications/services/bt/bt_service/bt_keys_storage.h,,
|
Header,+,applications/services/bt/bt_service/bt_keys_storage.h,,
|
||||||
@@ -3148,8 +3148,7 @@ Function,-,renameat,int,"int, const char*, int, const char*"
|
|||||||
Function,-,rewind,void,FILE*
|
Function,-,rewind,void,FILE*
|
||||||
Function,+,rgb_backlight_get_color_count,uint8_t,
|
Function,+,rgb_backlight_get_color_count,uint8_t,
|
||||||
Function,+,rgb_backlight_get_color_text,const char*,uint8_t
|
Function,+,rgb_backlight_get_color_text,const char*,uint8_t
|
||||||
Function,+,rgb_backlight_set_custom_color,void,"uint8_t, uint8_t, uint8_t"
|
Function,+,rgb_backlight_set_led_static_color,void,"uint8_t, uint8_t"
|
||||||
Function,+,rgb_backlight_set_static_color,void,uint8_t
|
|
||||||
Function,+,rgb_backlight_settings_load,void,RGBBacklightSettings*
|
Function,+,rgb_backlight_settings_load,void,RGBBacklightSettings*
|
||||||
Function,+,rgb_backlight_settings_save,void,const RGBBacklightSettings*
|
Function,+,rgb_backlight_settings_save,void,const RGBBacklightSettings*
|
||||||
Function,+,rgb_backlight_update,void,float
|
Function,+,rgb_backlight_update,void,float
|
||||||
|
|||||||
|
Reference in New Issue
Block a user