here's the patch

-- 
Johannes 

Am 2015-12-19 20:01, schrieb Dr. Johannes Zellner:

> Hi, 
> 
> I'm still trying to have a possibility in tethering to trigger autofocus (AF) 
> manually but not automatically.
> This is useful, if AF fails in a difficult scene -- currently, if AF fails, 
> capturing fails too. 
> 
> Here's my idea: 
> 
> Even if AF is turned on at the lens, gphoto2 allows to bypass AF when 
> capturing.
> There are two possibilities how to do this: 
> 
> * 
> 
> Canon EOS cameras (and probably for others too) can be configured not to 
> trigger AF when pressing down the capture button. AF is still possible but it 
> has to be done with a different button on the backside of the body. If the 
> camera is configured like this, gphoto2 allows to do AF and capturing 
> independently from each other like this:
> 
> gphoto2 --set-config autofocusdrive=1 --wait-event=5s
> gphoto2 --capture-image-and-download
> 
> * 
> 
> there's also a second method to bypass AF which doesn't even need the camera 
> to be configured not to trigger AF when pressing the capture button:
> 
> gphoto2 --set-config eosremoterelease=4 --set-config eosremoterelease=5 
> --capture-tethered=5
> 
> For method 1. to be used from darktable, I tried to implement the 
> --set-config autofocusdrive=1 command in dt. Essentially I implemented a 
> button (an eye symbol right from the manual focus buttons) which triggers
> 
> dt_camctl_camera_set_property_int(darktable.camctl, NULL, "autofocusdrive", 
> 1);
> 
> This indeed triggers AF the first time I click on the newly implemented 
> button and starts the camera's AF search.
> Unfortunately, after having used this AF button once, the tethering session 
> hangs somehow and no further commands can be sent to the camera. 
> 
> Any help on how to implement this correctly would be much appreciated.
> 
> ​ 
> --  
> Johannes 
> ___________________________________________________________________________ 
> darktable developer mailing list to unsubscribe send a mail to 
> [email protected]
___________________________________________________________________________
darktable developer mailing list
to unsubscribe send a mail to [email protected]
*** ./live_view.c.orig	2015-12-19 19:52:50.635784088 +0100
--- ./live_view.c	2015-12-19 14:48:25.399612396 +0100
***************
*** 71,77 ****
    gboolean splitline_dragging;
  
    GtkWidget *live_view, *live_view_zoom, *rotate_ccw, *rotate_cw, *flip;
!   GtkWidget *focus_out_small, *focus_out_big, *focus_in_small, *focus_in_big;
    GtkWidget *guide_selector, *flip_guides, *guides_widgets;
    GList *guides_widgets_list;
    GtkWidget *overlay, *overlay_id_box, *overlay_id, *overlay_mode, *overlay_splitline;
--- 71,77 ----
    gboolean splitline_dragging;
  
    GtkWidget *live_view, *live_view_zoom, *rotate_ccw, *rotate_cw, *flip;
!   GtkWidget *focus_out_small, *focus_out_big, *focus_in_small, *focus_in_big, *focus_af;
    GtkWidget *guide_selector, *flip_guides, *guides_widgets;
    GList *guides_widgets_list;
    GtkWidget *overlay, *overlay_id_box, *overlay_id, *overlay_mode, *overlay_splitline;
***************
*** 185,190 ****
--- 185,191 ----
    dt_accel_connect_button_lib(self, "move focus point in (small steps)", GTK_WIDGET(lib->focus_in_small));
    dt_accel_connect_button_lib(self, "move focus point out (small steps)", GTK_WIDGET(lib->focus_out_small));
    dt_accel_connect_button_lib(self, "move focus point out (big steps)", GTK_WIDGET(lib->focus_out_big));
+   dt_accel_connect_button_lib(self, "trigger autofocus", GTK_WIDGET(lib->focus_af));
  }
  
  static void _rotate_ccw(GtkWidget *widget, gpointer user_data)
***************
*** 235,240 ****
--- 236,247 ----
    dt_camctl_camera_set_property_choice(darktable.camctl, NULL, "manualfocusdrive", focus);
  }
  
+ static void _focus_af(GtkWidget *widget, gpointer user_data)
+ {
+   // user_data is unused
+   dt_camctl_camera_set_property_int(darktable.camctl, NULL, "autofocusdrive", 1);
+ }
+ 
  static void _toggle_flip_clicked(GtkWidget *widget, gpointer user_data)
  {
    dt_camera_t *cam = (dt_camera_t *)darktable.camctl->active_camera;
***************
*** 311,321 ****
--- 318,331 ----
                                                                     | CPF_DIRECTION_RIGHT); // TODO same here
    lib->focus_out_big = dtgtk_button_new(dtgtk_cairo_paint_solid_triangle,
                                          CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER | CPF_DIRECTION_RIGHT);
+   lib->focus_af = dtgtk_button_new(dtgtk_cairo_paint_eye,
+                                         CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER | CPF_DIRECTION_RIGHT);
  
    gtk_box_pack_start(GTK_BOX(box), lib->focus_in_big, TRUE, TRUE, 0);
    gtk_box_pack_start(GTK_BOX(box), lib->focus_in_small, TRUE, TRUE, 0);
    gtk_box_pack_start(GTK_BOX(box), lib->focus_out_small, TRUE, TRUE, 0);
    gtk_box_pack_start(GTK_BOX(box), lib->focus_out_big, TRUE, TRUE, 0);
+   gtk_box_pack_start(GTK_BOX(box), lib->focus_af, TRUE, TRUE, 0);
  
    g_object_set(G_OBJECT(lib->focus_in_big), "tooltip-text", _("move focus point in (big steps)"),
                 (char *)NULL);
***************
*** 325,330 ****
--- 335,342 ----
                 (char *)NULL);
    g_object_set(G_OBJECT(lib->focus_out_big), "tooltip-text", _("move focus point out (big steps)"),
                 (char *)NULL);
+   g_object_set(G_OBJECT(lib->focus_af), "tooltip-text", _("trigger autofocus"),
+                (char *)NULL);
  
    // Near 3
    g_signal_connect(G_OBJECT(lib->focus_in_big), "clicked", G_CALLBACK(_focus_button_clicked),
***************
*** 338,343 ****
--- 350,358 ----
    // Far 3
    g_signal_connect(G_OBJECT(lib->focus_out_big), "clicked", G_CALLBACK(_focus_button_clicked),
                     GINT_TO_POINTER(6));
+   // autofocus
+   g_signal_connect(G_OBJECT(lib->focus_af), "clicked", G_CALLBACK(_focus_af),
+                    GINT_TO_POINTER(0));
  
    // Guides
    lib->guide_selector = dt_bauhaus_combobox_new(NULL);

Reply via email to