mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2025-12-12 12:42:30 +04:00
Сombining rgb_backlight and original_backlight finished.
- RGB Colors settings available only when Settings-Notification-RGB_MOD_Installed swithed ON - RGB_MOD_Installed switch (ON|OFF) available in Notification only with Debug mode swithed ON.
This commit is contained in:
@@ -523,6 +523,7 @@ static NotificationApp* notification_app_alloc(void) {
|
||||
app->settings.led_brightness = 1.0f;
|
||||
app->settings.display_off_delay_ms = 30000;
|
||||
app->settings.vibro_on = true;
|
||||
app->settings.rgb_mod_installed = false;
|
||||
|
||||
app->display.value[LayerInternal] = 0x00;
|
||||
app->display.value[LayerNotification] = 0x00;
|
||||
|
||||
@@ -33,7 +33,7 @@ typedef struct {
|
||||
Light light;
|
||||
} NotificationLedLayer;
|
||||
|
||||
#define NOTIFICATION_SETTINGS_VERSION 0x02
|
||||
#define NOTIFICATION_SETTINGS_VERSION 0x03
|
||||
#define NOTIFICATION_SETTINGS_PATH INT_PATH(NOTIFICATION_SETTINGS_FILE_NAME)
|
||||
|
||||
typedef struct {
|
||||
@@ -44,6 +44,7 @@ typedef struct {
|
||||
uint32_t display_off_delay_ms;
|
||||
int8_t contrast;
|
||||
bool vibro_on;
|
||||
bool rgb_mod_installed;
|
||||
} NotificationSettings;
|
||||
|
||||
struct NotificationApp {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include <furi.h>
|
||||
#include <furi_hal_rtc.h>
|
||||
#include <notification/notification_app.h>
|
||||
#include <gui/modules/variable_item_list.h>
|
||||
#include <gui/view_dispatcher.h>
|
||||
@@ -107,6 +108,13 @@ const char* const vibro_text[VIBRO_COUNT] = {
|
||||
};
|
||||
const bool vibro_value[VIBRO_COUNT] = {false, true};
|
||||
|
||||
#define RGB_MOD_COUNT 2
|
||||
const char* const rgb_mod_text[RGB_MOD_COUNT] = {
|
||||
"OFF",
|
||||
"ON",
|
||||
};
|
||||
const bool rgb_mod_value[RGB_MOD_COUNT] = {false, true};
|
||||
|
||||
static void contrast_changed(VariableItem* item) {
|
||||
NotificationAppSettings* app = variable_item_get_context(item);
|
||||
uint8_t index = variable_item_get_current_value_index(item);
|
||||
@@ -171,6 +179,13 @@ static void vibro_changed(VariableItem* item) {
|
||||
notification_message(app->notification, &sequence_single_vibro);
|
||||
}
|
||||
|
||||
static void rgb_mod_installed_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_mod_text[index]);
|
||||
app->notification->settings.rgb_mod_installed = rgb_mod_value[index];
|
||||
}
|
||||
|
||||
// Set RGB backlight color
|
||||
static void color_changed(VariableItem* item) {
|
||||
NotificationAppSettings* app = variable_item_get_context(item);
|
||||
@@ -248,38 +263,59 @@ static NotificationAppSettings* alloc_settings(void) {
|
||||
variable_item_set_current_value_index(item, value_index);
|
||||
variable_item_set_current_value_text(item, contrast_text[value_index]);
|
||||
|
||||
// RGB Colors
|
||||
item = variable_item_list_add(
|
||||
app->variable_item_list, "LCD Color", rgb_backlight_get_color_count(), color_changed, app);
|
||||
value_index = rgb_backlight_get_settings()->display_color_index;
|
||||
variable_item_set_current_value_index(item, value_index);
|
||||
variable_item_set_current_value_text(item, rgb_backlight_get_color_text(value_index));
|
||||
temp_item = item;
|
||||
// Show RGB_MOD_Installed_Swith only in Debug mode
|
||||
if(furi_hal_rtc_is_flag_set(FuriHalRtcFlagDebug)) {
|
||||
item = variable_item_list_add(
|
||||
app->variable_item_list,
|
||||
"RGB MOD Installed",
|
||||
RGB_MOD_COUNT,
|
||||
rgb_mod_installed_changed,
|
||||
app);
|
||||
value_index = value_index_bool(
|
||||
app->notification->settings.rgb_mod_installed, rgb_mod_value, RGB_MOD_COUNT);
|
||||
variable_item_set_current_value_index(item, value_index);
|
||||
variable_item_set_current_value_text(item, rgb_mod_text[value_index]);
|
||||
}
|
||||
|
||||
// Custom Color - REFACTOR THIS
|
||||
item = variable_item_list_add(
|
||||
app->variable_item_list, "Custom Red", 255, color_set_custom_red, app);
|
||||
value_index = rgb_backlight_get_settings()->custom_r;
|
||||
variable_item_set_current_value_index(item, value_index);
|
||||
char valtext[4] = {};
|
||||
snprintf(valtext, sizeof(valtext), "%d", value_index);
|
||||
variable_item_set_current_value_text(item, valtext);
|
||||
//Show RGB settings only when debug mode enabled or rgb_mod_installed is true
|
||||
if((furi_hal_rtc_is_flag_set(FuriHalRtcFlagDebug)) ||
|
||||
(app->notification->settings.rgb_mod_installed)) {
|
||||
// RGB Colors
|
||||
item = variable_item_list_add(
|
||||
app->variable_item_list,
|
||||
"LCD Color",
|
||||
rgb_backlight_get_color_count(),
|
||||
color_changed,
|
||||
app);
|
||||
value_index = rgb_backlight_get_settings()->display_color_index;
|
||||
variable_item_set_current_value_index(item, value_index);
|
||||
variable_item_set_current_value_text(item, rgb_backlight_get_color_text(value_index));
|
||||
temp_item = item;
|
||||
|
||||
item = variable_item_list_add(
|
||||
app->variable_item_list, "Custom Green", 255, color_set_custom_green, app);
|
||||
value_index = rgb_backlight_get_settings()->custom_g;
|
||||
variable_item_set_current_value_index(item, value_index);
|
||||
snprintf(valtext, sizeof(valtext), "%d", value_index);
|
||||
variable_item_set_current_value_text(item, valtext);
|
||||
// Custom Color - REFACTOR THIS
|
||||
item = variable_item_list_add(
|
||||
app->variable_item_list, "Custom Red", 255, color_set_custom_red, app);
|
||||
value_index = rgb_backlight_get_settings()->custom_r;
|
||||
variable_item_set_current_value_index(item, value_index);
|
||||
char valtext[4] = {};
|
||||
snprintf(valtext, sizeof(valtext), "%d", value_index);
|
||||
variable_item_set_current_value_text(item, valtext);
|
||||
|
||||
item = variable_item_list_add(
|
||||
app->variable_item_list, "Custom Blue", 255, color_set_custom_blue, app);
|
||||
value_index = rgb_backlight_get_settings()->custom_b;
|
||||
variable_item_set_current_value_index(item, value_index);
|
||||
snprintf(valtext, sizeof(valtext), "%d", value_index);
|
||||
variable_item_set_current_value_text(item, valtext);
|
||||
// End of RGB
|
||||
item = variable_item_list_add(
|
||||
app->variable_item_list, "Custom Green", 255, color_set_custom_green, app);
|
||||
value_index = rgb_backlight_get_settings()->custom_g;
|
||||
variable_item_set_current_value_index(item, value_index);
|
||||
snprintf(valtext, sizeof(valtext), "%d", value_index);
|
||||
variable_item_set_current_value_text(item, valtext);
|
||||
|
||||
item = variable_item_list_add(
|
||||
app->variable_item_list, "Custom Blue", 255, color_set_custom_blue, app);
|
||||
value_index = rgb_backlight_get_settings()->custom_b;
|
||||
variable_item_set_current_value_index(item, value_index);
|
||||
snprintf(valtext, sizeof(valtext), "%d", value_index);
|
||||
variable_item_set_current_value_text(item, valtext);
|
||||
// End of RGB
|
||||
}
|
||||
item = variable_item_list_add(
|
||||
app->variable_item_list, "LCD Brightness", BACKLIGHT_COUNT, backlight_changed, app);
|
||||
value_index = value_index_float(
|
||||
|
||||
Reference in New Issue
Block a user