Merge branch 'virbra-fix' into 'main'

vibra-pattern: Don't overwrite magnitudes

See merge request agx/feedbackd!177
This commit is contained in:
Guido Günther
2025-05-09 19:40:02 +00:00
2 changed files with 18 additions and 15 deletions
+11 -11
View File
@@ -184,29 +184,29 @@ do_pattern_step (FbdFeedbackVibraPattern *self)
{
FbdFeedbackManager *manager = fbd_feedback_manager_get_default ();
FbdDevVibra *dev = fbd_feedback_manager_get_dev_vibra (manager);
double *magnitude;
guint *duration;
double magnitude;
guint duration;
magnitude = &g_array_index (self->magnitudes, double, self->pos);
duration = &g_array_index (self->durations, guint, self->pos);
magnitude = g_array_index (self->magnitudes, double, self->pos);
duration = g_array_index (self->durations, guint, self->pos);
g_debug ("step: pos: %d/%d, magn: %f, timeout %u",
self->pos,
self->durations->len,
*magnitude,
*duration);
magnitude,
duration);
/* Removing any pending effect */
/* Remove any pending effect */
fbd_dev_vibra_remove_effect (dev);
if (*magnitude != 0.0) {
if (magnitude != 0.0) {
double max_strength = fbd_feedback_vibra_get_max_strength (FBD_FEEDBACK_VIBRA (self));
*magnitude = MIN (*magnitude, max_strength);
fbd_dev_vibra_rumble (dev, *magnitude, *duration, TRUE);
magnitude = MIN (magnitude, max_strength);
fbd_dev_vibra_rumble (dev, magnitude, duration, TRUE);
}
self->timer_id = g_timeout_add_once (*duration,
self->timer_id = g_timeout_add_once (duration,
on_timer_expired,
self);
g_source_set_name_by_id (self->timer_id, "feedback-vibra-pattern-timer");
+7 -4
View File
@@ -1,6 +1,9 @@
/*
* Copyright (C) 2020 Purism SPC
* 2024-2025 The Phosh Developers
*
* SPDX-License-Identifier: GPL-3.0+
*
* Author: Guido Günther <agx@sigxcpu.org>
*/
@@ -94,15 +97,15 @@ fbd_feedback_vibra_end (FbdFeedbackBase *base)
g_return_if_fail (klass->end_vibra);
klass->end_vibra (self);
g_clear_handle_id (&priv->timer_id, g_source_remove);
fbd_feedback_base_done (FBD_FEEDBACK_BASE(self));
fbd_feedback_base_done (FBD_FEEDBACK_BASE (self));
}
static void
fbd_feedback_vibra_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
FbdFeedbackVibra *self = FBD_FEEDBACK_VIBRA (object);
FbdFeedbackVibraPrivate *priv = fbd_feedback_vibra_get_instance_private (self);