Skip to content

Commit

Permalink
more contrast values for replacement displays
Browse files Browse the repository at this point in the history
  • Loading branch information
xMasterX committed Jan 28, 2024
1 parent 830dbc7 commit 16d1c93
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 59 deletions.
116 changes: 58 additions & 58 deletions .ci_files/rgb.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/applications/services/notification/notification_app.c b/applications/services/notification/notification_app.c
index 5769ced..c5d3088 100644
index 9baa738..91ad7c1 100644
--- a/applications/services/notification/notification_app.c
+++ b/applications/services/notification/notification_app.c
@@ -9,6 +9,7 @@
Expand All @@ -19,7 +19,7 @@ index 5769ced..c5d3088 100644
}

diff --git a/applications/settings/notification_settings/notification_settings_app.c b/applications/settings/notification_settings/notification_settings_app.c
index 1955012..19d953d 100644
index 2a1d988..dda86f3 100644
--- a/applications/settings/notification_settings/notification_settings_app.c
+++ b/applications/settings/notification_settings/notification_settings_app.c
@@ -3,6 +3,7 @@
Expand All @@ -30,16 +30,16 @@ index 1955012..19d953d 100644

#define MAX_NOTIFICATION_SETTINGS 4

@@ -20,6 +21,8 @@ static const NotificationSequence sequence_note_c = {
NULL,
};
@@ -13,6 +14,8 @@ typedef struct {
VariableItemList* variable_item_list;
} NotificationAppSettings;

+static VariableItem* temp_item;
+
#define CONTRAST_COUNT 11
const char* const contrast_text[CONTRAST_COUNT] = {
"-5",
@@ -156,6 +159,59 @@ static void vibro_changed(VariableItem* item) {
static const NotificationSequence sequence_note_c = {
&message_note_c5,
&message_delay_100,
@@ -168,6 +171,59 @@ static void vibro_changed(VariableItem* item) {
notification_message(app->notification, &sequence_single_vibro);
}

Expand Down Expand Up @@ -99,7 +99,7 @@ index 1955012..19d953d 100644
static uint32_t notification_app_settings_exit(void* context) {
UNUSED(context);
return VIEW_NONE;
@@ -180,8 +236,40 @@ static NotificationAppSettings* alloc_settings() {
@@ -192,8 +248,40 @@ static NotificationAppSettings* alloc_settings() {
variable_item_set_current_value_index(item, value_index);
variable_item_set_current_value_text(item, contrast_text[value_index]);

Expand Down Expand Up @@ -462,54 +462,6 @@ index 0000000..68dacda
+ */
+const char* rgb_backlight_get_color_text(uint8_t index);
\ No newline at end of file
diff --git a/targets/f7/furi_hal/furi_hal_light.c b/targets/f7/furi_hal/furi_hal_light.c
index 83e1603..45798ca 100644
--- a/targets/f7/furi_hal/furi_hal_light.c
+++ b/targets/f7/furi_hal/furi_hal_light.c
@@ -3,6 +3,7 @@
#include <furi_hal_light.h>
#include <lp5562.h>
#include <stdint.h>
+#include <applications/settings/notification_settings/rgb_backlight.h>

#define LED_CURRENT_RED 50
#define LED_CURRENT_GREEN 50
@@ -31,22 +32,21 @@ void furi_hal_light_init() {
}

void furi_hal_light_set(Light light, uint8_t value) {
- furi_hal_i2c_acquire(&furi_hal_i2c_handle_power);
- if(light & LightRed) {
- lp5562_set_channel_value(&furi_hal_i2c_handle_power, LP5562ChannelRed, value);
- }
- if(light & LightGreen) {
- lp5562_set_channel_value(&furi_hal_i2c_handle_power, LP5562ChannelGreen, value);
- }
- if(light & LightBlue) {
- lp5562_set_channel_value(&furi_hal_i2c_handle_power, LP5562ChannelBlue, value);
- }
if(light & LightBacklight) {
- uint8_t prev = lp5562_get_channel_value(&furi_hal_i2c_handle_power, LP5562ChannelWhite);
- lp5562_execute_ramp(
- &furi_hal_i2c_handle_power, LP5562Engine1, LP5562ChannelWhite, prev, value, 100);
+ rgb_backlight_update(value, false);
+ } else {
+ furi_hal_i2c_acquire(&furi_hal_i2c_handle_power);
+ if(light & LightRed) {
+ lp5562_set_channel_value(&furi_hal_i2c_handle_power, LP5562ChannelRed, value);
+ }
+ if(light & LightGreen) {
+ lp5562_set_channel_value(&furi_hal_i2c_handle_power, LP5562ChannelGreen, value);
+ }
+ if(light & LightBlue) {
+ lp5562_set_channel_value(&furi_hal_i2c_handle_power, LP5562ChannelBlue, value);
+ }
+ furi_hal_i2c_release(&furi_hal_i2c_handle_power);
}
- furi_hal_i2c_release(&furi_hal_i2c_handle_power);
}

void furi_hal_light_blink_start(Light light, uint8_t brightness, uint16_t on_time, uint16_t period) {
diff --git a/lib/drivers/SK6805.c b/lib/drivers/SK6805.c
new file mode 100644
index 0000000..572e1df
Expand Down Expand Up @@ -675,3 +627,51 @@ index 0000000..7c58956
+
+#endif /* SK6805_H_ */
\ No newline at end of file
diff --git a/targets/f7/furi_hal/furi_hal_light.c b/targets/f7/furi_hal/furi_hal_light.c
index 83e1603..45798ca 100644
--- a/targets/f7/furi_hal/furi_hal_light.c
+++ b/targets/f7/furi_hal/furi_hal_light.c
@@ -3,6 +3,7 @@
#include <furi_hal_light.h>
#include <lp5562.h>
#include <stdint.h>
+#include <applications/settings/notification_settings/rgb_backlight.h>

#define LED_CURRENT_RED 50
#define LED_CURRENT_GREEN 50
@@ -31,22 +32,21 @@ void furi_hal_light_init() {
}

void furi_hal_light_set(Light light, uint8_t value) {
- furi_hal_i2c_acquire(&furi_hal_i2c_handle_power);
- if(light & LightRed) {
- lp5562_set_channel_value(&furi_hal_i2c_handle_power, LP5562ChannelRed, value);
- }
- if(light & LightGreen) {
- lp5562_set_channel_value(&furi_hal_i2c_handle_power, LP5562ChannelGreen, value);
- }
- if(light & LightBlue) {
- lp5562_set_channel_value(&furi_hal_i2c_handle_power, LP5562ChannelBlue, value);
- }
if(light & LightBacklight) {
- uint8_t prev = lp5562_get_channel_value(&furi_hal_i2c_handle_power, LP5562ChannelWhite);
- lp5562_execute_ramp(
- &furi_hal_i2c_handle_power, LP5562Engine1, LP5562ChannelWhite, prev, value, 100);
+ rgb_backlight_update(value, false);
+ } else {
+ furi_hal_i2c_acquire(&furi_hal_i2c_handle_power);
+ if(light & LightRed) {
+ lp5562_set_channel_value(&furi_hal_i2c_handle_power, LP5562ChannelRed, value);
+ }
+ if(light & LightGreen) {
+ lp5562_set_channel_value(&furi_hal_i2c_handle_power, LP5562ChannelGreen, value);
+ }
+ if(light & LightBlue) {
+ lp5562_set_channel_value(&furi_hal_i2c_handle_power, LP5562ChannelBlue, value);
+ }
+ furi_hal_i2c_release(&furi_hal_i2c_handle_power);
}
- furi_hal_i2c_release(&furi_hal_i2c_handle_power);
}

void furi_hal_light_blink_start(Light light, uint8_t brightness, uint16_t on_time, uint16_t period) {
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@ static const NotificationSequence sequence_note_c = {
NULL,
};

#define CONTRAST_COUNT 11
#define CONTRAST_COUNT 17
const char* const contrast_text[CONTRAST_COUNT] = {
"-8",
"-7",
"-6",
"-5",
"-4",
"-3",
Expand All @@ -33,8 +36,14 @@ const char* const contrast_text[CONTRAST_COUNT] = {
"+3",
"+4",
"+5",
"+6",
"+7",
"+8",
};
const int32_t contrast_value[CONTRAST_COUNT] = {
-8,
-7,
-6,
-5,
-4,
-3,
Expand All @@ -46,6 +55,9 @@ const int32_t contrast_value[CONTRAST_COUNT] = {
3,
4,
5,
6,
7,
8,
};

#define BACKLIGHT_COUNT 21
Expand Down

0 comments on commit 16d1c93

Please sign in to comment.