diff --git a/applications/services/application.fam b/applications/services/application.fam index 04a2dd607..1b69d2388 100644 --- a/applications/services/application.fam +++ b/applications/services/application.fam @@ -12,6 +12,5 @@ App( "loader", "power", "namechanger_srv", - "rgb_backlight", ], ) diff --git a/applications/services/notification/application.fam b/applications/services/notification/application.fam index fbfdca848..82f94085a 100644 --- a/applications/services/notification/application.fam +++ b/applications/services/notification/application.fam @@ -4,7 +4,7 @@ App( apptype=FlipperAppType.SERVICE, entry_point="notification_srv", cdefines=["SRV_NOTIFICATION"], - requires=["input","rgb_backlight"], + requires=["input"], provides=["notification_settings"], stack_size=int(1.5 * 1024), order=100, diff --git a/applications/services/notification/notification_app.c b/applications/services/notification/notification_app.c index d416c89f9..2b0fe40f7 100644 --- a/applications/services/notification/notification_app.c +++ b/applications/services/notification/notification_app.c @@ -9,9 +9,9 @@ #include "notification.h" #include "notification_messages.h" #include "notification_app.h" -#include "applications/services/rgb_backlight/rgb_backlight.h" #define TAG "NotificationSrv" +#define COLOR_COUNT (sizeof(colors) / sizeof(RGBBacklightColor)) static const uint8_t minimal_delay = 100; static const uint8_t led_off_values[NOTIFICATION_LED_COUNT] = {0x00, 0x00, 0x00}; @@ -33,6 +33,204 @@ static uint8_t notification_settings_get_display_brightness(NotificationApp* app static uint8_t notification_settings_get_rgb_led_brightness(NotificationApp* app, uint8_t value); static uint32_t notification_settings_display_off_delay_ticks(NotificationApp* app); + +// --- RGB BACKLIGHT --- + +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", 0, 0, 0}, + {"LED1", 0, 0, 0}, + {"LED2", 0, 0, 0}, +}; + +static const RGBBacklightColor colors[] = { + {"Orange", 255, 60, 0}, + {"Yellow", 255, 144, 0}, + {"Spring", 167, 255, 0}, + {"Lime", 0, 255, 0}, + {"Aqua", 0, 255, 127}, + {"Cyan", 0, 210, 210}, + {"Azure", 0, 127, 255}, + {"Blue", 0, 0, 255}, + {"Purple", 127, 0, 255}, + {"Magenta", 210, 0, 210}, + {"Pink", 255, 0, 127}, + {"Red", 255, 0, 0}, + {"White", 254, 210, 200}, + {"OFF", 0, 0, 0}, +}; + +uint8_t rgb_backlight_get_color_count(void) { + return COLOR_COUNT; +} + +const char* rgb_backlight_get_color_text(uint8_t index) { + return colors[index].name; +} + +// use RECORD for acces to rgb service instance and update current colors by static +void rgb_backlight_set_led_static_color(uint8_t led, uint8_t index) { + if(led < SK6805_get_led_count()) { + uint8_t r = colors[index].red; + uint8_t g = colors[index].green; + uint8_t b = colors[index].blue; + + current_led[led].red = r; + current_led[led].green = g; + current_led[led].blue = b; + + SK6805_set_led_color(led, r, g, b); + } +} + +// HSV to RGB based on +// https://www.radiokot.ru/forum/viewtopic.php?p=3000181&ysclid=m88wvoz34w244644702 +// https://radiolaba.ru/microcotrollers/tsvetnaya-lampa.html#comment-1790 +// https://alexgyver.ru/lessons/arduino-rgb/?ysclid=m88voflppa24464916 +// led number (0-2), hue (0..255), sat (0..255), val (0...1) +void rgb_backlight_set_led_custom_hsv_color(uint8_t led, uint16_t hue, uint8_t sat, float V) { + // init value + float r = 1.0f; + float g = 1.0f; + float b = 1.0f; + + // from (0..255) to (0..1) + float H = hue / 255.0f; + float S = sat / 255.0f; + + uint8_t i = trunc(H * 6); + float f = H * 6 - i; + float p = V * (1 - S); + float q = V * (1 - f * S); + float t = V * (1 - (1 - f) * S); + + switch(i) { + case 0: + r = V, g = t, b = p; + break; + case 1: + r = q, g = V, b = p; + break; + case 2: + r = p, g = V, b = t; + break; + case 3: + r = p, g = q, b = V; + break; + case 4: + r = t, g = p, b = V; + break; + case 5: + r = V, g = p, b = q; + break; + } + + // from (0..1) to (0..255) + current_led[led].red = r * 255; + current_led[led].green = g * 255; + current_led[led].blue = b * 255; +} + +// use RECORD for acces to rgb service instance, set current_* colors to led and update backlight +void rgb_backlight_update(float brightness) { + // RGBBacklightApp* app = furi_record_open(RECORD_RGB_BACKLIGHT); + + // if(app->settings.rgb.rgb_backlight_installed) { + for(uint8_t i = 0; i < SK6805_get_led_count(); i++) { + uint8_t r = current_led[i].red * brightness * 1.0f; + uint8_t g = current_led[i].green * brightness * 1.0f; + uint8_t b = current_led[i].blue * brightness * 1.0f; + SK6805_set_led_color(i, r, g, b); + } + SK6805_update(); + // } + // furi_record_close(RECORD_RGB_BACKLIGHT); +} + +// start furi timer for rainbow +void rainbow_timer_start(NotificationApp* app) { + if(furi_timer_is_running(app->rainbow_timer)) { + furi_timer_stop(app->rainbow_timer); + } + furi_timer_start(app->rainbow_timer, furi_ms_to_ticks(app->settings.rgb.rainbow_speed_ms)); +} + +// stop furi timer for rainbow +void rainbow_timer_stop(NotificationApp* app) { + if(furi_timer_is_running(app->rainbow_timer)) { + furi_timer_stop(app->rainbow_timer); + } +} + +// if rgb_backlight_installed then apply rainbow colors to backlight and start/restart/stop rainbow_timer +void rainbow_timer_starter(NotificationApp* app) { + if((app->settings.rgb.rainbow_mode > 0) && (app->settings.rgb.rgb_backlight_installed)) { + rainbow_timer_start(app); + } +} + +static void rainbow_timer_callback(void* context) { + furi_assert(context); + NotificationApp* app = context; + + if(app->settings.rgb.rgb_backlight_installed) { + app->rainbow_hue += app->settings.rgb.rainbow_step; + if(app->rainbow_hue > 254) { + app->rainbow_hue = 0; + } + + uint8_t wide = app->settings.rgb.rainbow_wide; + + switch(app->settings.rgb.rainbow_mode) { + //rainbow mode + case 1: + for(uint8_t i = 0; i < SK6805_get_led_count(); i++) { + rgb_backlight_set_led_custom_hsv_color( + i, + app->rainbow_hue, + app->settings.rgb.rainbow_saturation, + app->settings.display_brightness); + } + break; + + //wave mode + case 2: + uint16_t j = app->rainbow_hue + wide; + uint16_t k = app->rainbow_hue + wide * 2; + + if(app->rainbow_hue > (254 - wide)) { + j = j - 255; + } + if(app->rainbow_hue > (254 - wide * 2)) { + k = k - 255; + } + + rgb_backlight_set_led_custom_hsv_color( + 0, app->rainbow_hue, app->settings.rgb.rainbow_saturation, app->settings.display_brightness); + rgb_backlight_set_led_custom_hsv_color( + 1, j, app->settings.rgb.rainbow_saturation, app->settings.display_brightness); + rgb_backlight_set_led_custom_hsv_color( + 2, k, app->settings.rgb.rainbow_saturation, app->settings.display_brightness); + break; + + default: + break; + } + + rgb_backlight_update(app->settings.led_brightness * app->current_night_shift); + } +} + +// --- RGB BACKLIGHT ENF--- + + // --- NIGHT SHIFT --- void night_shift_timer_start(NotificationApp* app) { @@ -64,10 +262,8 @@ void night_shift_timer_callback(void* context) { // set values to stock and rgb backlights if((time > app->settings.night_shift_end) && (time < app->settings.night_shift_start)) { app->current_night_shift = 1.0f; - app->rgb_srv->current_night_shift = 1.0f; } else { app->current_night_shift = app->settings.night_shift; - app->rgb_srv->current_night_shift = app->settings.night_shift; } } @@ -267,7 +463,7 @@ static void notification_process_notification_message( reset_mask |= reset_display_mask; //start rgb_mod_rainbow_timer when display backlight is ON and all corresponding settings is ON too - rainbow_timer_starter(app->rgb_srv); + rainbow_timer_starter(app); // --- NIGHT SHIFT END --- } else { reset_mask &= ~reset_display_mask; @@ -276,8 +472,8 @@ static void notification_process_notification_message( furi_timer_stop(app->display_timer); } //stop rgb_mod_rainbow_timer when display backlight is OFF - if(furi_timer_is_running(app->rgb_srv->rainbow_timer)) { - rainbow_timer_stop(app->rgb_srv); + if(furi_timer_is_running(app->rainbow_timer)) { + rainbow_timer_stop(app); } } break; @@ -610,8 +806,7 @@ static NotificationApp* notification_app_alloc(void) { notification_message(app, &sequence_display_backlight_on); // --- NIGHT SHIFT --- - app->rgb_srv = furi_record_open(RECORD_RGB_BACKLIGHT); - app->rgb_srv->current_night_shift = 1.0f; + app->current_night_shift = 1.0f; app->current_night_shift = 1.0f; app->settings.night_shift = 1.0f; app->settings.night_shift_start = 1020; @@ -620,6 +815,7 @@ static NotificationApp* notification_app_alloc(void) { furi_timer_alloc(night_shift_timer_callback, FuriTimerTypePeriodic, app); // --- NIGHT SHIFT END --- + // use RECORD for setup init values to canvas lcd_inverted Gui* tmp_gui = furi_record_open(RECORD_GUI); Canvas* tmp_canvas = gui_direct_draw_acquire(tmp_gui); canvas_set_inverted_lcd(tmp_canvas, false); @@ -682,6 +878,35 @@ int32_t notification_srv(void* p) { UNUSED(p); NotificationApp* app = notification_app_alloc(); + // --- RGB BACKLIGHT SECTION --- + + // define rainbow_timer and they callback + app->rainbow_timer = furi_timer_alloc(rainbow_timer_callback, FuriTimerTypePeriodic, app); + + // init values + app->rainbow_hue = 1; + app->current_night_shift = 1.0f; + + // if rgb_backlight_installed then start rainbow or set leds colors from saved settings (default index = 0) + if(app->settings.rgb.rgb_backlight_installed) { + if(app->settings.rgb.rainbow_mode > 0) { + rainbow_timer_start(app); + } else { + rgb_backlight_set_led_static_color(2, app->settings.rgb.led_2_color_index); + rgb_backlight_set_led_static_color(1, app->settings.rgb.led_1_color_index); + rgb_backlight_set_led_static_color(0, app->settings.rgb.led_0_color_index); + rgb_backlight_update(app->settings.display_brightness * app->current_night_shift); + } + // 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(); + } + + // --- RGB BACKLIGHT SECTION END --- + notification_init_settings(app); notification_vibro_off(); diff --git a/applications/services/notification/notification_app.h b/applications/services/notification/notification_app.h index 7ac8528f2..7396e695e 100644 --- a/applications/services/notification/notification_app.h +++ b/applications/services/notification/notification_app.h @@ -3,7 +3,8 @@ #include "notification.h" #include "notification_messages.h" #include "notification_settings_filename.h" -#include "applications/services/rgb_backlight/rgb_backlight.h" +#include +#include #define NOTIFICATION_LED_COUNT 3 #define NOTIFICATION_EVENT_COMPLETE 0x00000001U @@ -37,6 +38,23 @@ typedef struct { #define NOTIFICATION_SETTINGS_VERSION 0x04 #define NOTIFICATION_SETTINGS_PATH INT_PATH(NOTIFICATION_SETTINGS_FILE_NAME) +typedef struct { + //Common settings + uint8_t rgb_backlight_installed; + + // static gradient mode settings + uint8_t led_2_color_index; + uint8_t led_1_color_index; + uint8_t led_0_color_index; + + // rainbow mode setings + uint32_t rainbow_mode; + uint32_t rainbow_speed_ms; + uint16_t rainbow_step; + uint8_t rainbow_saturation; + uint8_t rainbow_wide; +} RGBBacklightSettings; + typedef struct { uint8_t version; float display_brightness; @@ -49,6 +67,7 @@ typedef struct { uint32_t night_shift_start; uint32_t night_shift_end; bool lcd_inversion; + RGBBacklightSettings rgb; } NotificationSettings; struct NotificationApp { @@ -61,12 +80,24 @@ struct NotificationApp { uint8_t display_led_lock; NotificationSettings settings; - RGBBacklightApp* rgb_srv; FuriTimer* night_shift_timer; float current_night_shift; + + FuriTimer* rainbow_timer; + uint16_t rainbow_hue; + uint8_t rainbow_red; + uint8_t rainbow_green; + uint8_t rainbow_blue; }; void notification_message_save_settings(NotificationApp* app); void night_shift_timer_start(NotificationApp* app); void night_shift_timer_stop(NotificationApp* app); +void rgb_backlight_update(float brightness); +void rgb_backlight_set_led_static_color(uint8_t led, uint8_t index); +void rainbow_timer_start(NotificationApp* app); +void rainbow_timer_stop(NotificationApp* app); +void rainbow_timer_starter(NotificationApp* app); +const char* rgb_backlight_get_color_text(uint8_t index); +uint8_t rgb_backlight_get_color_count(void); \ No newline at end of file diff --git a/applications/services/rgb_backlight/application.fam b/applications/services/rgb_backlight/application.fam deleted file mode 100644 index 39954efaa..000000000 --- a/applications/services/rgb_backlight/application.fam +++ /dev/null @@ -1,10 +0,0 @@ -App( - appid="rgb_backlight", - name="RgbBackLightSrv", - apptype=FlipperAppType.SERVICE, - entry_point="rgb_backlight_srv", - cdefines=["SRV_RGB_BACKLIGHT"], - stack_size=1 * 1024, - order=1290, - sdk_headers=["rgb_backlight.h"], -) diff --git a/applications/services/rgb_backlight/rgb_backlight.c b/applications/services/rgb_backlight/rgb_backlight.c deleted file mode 100644 index 22628e3af..000000000 --- a/applications/services/rgb_backlight/rgb_backlight.c +++ /dev/null @@ -1,270 +0,0 @@ -/* - RGB BackLight Service based on - RGB backlight FlipperZero driver - Copyright (C) 2022-2023 Victor Nikitchuk (https://github.com/quen0n) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#include -#include -#include -#include -#include -#include "rgb_backlight.h" -#include - -#define COLOR_COUNT (sizeof(colors) / sizeof(RGBBacklightColor)) - -#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", 0, 0, 0}, - {"LED1", 0, 0, 0}, - {"LED2", 0, 0, 0}, -}; - -static const RGBBacklightColor colors[] = { - {"Orange", 255, 60, 0}, - {"Yellow", 255, 144, 0}, - {"Spring", 167, 255, 0}, - {"Lime", 0, 255, 0}, - {"Aqua", 0, 255, 127}, - {"Cyan", 0, 210, 210}, - {"Azure", 0, 127, 255}, - {"Blue", 0, 0, 255}, - {"Purple", 127, 0, 255}, - {"Magenta", 210, 0, 210}, - {"Pink", 255, 0, 127}, - {"Red", 255, 0, 0}, - {"White", 254, 210, 200}, - {"OFF", 0, 0, 0}, -}; - -uint8_t rgb_backlight_get_color_count(void) { - return COLOR_COUNT; -} - -const char* rgb_backlight_get_color_text(uint8_t index) { - return colors[index].name; -} - -// use RECORD for acces to rgb service instance and update current colors by static -void rgb_backlight_set_led_static_color(uint8_t led, uint8_t index) { - if(led < SK6805_get_led_count()) { - uint8_t r = colors[index].red; - uint8_t g = colors[index].green; - uint8_t b = colors[index].blue; - - current_led[led].red = r; - current_led[led].green = g; - current_led[led].blue = b; - - SK6805_set_led_color(led, r, g, b); - } -} - -// HSV to RGB based on -// https://www.radiokot.ru/forum/viewtopic.php?p=3000181&ysclid=m88wvoz34w244644702 -// https://radiolaba.ru/microcotrollers/tsvetnaya-lampa.html#comment-1790 -// https://alexgyver.ru/lessons/arduino-rgb/?ysclid=m88voflppa24464916 -// led number (0-2), hue (0..255), sat (0..255), val (0...1) -void rgb_backlight_set_led_custom_hsv_color(uint8_t led, uint16_t hue, uint8_t sat, float V) { - // init value - float r = 1.0f; - float g = 1.0f; - float b = 1.0f; - - // from (0..255) to (0..1) - float H = hue / 255.0f; - float S = sat / 255.0f; - - uint8_t i = trunc(H * 6); - float f = H * 6 - i; - float p = V * (1 - S); - float q = V * (1 - f * S); - float t = V * (1 - (1 - f) * S); - - switch(i) { - case 0: - r = V, g = t, b = p; - break; - case 1: - r = q, g = V, b = p; - break; - case 2: - r = p, g = V, b = t; - break; - case 3: - r = p, g = q, b = V; - break; - case 4: - r = t, g = p, b = V; - break; - case 5: - r = V, g = p, b = q; - break; - } - - // from (0..1) to (0..255) - current_led[led].red = r * 255; - current_led[led].green = g * 255; - current_led[led].blue = b * 255; -} - -// use RECORD for acces to rgb service instance, set current_* colors to led and update backlight -void rgb_backlight_update(float brightness) { - RGBBacklightApp* app = furi_record_open(RECORD_RGB_BACKLIGHT); - - if(app->settings->rgb_backlight_installed) { - for(uint8_t i = 0; i < SK6805_get_led_count(); i++) { - uint8_t r = current_led[i].red * brightness * 1.0f; - uint8_t g = current_led[i].green * brightness * 1.0f; - uint8_t b = current_led[i].blue * brightness * 1.0f; - SK6805_set_led_color(i, r, g, b); - } - SK6805_update(); - } - furi_record_close(RECORD_RGB_BACKLIGHT); -} - -// start furi timer for rainbow -void rainbow_timer_start(RGBBacklightApp* app) { - if(furi_timer_is_running(app->rainbow_timer)) { - furi_timer_stop(app->rainbow_timer); - } - furi_timer_start(app->rainbow_timer, furi_ms_to_ticks(app->settings->rainbow_speed_ms)); -} - -// stop furi timer for rainbow -void rainbow_timer_stop(RGBBacklightApp* app) { - if(furi_timer_is_running(app->rainbow_timer)) { - furi_timer_stop(app->rainbow_timer); - } -} - -// if rgb_backlight_installed then apply rainbow colors to backlight and start/restart/stop rainbow_timer -void rainbow_timer_starter(RGBBacklightApp* app) { - if((app->settings->rainbow_mode > 0) && (app->settings->rgb_backlight_installed)) { - rainbow_timer_start(app); - } -} - -static void rainbow_timer_callback(void* context) { - furi_assert(context); - RGBBacklightApp* app = context; - - if(app->settings->rgb_backlight_installed) { - app->rainbow_hue += app->settings->rainbow_step; - if(app->rainbow_hue > 254) { - app->rainbow_hue = 0; - } - - uint8_t wide = app->settings->rainbow_wide; - - switch(app->settings->rainbow_mode) { - //rainbow mode - case 1: - for(uint8_t i = 0; i < SK6805_get_led_count(); i++) { - rgb_backlight_set_led_custom_hsv_color( - i, - app->rainbow_hue, - app->settings->rainbow_saturation, - app->settings->brightness); - } - break; - - //wave mode - case 2: - uint16_t j = app->rainbow_hue + wide; - uint16_t k = app->rainbow_hue + wide * 2; - - if(app->rainbow_hue > (254 - wide)) { - j = j - 255; - } - if(app->rainbow_hue > (254 - wide * 2)) { - k = k - 255; - } - - rgb_backlight_set_led_custom_hsv_color( - 0, app->rainbow_hue, app->settings->rainbow_saturation, app->settings->brightness); - rgb_backlight_set_led_custom_hsv_color( - 1, j, app->settings->rainbow_saturation, app->settings->brightness); - rgb_backlight_set_led_custom_hsv_color( - 2, k, app->settings->rainbow_saturation, app->settings->brightness); - break; - - default: - break; - } - - rgb_backlight_update(app->settings->brightness * app->current_night_shift); - } -} - -int32_t rgb_backlight_srv(void* p) { - UNUSED(p); - - // Define object app (full app with settings and running variables), - // allocate memory and create RECORD for access to app structure from outside - RGBBacklightApp* app = malloc(sizeof(RGBBacklightApp)); - - // define rainbow_timer and they callback - app->rainbow_timer = furi_timer_alloc(rainbow_timer_callback, FuriTimerTypePeriodic, app); - - // settings load or create default - app->settings = malloc(sizeof(RGBBacklightSettings)); - rgb_backlight_settings_load(app->settings); - - app->rainbow_hue = 1; - app->current_night_shift = 1.0f; - - furi_record_create(RECORD_RGB_BACKLIGHT, app); - - // if rgb_backlight_installed then start rainbow or set leds colors from saved settings (default index = 0) - if(app->settings->rgb_backlight_installed) { - if(app->settings->rainbow_mode > 0) { - rainbow_timer_start(app); - } else { - rgb_backlight_set_led_static_color(2, app->settings->led_2_color_index); - rgb_backlight_set_led_static_color(1, app->settings->led_1_color_index); - rgb_backlight_set_led_static_color(0, app->settings->led_0_color_index); - rgb_backlight_update(app->settings->brightness * app->current_night_shift); - } - // 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(); - } - - while(1) { - furi_delay_ms(5000); - if(app->settings->rgb_backlight_installed) { - FURI_LOG_D(TAG, "RGB backlight enabled - serivce is running"); - } else { - FURI_LOG_D(TAG, "RGB backlight DISABLED - serivce is running"); - } - } - return 0; -} diff --git a/applications/services/rgb_backlight/rgb_backlight.h b/applications/services/rgb_backlight/rgb_backlight.h deleted file mode 100644 index 1be252dc1..000000000 --- a/applications/services/rgb_backlight/rgb_backlight.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - RGB BackLight Service based on - RGB backlight FlipperZero driver - Copyright (C) 2022-2023 Victor Nikitchuk (https://github.com/quen0n) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#pragma once -#include -#include "rgb_backlight_settings.h" -#include "SK6805.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - FuriTimer* rainbow_timer; - uint16_t rainbow_hue; - uint8_t rainbow_red; - uint8_t rainbow_green; - uint8_t rainbow_blue; - RGBBacklightSettings* settings; - // night_shift multiplicator for leds brightnes coming from Notificatoin app. - float current_night_shift; - -} RGBBacklightApp; - -#define RECORD_RGB_BACKLIGHT "rgb_backlight" - -/** Update leds colors from current_led[i].color and selected bright - * - * @param brightness - Brightness 0..1 - * @return - */ -void rgb_backlight_update(float brightness); - -/** Set current_led[i].color for one led by static color index - * - * @param led - Led number (0..2) - * @param index - Static color index number - * @return - */ -void rgb_backlight_set_led_static_color(uint8_t led, uint8_t index); - -/** Stop rainbow timer - * - * @param app - Instance of RGBBacklightApp from FURI RECORD - * @return - */ -void rainbow_timer_stop(RGBBacklightApp* app); - -/** Start rainbow timer - * - * @param app - Instance of RGBBacklightApp from FURI RECORD - * @return - */ - -/** Start rainbow timer - * - * @param app - Instance of RGBBacklightApp from FURI RECORD - * @return - */ -void rainbow_timer_start(RGBBacklightApp* app); - -/** Start rainbow timer only if all conditions meet (rgb_backlight_installed && rainbow ON) - * - * @param app - Instance of RGBBacklightApp from FURI RECORD - * @return - */ -void rainbow_timer_starter(RGBBacklightApp* app); - -/** Get name of static color by index - * - * @param index - Static colors index number - * @return - color name - */ -const char* rgb_backlight_get_color_text(uint8_t index); - -/** Get static colors count - * - * @param - * @return - colors count - */ -uint8_t rgb_backlight_get_color_count(void); - -#ifdef __cplusplus -} -#endif diff --git a/applications/services/rgb_backlight/rgb_backlight_settings.c b/applications/services/rgb_backlight/rgb_backlight_settings.c deleted file mode 100644 index baa573a77..000000000 --- a/applications/services/rgb_backlight/rgb_backlight_settings.c +++ /dev/null @@ -1,109 +0,0 @@ -#include "rgb_backlight_settings.h" - -#include -#include - -#define TAG "RGBBackligthSettings" - -#define RGB_BACKLIGHT_SETTINGS_FILE_NAME ".rgb_backlight.settings" -#define RGB_BACKLIGHT_SETTINGS_PATH INT_PATH(RGB_BACKLIGHT_SETTINGS_FILE_NAME) - -#define RGB_BACKLIGHT_SETTINGS_MAGIC (0x30) -#define RGB_BACKLIGHT_SETTINGS_VER_PREV (4) // Previous version number -#define RGB_BACKLIGHT_SETTINGS_VER (5) // Current version number - -//pervious settings must be copyed from previous rgb_backlight_settings.h file -typedef struct { - //Common settings - uint8_t version; - uint8_t rgb_backlight_installed; - float brightness; - - // static gradient mode settings - uint8_t led_2_color_index; - uint8_t led_1_color_index; - uint8_t led_0_color_index; - - // rainbow mode setings - uint32_t rainbow_mode; - uint32_t rainbow_speed_ms; - uint16_t rainbow_step; - uint8_t rainbow_saturation; - uint8_t rainbow_wide; - -} RGBBacklightSettingsPrevious; - -void rgb_backlight_settings_load(RGBBacklightSettings* settings) { - furi_assert(settings); - - bool success = false; - - //a useless cycle do-while, may will be used in future with anoter condition - do { - // take version from settings file metadata, if cant then break and fill settings with 0 and save to settings file; - uint8_t version; - if(!saved_struct_get_metadata(RGB_BACKLIGHT_SETTINGS_PATH, NULL, &version, NULL)) break; - - // if config actual version - load it directly - if(version == RGB_BACKLIGHT_SETTINGS_VER) { - success = saved_struct_load( - RGB_BACKLIGHT_SETTINGS_PATH, - settings, - sizeof(RGBBacklightSettings), - RGB_BACKLIGHT_SETTINGS_MAGIC, - RGB_BACKLIGHT_SETTINGS_VER); - // if config previous version - load it and inicialize new settings - } else if(version == RGB_BACKLIGHT_SETTINGS_VER_PREV) { - RGBBacklightSettingsPrevious* settings_previous = - malloc(sizeof(RGBBacklightSettingsPrevious)); - - success = saved_struct_load( - RGB_BACKLIGHT_SETTINGS_PATH, - settings_previous, - sizeof(RGBBacklightSettingsPrevious), - RGB_BACKLIGHT_SETTINGS_MAGIC, - RGB_BACKLIGHT_SETTINGS_VER_PREV); - // new settings initialization - if(success) { - // copy loaded old settings as part of new - uint32_t size = sizeof(settings); - memcpy(settings, settings_previous, size); - // set new options to initial value - // settings.something = something; - } - - free(settings_previous); - } - // in case of another config version we exit from useless cycle to next step - } while(false); - - // fill settings with 0 and save to settings file; - // Orange color (index=0) will be default - if(!success) { - FURI_LOG_W(TAG, "Failed to load file, using defaults"); - memset(settings, 0, sizeof(RGBBacklightSettings)); - settings->brightness = 1.0f; - settings->rainbow_speed_ms = 100; - settings->rainbow_step = 1; - settings->rainbow_saturation = 255; - settings->rainbow_wide = 50; - rgb_backlight_settings_save(settings); - } -} - -void rgb_backlight_settings_save(const RGBBacklightSettings* settings) { - furi_assert(settings); - - const bool success = saved_struct_save( - RGB_BACKLIGHT_SETTINGS_PATH, - settings, - sizeof(RGBBacklightSettings), - RGB_BACKLIGHT_SETTINGS_MAGIC, - RGB_BACKLIGHT_SETTINGS_VER); - - if(!success) { - FURI_LOG_E(TAG, "Failed to save rgb_backlight_settings file"); - } else { - FURI_LOG_I(TAG, "Settings saved"); - } -} diff --git a/applications/services/rgb_backlight/rgb_backlight_settings.h b/applications/services/rgb_backlight/rgb_backlight_settings.h deleted file mode 100644 index 3f3af005f..000000000 --- a/applications/services/rgb_backlight/rgb_backlight_settings.h +++ /dev/null @@ -1,35 +0,0 @@ -#pragma once - -#include -#include - -typedef struct { - //Common settings - uint8_t version; - uint8_t rgb_backlight_installed; - float brightness; - - // static gradient mode settings - uint8_t led_2_color_index; - uint8_t led_1_color_index; - uint8_t led_0_color_index; - - // rainbow mode setings - uint32_t rainbow_mode; - uint32_t rainbow_speed_ms; - uint16_t rainbow_step; - uint8_t rainbow_saturation; - uint8_t rainbow_wide; - -} RGBBacklightSettings; - -#ifdef __cplusplus -extern "C" { -#endif - -void rgb_backlight_settings_load(RGBBacklightSettings* settings); -void rgb_backlight_settings_save(const RGBBacklightSettings* settings); - -#ifdef __cplusplus -} -#endif diff --git a/applications/settings/notification_settings/notification_settings_app.c b/applications/settings/notification_settings/notification_settings_app.c index 4362039f0..7907d167d 100644 --- a/applications/settings/notification_settings/notification_settings_app.c +++ b/applications/settings/notification_settings/notification_settings_app.c @@ -4,9 +4,9 @@ #include #include #include -#include "applications/services/rgb_backlight/rgb_backlight.h" -#define MAX_NOTIFICATION_SETTINGS 4 + +#define MAX_NOTIFICATION_SETTINGS 5 typedef struct { NotificationApp* notification; @@ -293,12 +293,6 @@ static void backlight_changed(VariableItem* item) { variable_item_set_current_value_text(item, backlight_text[index]); app->notification->settings.display_brightness = backlight_value[index]; - //--- RGB BACKLIGHT --- - // set selected brightness to current rgb backlight service settings and save settings - app->notification->rgb_srv->settings->brightness = backlight_value[index]; - rgb_backlight_settings_save(app->notification->rgb_srv->settings); - //--- RGB BACKLIGHT END --- - notification_message(app->notification, &sequence_display_backlight_on); } @@ -368,12 +362,9 @@ static void rgb_backlight_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_backlight_installed_text[index]); - app->notification->rgb_srv->settings->rgb_backlight_installed = + app->notification->settings.rgb.rgb_backlight_installed = rgb_backlight_installed_value[index]; - app->notification->rgb_srv->settings->brightness = - app->notification->settings.display_brightness; - // In case of user playing with rgb_backlight_installed swith: // if user swith_off rgb_backlight_installed (but may be he have mod installed) // then force set default orange color and stop rainbow timer @@ -382,18 +373,18 @@ static void rgb_backlight_installed_changed(VariableItem* item) { rgb_backlight_set_led_static_color(1, 0); rgb_backlight_set_led_static_color(0, 0); SK6805_update(); - rainbow_timer_stop(app->notification->rgb_srv); + rainbow_timer_stop(app->notification); // start rainbow (if its Enabled) or set saved static colors if user swith_on rgb_backlight_installed switch } else { - if(app->notification->rgb_srv->settings->rainbow_mode > 0) { - rainbow_timer_starter(app->notification->rgb_srv); + if(app->notification->settings.rgb.rainbow_mode > 0) { + rainbow_timer_starter(app->notification); } else { rgb_backlight_set_led_static_color( - 2, app->notification->rgb_srv->settings->led_2_color_index); + 2, app->notification->settings.rgb.led_2_color_index); rgb_backlight_set_led_static_color( - 1, app->notification->rgb_srv->settings->led_1_color_index); + 1, app->notification->settings.rgb.led_1_color_index); rgb_backlight_set_led_static_color( - 0, app->notification->rgb_srv->settings->led_0_color_index); + 0, app->notification->settings.rgb.led_0_color_index); rgb_backlight_update( app->notification->settings.display_brightness * app->notification->current_night_shift); @@ -413,8 +404,7 @@ static void rgb_backlight_installed_changed(VariableItem* item) { variable_item_set_locked(t_item, false, "RGB\nOFF!"); } } - - rgb_backlight_settings_save(app->notification->rgb_srv->settings); + notification_message_save_settings(app->notification); } static void led_2_color_changed(VariableItem* item) { @@ -422,17 +412,17 @@ static void led_2_color_changed(VariableItem* 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; + app->notification->settings.rgb.led_2_color_index = index; // dont update screen color if rainbow timer working - if(!furi_timer_is_running(app->notification->rgb_srv->rainbow_timer)) { + if(!furi_timer_is_running(app->notification->rainbow_timer)) { rgb_backlight_set_led_static_color(2, index); rgb_backlight_update( - app->notification->rgb_srv->settings->brightness * + app->notification->settings.display_brightness * app->notification->current_night_shift); } - rgb_backlight_settings_save(app->notification->rgb_srv->settings); + notification_message_save_settings(app->notification); } static void led_1_color_changed(VariableItem* item) { @@ -440,17 +430,17 @@ static void led_1_color_changed(VariableItem* 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; + app->notification->settings.rgb.led_1_color_index = index; // dont update screen color if rainbow timer working - if(!furi_timer_is_running(app->notification->rgb_srv->rainbow_timer)) { + if(!furi_timer_is_running(app->notification->rainbow_timer)) { rgb_backlight_set_led_static_color(1, index); rgb_backlight_update( - app->notification->rgb_srv->settings->brightness * + app->notification->settings.display_brightness * app->notification->current_night_shift); } - rgb_backlight_settings_save(app->notification->rgb_srv->settings); + notification_message_save_settings(app->notification); } static void led_0_color_changed(VariableItem* item) { @@ -458,17 +448,17 @@ static void led_0_color_changed(VariableItem* 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; + app->notification->settings.rgb.led_0_color_index = index; // dont update screen color if rainbow timer working - if(!furi_timer_is_running(app->notification->rgb_srv->rainbow_timer)) { + if(!furi_timer_is_running(app->notification->rainbow_timer)) { rgb_backlight_set_led_static_color(0, index); rgb_backlight_update( - app->notification->rgb_srv->settings->brightness * + app->notification->settings.display_brightness * app->notification->current_night_shift); } - rgb_backlight_settings_save(app->notification->rgb_srv->settings); + notification_message_save_settings(app->notification); } static void rgb_backlight_rainbow_changed(VariableItem* item) { @@ -476,25 +466,25 @@ static void rgb_backlight_rainbow_changed(VariableItem* item) { uint8_t index = variable_item_get_current_value_index(item); variable_item_set_current_value_text(item, rgb_backlight_rainbow_mode_text[index]); - app->notification->rgb_srv->settings->rainbow_mode = rgb_backlight_rainbow_mode_value[index]; + app->notification->settings.rgb.rainbow_mode = rgb_backlight_rainbow_mode_value[index]; // restore saved rgb backlight settings if we switch_off effects if(index == 0) { rgb_backlight_set_led_static_color( - 2, app->notification->rgb_srv->settings->led_2_color_index); + 2, app->notification->settings.rgb.led_2_color_index); rgb_backlight_set_led_static_color( - 1, app->notification->rgb_srv->settings->led_1_color_index); + 1, app->notification->settings.rgb.led_1_color_index); rgb_backlight_set_led_static_color( - 0, app->notification->rgb_srv->settings->led_0_color_index); + 0, app->notification->settings.rgb.led_0_color_index); rgb_backlight_update( - app->notification->rgb_srv->settings->brightness * + app->notification->settings.display_brightness * app->notification->current_night_shift); - rainbow_timer_stop(app->notification->rgb_srv); + rainbow_timer_stop(app->notification); } else { - rainbow_timer_starter(app->notification->rgb_srv); + rainbow_timer_starter(app->notification); } - rgb_backlight_settings_save(app->notification->rgb_srv->settings); + notification_message_save_settings(app->notification); } static void rgb_backlight_rainbow_speed_changed(VariableItem* item) { @@ -502,12 +492,12 @@ static void rgb_backlight_rainbow_speed_changed(VariableItem* item) { uint8_t index = variable_item_get_current_value_index(item); variable_item_set_current_value_text(item, rgb_backlight_rainbow_speed_text[index]); - app->notification->rgb_srv->settings->rainbow_speed_ms = + app->notification->settings.rgb.rainbow_speed_ms = rgb_backlight_rainbow_speed_value[index]; // save settings and restart timer with new speed value - rainbow_timer_starter(app->notification->rgb_srv); - rgb_backlight_settings_save(app->notification->rgb_srv->settings); + rainbow_timer_starter(app->notification); + notification_message_save_settings(app->notification); } static void rgb_backlight_rainbow_step_changed(VariableItem* item) { @@ -515,9 +505,9 @@ static void rgb_backlight_rainbow_step_changed(VariableItem* item) { uint8_t index = variable_item_get_current_value_index(item); variable_item_set_current_value_text(item, rgb_backlight_rainbow_step_text[index]); - app->notification->rgb_srv->settings->rainbow_step = rgb_backlight_rainbow_step_value[index]; + app->notification->settings.rgb.rainbow_step = rgb_backlight_rainbow_step_value[index]; - rgb_backlight_settings_save(app->notification->rgb_srv->settings); + notification_message_save_settings(app->notification); } static void rgb_backlight_rainbow_saturation_changed(VariableItem* item) { @@ -528,9 +518,9 @@ static void rgb_backlight_rainbow_saturation_changed(VariableItem* item) { char valtext[4] = {}; snprintf(valtext, sizeof(valtext), "%d", index); variable_item_set_current_value_text(item, valtext); - app->notification->rgb_srv->settings->rainbow_saturation = index; + app->notification->settings.rgb.rainbow_saturation = index; - rgb_backlight_settings_save(app->notification->rgb_srv->settings); + notification_message_save_settings(app->notification); } static void rgb_backlight_rainbow_wide_changed(VariableItem* item) { @@ -538,24 +528,24 @@ static void rgb_backlight_rainbow_wide_changed(VariableItem* item) { uint8_t index = variable_item_get_current_value_index(item); variable_item_set_current_value_text(item, rgb_backlight_rainbow_wide_text[index]); - app->notification->rgb_srv->settings->rainbow_wide = rgb_backlight_rainbow_wide_value[index]; + app->notification->settings.rgb.rainbow_wide = rgb_backlight_rainbow_wide_value[index]; - rgb_backlight_settings_save(app->notification->rgb_srv->settings); + notification_message_save_settings(app->notification); } -// open rgb_settings_view if user press OK on first (index=0) menu string and (debug mode or rgb_backlight_installed is true) +// open settings.rgb_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) { UNUSED(context); NotificationAppSettings* app = context; - if(((app->notification->rgb_srv->settings->rgb_backlight_installed) || + if(((app->notification->settings.rgb.rgb_backlight_installed) || (furi_hal_rtc_is_flag_set(FuriHalRtcFlagDebug))) && (index == 0)) { view_dispatcher_switch_to_view(app->view_dispatcher, RGBViewId); } } -// switch to main view on exit from rgb_settings_view +// switch to main view on exit from settings.rgb_view static uint32_t notification_app_rgb_settings_exit(void* context) { UNUSED(context); return MainViewId; @@ -571,14 +561,14 @@ static void night_shift_changed(VariableItem* item) { variable_item_set_current_value_text(item, night_shift_text[index]); app->notification->settings.night_shift = night_shift_value[index]; app->notification->current_night_shift = night_shift_value[index]; - app->notification->rgb_srv->current_night_shift = night_shift_value[index]; + app->notification->current_night_shift = night_shift_value[index]; // force demo night_shift brightness ot rgb backlight and stock backlight notification_message(app->notification, &sequence_display_backlight_on); int slide = 0; if(furi_hal_rtc_is_flag_set(FuriHalRtcFlagDebug) || - (app->notification->rgb_srv->settings->rgb_backlight_installed)) { + (app->notification->settings.rgb.rgb_backlight_installed)) { slide = 1; } for(int i = 4 + slide; i < (6 + slide); i++) { @@ -646,7 +636,7 @@ static NotificationAppSettings* alloc_settings(void) { app->variable_item_list, variable_item_list_enter_callback, app); // Show RGB settings only when debug_mode or rgb_backlight_installed is active - if((app->notification->rgb_srv->settings->rgb_backlight_installed) || + if((app->notification->settings.rgb.rgb_backlight_installed) || (furi_hal_rtc_is_flag_set(FuriHalRtcFlagDebug))) { item = variable_item_list_add(app->variable_item_list, "RGB settings", 0, NULL, app); } @@ -743,7 +733,7 @@ static NotificationAppSettings* alloc_settings(void) { } item = variable_item_list_add( - app->variable_item_list,"LCD inversion",LCD_INVERSION_COUNT,lcd_inversion_changed,app); + app->variable_item_list, "LCD inversion", LCD_INVERSION_COUNT, lcd_inversion_changed, app); value_index = value_index_bool( app->notification->settings.lcd_inversion, lcd_inversion_value, LCD_INVERSION_COUNT); variable_item_set_current_value_index(item, value_index); @@ -754,7 +744,7 @@ static NotificationAppSettings* alloc_settings(void) { app->variable_item_list_rgb = variable_item_list_alloc(); View* view_rgb = variable_item_list_get_view(app->variable_item_list_rgb); - // set callback for exit from rgb_settings_menu + // set callback for exit from settings.rgb_menu view_set_previous_callback(view_rgb, notification_app_rgb_settings_exit); // Show rgb_backlight_installed swith only in Debug mode @@ -766,7 +756,7 @@ static NotificationAppSettings* alloc_settings(void) { rgb_backlight_installed_changed, app); value_index = value_index_bool( - app->notification->rgb_srv->settings->rgb_backlight_installed, + app->notification->settings.rgb.rgb_backlight_installed, rgb_backlight_installed_value, RGB_BACKLIGHT_INSTALLED_COUNT); variable_item_set_current_value_index(item, value_index); @@ -781,13 +771,11 @@ static NotificationAppSettings* alloc_settings(void) { rgb_backlight_get_color_count(), led_2_color_changed, app); - value_index = app->notification->rgb_srv->settings->led_2_color_index; + value_index = app->notification->settings.rgb.led_2_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)); variable_item_set_locked( - item, - (app->notification->rgb_srv->settings->rgb_backlight_installed == 0), - "RGB MOD \nOFF!"); + item, (app->notification->settings.rgb.rgb_backlight_installed == 0), "RGB MOD \nOFF!"); // led_2 color item = variable_item_list_add( @@ -796,13 +784,11 @@ static NotificationAppSettings* alloc_settings(void) { rgb_backlight_get_color_count(), led_1_color_changed, app); - value_index = app->notification->rgb_srv->settings->led_1_color_index; + value_index = app->notification->settings.rgb.led_1_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)); variable_item_set_locked( - item, - (app->notification->rgb_srv->settings->rgb_backlight_installed == 0), - "RGB MOD \nOFF!"); + item, (app->notification->settings.rgb.rgb_backlight_installed == 0), "RGB MOD \nOFF!"); // led 3 color item = variable_item_list_add( @@ -811,13 +797,11 @@ static NotificationAppSettings* alloc_settings(void) { rgb_backlight_get_color_count(), led_0_color_changed, app); - value_index = app->notification->rgb_srv->settings->led_0_color_index; + value_index = app->notification->settings.rgb.led_0_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)); variable_item_set_locked( - item, - (app->notification->rgb_srv->settings->rgb_backlight_installed == 0), - "RGB MOD \nOFF!"); + item, (app->notification->settings.rgb.rgb_backlight_installed == 0), "RGB MOD \nOFF!"); // Efects item = variable_item_list_add( @@ -827,15 +811,13 @@ static NotificationAppSettings* alloc_settings(void) { rgb_backlight_rainbow_changed, app); value_index = value_index_uint32( - app->notification->rgb_srv->settings->rainbow_mode, + app->notification->settings.rgb.rainbow_mode, rgb_backlight_rainbow_mode_value, RGB_BACKLIGHT_RAINBOW_MODE_COUNT); variable_item_set_current_value_index(item, value_index); variable_item_set_current_value_text(item, rgb_backlight_rainbow_mode_text[value_index]); variable_item_set_locked( - item, - (app->notification->rgb_srv->settings->rgb_backlight_installed == 0), - "RGB MOD \nOFF!"); + item, (app->notification->settings.rgb.rgb_backlight_installed == 0), "RGB MOD \nOFF!"); item = variable_item_list_add( app->variable_item_list_rgb, @@ -844,15 +826,13 @@ static NotificationAppSettings* alloc_settings(void) { rgb_backlight_rainbow_speed_changed, app); value_index = value_index_uint32( - app->notification->rgb_srv->settings->rainbow_speed_ms, + app->notification->settings.rgb.rainbow_speed_ms, rgb_backlight_rainbow_speed_value, RGB_BACKLIGHT_RAINBOW_SPEED_COUNT); variable_item_set_current_value_index(item, value_index); variable_item_set_current_value_text(item, rgb_backlight_rainbow_speed_text[value_index]); variable_item_set_locked( - item, - (app->notification->rgb_srv->settings->rgb_backlight_installed == 0), - "RGB MOD \nOFF!"); + item, (app->notification->settings.rgb.rgb_backlight_installed == 0), "RGB MOD \nOFF!"); item = variable_item_list_add( app->variable_item_list_rgb, @@ -861,15 +841,13 @@ static NotificationAppSettings* alloc_settings(void) { rgb_backlight_rainbow_step_changed, app); value_index = value_index_uint32( - app->notification->rgb_srv->settings->rainbow_step, + app->notification->settings.rgb.rainbow_step, rgb_backlight_rainbow_step_value, RGB_BACKLIGHT_RAINBOW_STEP_COUNT); variable_item_set_current_value_index(item, value_index); variable_item_set_current_value_text(item, rgb_backlight_rainbow_step_text[value_index]); variable_item_set_locked( - item, - (app->notification->rgb_srv->settings->rgb_backlight_installed == 0), - "RGB MOD \nOFF!"); + item, (app->notification->settings.rgb.rgb_backlight_installed == 0), "RGB MOD \nOFF!"); item = variable_item_list_add( app->variable_item_list_rgb, @@ -877,15 +855,13 @@ static NotificationAppSettings* alloc_settings(void) { 255, rgb_backlight_rainbow_saturation_changed, app); - value_index = app->notification->rgb_srv->settings->rainbow_saturation; + value_index = app->notification->settings.rgb.rainbow_saturation; 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); variable_item_set_locked( - item, - (app->notification->rgb_srv->settings->rgb_backlight_installed == 0), - "RGB MOD \nOFF!"); + item, (app->notification->settings.rgb.rgb_backlight_installed == 0), "RGB MOD \nOFF!"); item = variable_item_list_add( app->variable_item_list_rgb, @@ -894,15 +870,13 @@ static NotificationAppSettings* alloc_settings(void) { rgb_backlight_rainbow_wide_changed, app); value_index = value_index_uint32( - app->notification->rgb_srv->settings->rainbow_wide, + app->notification->settings.rgb.rainbow_wide, rgb_backlight_rainbow_wide_value, RGB_BACKLIGHT_RAINBOW_WIDE_COUNT); variable_item_set_current_value_index(item, value_index); variable_item_set_current_value_text(item, rgb_backlight_rainbow_wide_text[value_index]); variable_item_set_locked( - item, - (app->notification->rgb_srv->settings->rgb_backlight_installed == 0), - "RGB MOD \nOFF!"); + item, (app->notification->settings.rgb.rgb_backlight_installed == 0), "RGB MOD \nOFF!"); //--- RGB BACKLIGHT END --- diff --git a/targets/f7/api_symbols.csv b/targets/f7/api_symbols.csv index db6a1c242..beffffd35 100755 --- a/targets/f7/api_symbols.csv +++ b/targets/f7/api_symbols.csv @@ -1,5 +1,5 @@ entry,status,name,type,params -Version,+,85.0,, +Version,+,86.0,, 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_keys_storage.h,, @@ -38,7 +38,6 @@ Header,+,applications/services/locale/locale.h,, Header,+,applications/services/notification/notification.h,, Header,+,applications/services/notification/notification_messages.h,, Header,+,applications/services/power/power_service/power.h,, -Header,+,applications/services/rgb_backlight/rgb_backlight.h,, Header,+,applications/services/rpc/rpc_app.h,, Header,+,applications/services/storage/storage.h,, Header,+,lib/bit_lib/bit_lib.h,, @@ -415,10 +414,6 @@ Function,-,LL_mDelay,void,uint32_t Function,-,Osal_MemCmp,int,"const void*, const void*, unsigned int" Function,-,Osal_MemCpy,void*,"void*, const void*, unsigned int" Function,-,Osal_MemSet,void*,"void*, int, unsigned int" -Function,+,SK6805_get_led_count,uint8_t, -Function,+,SK6805_init,void, -Function,+,SK6805_set_led_color,void,"uint8_t, uint8_t, uint8_t, uint8_t" -Function,+,SK6805_update,void, Function,-,SystemCoreClockUpdate,void, Function,-,SystemInit,void, Function,-,_Exit,void,int @@ -3138,9 +3133,6 @@ Function,-,putw,int,"int, FILE*" Function,-,qsort,void,"void*, size_t, size_t, __compar_fn_t" Function,-,qsort_r,void,"void*, size_t, size_t, int (*)(const void*, const void*, void*), void*" Function,-,quick_exit,void,int -Function,+,rainbow_timer_start,void,RGBBacklightApp* -Function,+,rainbow_timer_starter,void,RGBBacklightApp* -Function,+,rainbow_timer_stop,void,RGBBacklightApp* Function,+,rand,int, Function,-,rand_r,int,unsigned* Function,+,random,long, @@ -3159,12 +3151,6 @@ Function,-,remquol,long double,"long double, long double, int*" Function,-,rename,int,"const char*, const char*" Function,-,renameat,int,"int, const char*, int, const char*" Function,-,rewind,void,FILE* -Function,+,rgb_backlight_get_color_count,uint8_t, -Function,+,rgb_backlight_get_color_text,const char*,uint8_t -Function,+,rgb_backlight_set_led_static_color,void,"uint8_t, uint8_t" -Function,+,rgb_backlight_settings_load,void,RGBBacklightSettings* -Function,+,rgb_backlight_settings_save,void,const RGBBacklightSettings* -Function,+,rgb_backlight_update,void,float Function,-,rindex,char*,"const char*, int" Function,-,rint,double,double Function,-,rintf,float,float diff --git a/targets/f7/furi_hal/furi_hal_light.c b/targets/f7/furi_hal/furi_hal_light.c index 2d6b4bbfe..b9f34e445 100644 --- a/targets/f7/furi_hal/furi_hal_light.c +++ b/targets/f7/furi_hal/furi_hal_light.c @@ -3,7 +3,7 @@ #include #include #include -#include "applications/services/rgb_backlight/rgb_backlight.h" +#include #define LED_CURRENT_RED (50u) #define LED_CURRENT_GREEN (50u)