Skip to content

Commit 52cad13

Browse files
committed
gphoto: fix range type manual focusing
- `gp_widget_set_value` expects float value for RANGE type widgets - reset the value to 0 before performing the focusing (similar way to RADIO type widget) otherwise the action is not performed by the camera if the same value is used repeatedly Tested with a Sony a6400
1 parent 9d77e2a commit 52cad13

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

indi-gphoto/gphoto_driver.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2328,7 +2328,7 @@ int gphoto_manual_focus(gphoto_driver *gphoto, int speed, char *errMsg)
23282328
}
23292329
case GP_WIDGET_RANGE:
23302330
{
2331-
int rval = speed;
2331+
float rval = speed;
23322332

23332333
/* Range is on Nikon from -32768 <-> 32768 */
23342334
if (strstr(device, "Nikon"))
@@ -2359,6 +2359,11 @@ int gphoto_manual_focus(gphoto_driver *gphoto, int speed, char *errMsg)
23592359
}
23602360
}
23612361

2362+
/* Reset to 0 first so the camera registers a change on repeated calls */
2363+
const float zero = 0;
2364+
gp_widget_set_value(gphoto->focus_widget->widget, &zero);
2365+
gphoto_set_config(gphoto->camera, gphoto->config, gphoto->context);
2366+
23622367
rc = gp_widget_set_value(gphoto->focus_widget->widget, &rval);
23632368
if (rc < GP_OK)
23642369
{

0 commit comments

Comments
 (0)