Merge branch 'max-brightness-scale' into 'main'
Limit pattern brightness based on `max_brightness` too Closes #95 See merge request agx/feedbackd!199
This commit is contained in:
+1
-4
@@ -100,10 +100,7 @@ if get_option('daemon')
|
||||
endif
|
||||
endif
|
||||
|
||||
install_data('feedbackd.sysusers',
|
||||
rename: 'feedbackd.conf',
|
||||
install_dir: systemd_sysusers_dir,
|
||||
)
|
||||
install_data('feedbackd.sysusers', rename: 'feedbackd.conf', install_dir: systemd_sysusers_dir)
|
||||
|
||||
if get_option('media-roles')
|
||||
install_data('media-role-nodes.conf', install_dir: wireplumberdir)
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
|
||||
#include <gio/gio.h>
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#define LED_MULTI_INDEX_ATTR "multi_index"
|
||||
#define LED_MULTI_INDEX_RED "red"
|
||||
#define LED_MULTI_INDEX_GREEN "green"
|
||||
@@ -132,11 +134,14 @@ fbd_dev_led_multicolor_set_color (FbdDevLed *led,
|
||||
colors[priv->green_index] = 0;
|
||||
colors[priv->blue_index] = max_brightness;
|
||||
break;
|
||||
case FBD_FEEDBACK_LED_COLOR_RGB:
|
||||
colors[priv->red_index] = rgb->r;
|
||||
colors[priv->green_index] = rgb->g;
|
||||
colors[priv->blue_index] = rgb->b;
|
||||
case FBD_FEEDBACK_LED_COLOR_RGB: {
|
||||
float scale = max_brightness / 255.0;
|
||||
/* RGB colors are 0..255 so we need to scale to 0..max_brightness */
|
||||
colors[priv->red_index] = MIN (max_brightness, roundf (rgb->r * scale));
|
||||
colors[priv->green_index] = MIN (max_brightness, roundf (rgb->g * scale));
|
||||
colors[priv->blue_index] = MIN (max_brightness, roundf (rgb->b * scale));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
g_warning("Unhandled color: %d\n", color);
|
||||
return FALSE;
|
||||
|
||||
@@ -329,7 +329,8 @@ fbd_feedback_led_class_init (FbdFeedbackLedClass *klass)
|
||||
* FbdFeedbackLed:color:
|
||||
*
|
||||
* The color the LED should blink with. The color is given as color
|
||||
* name or `rgb()` color value.
|
||||
* name or `rgb()` color value. E.g. a value of "#FF0000" is equivalent
|
||||
* to `red` at maximum brightness.
|
||||
*/
|
||||
props[PROP_COLOR] =
|
||||
g_param_spec_string ("color", "", "",
|
||||
|
||||
+11
-1
@@ -38,7 +38,17 @@ if get_option('daemon')
|
||||
'fbd-udev.c',
|
||||
]
|
||||
|
||||
fbd_deps = [gio, gio_unix, glib, gmobile, gobject, gsound, gudev, json_glib]
|
||||
fbd_deps = [
|
||||
gio,
|
||||
gio_unix,
|
||||
glib,
|
||||
gmobile,
|
||||
gobject,
|
||||
gsound,
|
||||
gudev,
|
||||
json_glib,
|
||||
cc.find_library('m', required: false),
|
||||
]
|
||||
|
||||
fbd_inc = [include_directories('.'), libfeedback_inc, dbus_inc]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user