mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-20 04:54:45 -07:00
Small rgb_backlight settings menu changes
This commit is contained in:
@@ -9,8 +9,8 @@
|
|||||||
#define RGB_BACKLIGHT_SETTINGS_PATH INT_PATH(RGB_BACKLIGHT_SETTINGS_FILE_NAME)
|
#define RGB_BACKLIGHT_SETTINGS_PATH INT_PATH(RGB_BACKLIGHT_SETTINGS_FILE_NAME)
|
||||||
|
|
||||||
#define RGB_BACKLIGHT_SETTINGS_MAGIC (0x30)
|
#define RGB_BACKLIGHT_SETTINGS_MAGIC (0x30)
|
||||||
#define RGB_BACKLIGHT_SETTINGS_VER_PREV (2) // Previous version number
|
#define RGB_BACKLIGHT_SETTINGS_VER_PREV (3) // Previous version number
|
||||||
#define RGB_BACKLIGHT_SETTINGS_VER (3) // Current version number
|
#define RGB_BACKLIGHT_SETTINGS_VER (4) // Current version number
|
||||||
|
|
||||||
//pervious settings must be copyed from previous rgb_backlight_settings.h file
|
//pervious settings must be copyed from previous rgb_backlight_settings.h file
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ typedef struct {
|
|||||||
float brightness;
|
float brightness;
|
||||||
|
|
||||||
// static gradient mode settings
|
// static gradient mode settings
|
||||||
|
bool individual_led;
|
||||||
uint8_t led_2_color_index;
|
uint8_t led_2_color_index;
|
||||||
uint8_t led_1_color_index;
|
uint8_t led_1_color_index;
|
||||||
uint8_t led_0_color_index;
|
uint8_t led_0_color_index;
|
||||||
|
|||||||
@@ -175,6 +175,16 @@ const uint32_t rgb_backlight_rainbow_wide_value[RGB_BACKLIGHT_RAINBOW_WIDE_COUNT
|
|||||||
50,
|
50,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define RGB_BACKLIGHT_INDIVIDUAL_LED_COUNT 2
|
||||||
|
const char* const rgb_backlight_individual_led_text[RGB_BACKLIGHT_INDIVIDUAL_LED_COUNT] = {
|
||||||
|
"OFF",
|
||||||
|
"ON",
|
||||||
|
};
|
||||||
|
const bool rgb_backlight_individual_value[RGB_BACKLIGHT_INDIVIDUAL_LED_COUNT] = {
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
};
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
MainViewId,
|
MainViewId,
|
||||||
RGBViewId,
|
RGBViewId,
|
||||||
@@ -291,7 +301,7 @@ static void rgb_backlight_installed_changed(VariableItem* item) {
|
|||||||
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 + 8); i++) {
|
for(int i = slide; i < (slide + 9); 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!");
|
||||||
@@ -301,6 +311,32 @@ static void rgb_backlight_installed_changed(VariableItem* item) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void individual_led_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_individual_led_text[index]);
|
||||||
|
app->notification->rgb_srv->settings->individual_led = index;
|
||||||
|
|
||||||
|
// if individual led OFF - set led0 and led1 colors indexes as led2 index
|
||||||
|
if (index == 0) {
|
||||||
|
app->notification->rgb_srv->settings->led_1_color_index = app->notification->rgb_srv->settings->led_2_color_index;
|
||||||
|
app->notification->rgb_srv->settings->led_0_color_index = app->notification->rgb_srv->settings->led_2_color_index;
|
||||||
|
}
|
||||||
|
|
||||||
|
// enable/disable led0 and led1 color settings
|
||||||
|
for(int i = 2; i < 4; i++) {
|
||||||
|
VariableItem* t_item = variable_item_list_get(app->variable_item_list_rgb, i);
|
||||||
|
if(index == 0) {
|
||||||
|
variable_item_set_locked(t_item, true, "Individual\nleds OFF!");
|
||||||
|
} else {
|
||||||
|
variable_item_set_locked(t_item, false, "Individual\nleds OFF!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rgb_backlight_update(app->notification->rgb_srv->settings->brightness);
|
||||||
|
//rgb_backlight_settings_save(app->notification->rgb_srv->settings);
|
||||||
|
}
|
||||||
|
|
||||||
static void led_2_color_changed(VariableItem* item) {
|
static void led_2_color_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);
|
||||||
@@ -550,6 +586,22 @@ static NotificationAppSettings* alloc_settings(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// We (humans) are numbering LEDs from left to right as 1..3, but hardware have another order from right to left 2..0
|
// We (humans) are numbering LEDs from left to right as 1..3, but hardware have another order from right to left 2..0
|
||||||
|
|
||||||
|
// Individual led color switch
|
||||||
|
item = variable_item_list_add(
|
||||||
|
app->variable_item_list_rgb,
|
||||||
|
"Individual leds colors",
|
||||||
|
RGB_BACKLIGHT_INDIVIDUAL_LED_COUNT,
|
||||||
|
individual_led_changed,
|
||||||
|
app);
|
||||||
|
value_index = app->notification->rgb_srv->settings->individual_led;
|
||||||
|
variable_item_set_current_value_index(item, value_index);
|
||||||
|
variable_item_set_current_value_text(item, rgb_backlight_individual_led_text[value_index]);
|
||||||
|
variable_item_set_locked(
|
||||||
|
item,
|
||||||
|
(app->notification->rgb_srv->settings->rgb_backlight_installed == 0),
|
||||||
|
"RGB MOD \nOFF!");
|
||||||
|
|
||||||
// led_1 color
|
// led_1 color
|
||||||
item = variable_item_list_add(
|
item = variable_item_list_add(
|
||||||
app->variable_item_list_rgb,
|
app->variable_item_list_rgb,
|
||||||
@@ -579,6 +631,10 @@ static NotificationAppSettings* alloc_settings(void) {
|
|||||||
item,
|
item,
|
||||||
(app->notification->rgb_srv->settings->rgb_backlight_installed == 0),
|
(app->notification->rgb_srv->settings->rgb_backlight_installed == 0),
|
||||||
"RGB MOD \nOFF!");
|
"RGB MOD \nOFF!");
|
||||||
|
variable_item_set_locked(
|
||||||
|
item,
|
||||||
|
(!app->notification->rgb_srv->settings->individual_led),
|
||||||
|
"Individual\nleds OFF!");
|
||||||
|
|
||||||
// led 3 color
|
// led 3 color
|
||||||
item = variable_item_list_add(
|
item = variable_item_list_add(
|
||||||
@@ -594,11 +650,15 @@ static NotificationAppSettings* alloc_settings(void) {
|
|||||||
item,
|
item,
|
||||||
(app->notification->rgb_srv->settings->rgb_backlight_installed == 0),
|
(app->notification->rgb_srv->settings->rgb_backlight_installed == 0),
|
||||||
"RGB MOD \nOFF!");
|
"RGB MOD \nOFF!");
|
||||||
|
variable_item_set_locked(
|
||||||
|
item,
|
||||||
|
(!app->notification->rgb_srv->settings->individual_led),
|
||||||
|
"Individual\nleds OFF!");
|
||||||
|
|
||||||
// Rainbow mode
|
// Rainbow mode
|
||||||
item = variable_item_list_add(
|
item = variable_item_list_add(
|
||||||
app->variable_item_list_rgb,
|
app->variable_item_list_rgb,
|
||||||
"Rainbow mode",
|
"Dynamic colors mode",
|
||||||
RGB_BACKLIGHT_RAINBOW_MODE_COUNT,
|
RGB_BACKLIGHT_RAINBOW_MODE_COUNT,
|
||||||
rgb_backlight_rainbow_changed,
|
rgb_backlight_rainbow_changed,
|
||||||
app);
|
app);
|
||||||
@@ -615,7 +675,7 @@ static NotificationAppSettings* alloc_settings(void) {
|
|||||||
|
|
||||||
item = variable_item_list_add(
|
item = variable_item_list_add(
|
||||||
app->variable_item_list_rgb,
|
app->variable_item_list_rgb,
|
||||||
"Rainbow speed",
|
"Mode speed",
|
||||||
RGB_BACKLIGHT_RAINBOW_SPEED_COUNT,
|
RGB_BACKLIGHT_RAINBOW_SPEED_COUNT,
|
||||||
rgb_backlight_rainbow_speed_changed,
|
rgb_backlight_rainbow_speed_changed,
|
||||||
app);
|
app);
|
||||||
@@ -632,7 +692,7 @@ static NotificationAppSettings* alloc_settings(void) {
|
|||||||
|
|
||||||
item = variable_item_list_add(
|
item = variable_item_list_add(
|
||||||
app->variable_item_list_rgb,
|
app->variable_item_list_rgb,
|
||||||
"Rainbow step",
|
"Colors step",
|
||||||
RGB_BACKLIGHT_RAINBOW_STEP_COUNT,
|
RGB_BACKLIGHT_RAINBOW_STEP_COUNT,
|
||||||
rgb_backlight_rainbow_step_changed,
|
rgb_backlight_rainbow_step_changed,
|
||||||
app);
|
app);
|
||||||
|
|||||||
Reference in New Issue
Block a user