From aaa444f3f04c73ecf8730cd69f3171db398bfae6 Mon Sep 17 00:00:00 2001 From: HaxSam Date: Thu, 7 Mar 2024 02:31:34 +0100 Subject: [PATCH] added new rgb property --- .../scenes/momentum_app_scene_misc_screen.c | 5 +++++ targets/f7/furi_hal/furi_hal_info.c | 22 +++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/applications/main/momentum_app/scenes/momentum_app_scene_misc_screen.c b/applications/main/momentum_app/scenes/momentum_app_scene_misc_screen.c index ef0d04468a..4f39c38c07 100644 --- a/applications/main/momentum_app/scenes/momentum_app_scene_misc_screen.c +++ b/applications/main/momentum_app/scenes/momentum_app_scene_misc_screen.c @@ -1,3 +1,4 @@ +#include #include "../momentum_app.h" enum VarItemListIndex { @@ -55,6 +56,10 @@ static void momentum_app_scene_misc_screen_lcd_color_changed(VariableItem* item, variable_item_set_current_value_text(item, lcd_colors[index].name); rgb_backlight_set_color(led, &lcd_colors[index].color); app->save_backlight = true; + + Expansion* expansion = furi_record_open(RECORD_EXPANSION); + expansion_disable(expansion); + expansion_enable(expansion); } static void momentum_app_scene_misc_screen_lcd_color_0_changed(VariableItem* item) { momentum_app_scene_misc_screen_lcd_color_changed(item, 0); diff --git a/targets/f7/furi_hal/furi_hal_info.c b/targets/f7/furi_hal/furi_hal_info.c index 4908cca69d..385c19eae3 100644 --- a/targets/f7/furi_hal/furi_hal_info.c +++ b/targets/f7/furi_hal/furi_hal_info.c @@ -1,3 +1,6 @@ +#include "SK6805.h" +#include "colors.h" +#include "property.h" #include #include #include @@ -9,6 +12,10 @@ #include #include +#include "momentum/momentum.h" +#include "rgb_backlight.h" +#include + FURI_WEAK void furi_hal_info_get_api_version(uint16_t* major, uint16_t* minor) { *major = 0; *minor = 0; @@ -64,6 +71,21 @@ void furi_hal_info_get(PropertyValueCallback out, char sep, void* context) { property_value_out( &property_context, "%d", 2, "hardware", "color", furi_hal_version_get_hw_color()); + // RGB Settings + property_value_out(&property_context, "%d", 3, "hardware", "rgb", "enabled", momentum_settings.rgb_backlight); + + for(int i = 0; i < SK6805_get_led_count(); i++){ + RgbColor rgb; + rgb_backlight_get_color(i, &rgb); + + uint32_t led_value = 0; + memcpy(((void *)&led_value) + 1, &rgb, sizeof(RgbColor)); + + char id_string[2] = {'0'+i, '\0'}; + + property_value_out(&property_context, "%06X", 4, "hardware", "rgb", "led", id_string, __REV(led_value)); + } + if(sep == '.') { property_value_out( &property_context,