Skip to content

Commit 8d0edb3

Browse files
committed
src/drivebase: Fix uninitialized max_duty
In the drive base control, max_duty is not used so it was uninitialized. However this causes problems since pbio_control_settings_set_limits() requires duty >= 1 and the MicroPython bindings pass back the current value to that function when modifying other settings. Issue: pybricks/support#323
1 parent 22ae127 commit 8d0edb3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/pbio/src/drivebase.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ static pbio_error_t drivebase_adopt_settings(pbio_control_settings_t *s_distance
3131
s_distance->pid_ki = (s_left->pid_ki + s_right->pid_ki) / 2;
3232
s_distance->pid_kd = (s_left->pid_kd + s_right->pid_kd) / 2;
3333

34+
// Not used
35+
s_distance->max_duty = 10000;
36+
3437
// Maxima are bound by the least capable motor
3538
s_distance->max_torque = min(s_left->max_torque, s_right->max_torque);
3639
s_distance->stall_time = min(s_left->stall_time, s_right->stall_time);

0 commit comments

Comments
 (0)