Author Topic: Auto ETTR on EOSM  (Read 24435 times)

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12564
Re: Auto ETTR on EOSM
« Reply #25 on: March 06, 2014, 08:33:22 AM »
Yes, sounds good. You will need to export it to modules as a function though (since camera-specific ifdef's won't end up in module code).

I'm not sure what to suggest about SET (without trying, it's hard to evaluate how it feels like, and I don't know how essential is the Q menu on the M). Maybe sketching up some UI scenarios or maybe a mockup could be useful.

Another button... I guess it's unlikely to find one. Gestures would be probably cool, but not sure how practical (not to mention the implementation). An icon where you could tap? no idea, never tried a touch-screen camera.

Morghus

  • New to the forum
  • *
  • Posts: 33
  • 6D/EOS M
Re: Auto ETTR on EOSM
« Reply #26 on: March 07, 2014, 01:08:10 AM »
Made a pull request, double tapping the screen will trigger ETTR.

I also found out why ETTR in combination with the intervalometer doesn't work: in auto_ettr_step() the following line fails:

Code: [Select]
    if (lens_info.raw_shutter == 0 && is_m) return;
raw_shutter seems to be 0, right before taking a photo it is set correctly, something seems to set it to 0 while or after taking a photo... I tried commenting out that line and it seems to fix it but I think corrections aren't always dead on, it takes one or two photos to settle fully.

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12564
Re: Auto ETTR on EOSM
« Reply #27 on: March 07, 2014, 07:42:14 AM »
Will check it, thanks.

In M mode, auto_ettr_work_m starts with tv = lens_info.raw_shutter. If that one is not valid (does not contain your current shutter speed), the math will be broken. Normally, on other cameras, it happens while flash is recharging, but not in QR. Maybe you can have a loop that prints this value to see whether we may need to wait or something?

So... were you able to turn off LiveView on the M? I've asked somewhere else and IIRC it wasn't possible.

Morghus

  • New to the forum
  • *
  • Posts: 33
  • 6D/EOS M
Re: Auto ETTR on EOSM
« Reply #28 on: March 07, 2014, 10:06:08 PM »
So... were you able to turn off LiveView on the M? I've asked somewhere else and IIRC it wasn't possible.
Code: [Select]
NotifyBox(1000, "%d %d ", lv, raw_lv_is_enabled());
Pressing INFO cycles through these modes:
I'll test lens_info.raw_shutter next!

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12564
Re: Auto ETTR on EOSM
« Reply #29 on: March 07, 2014, 10:08:23 PM »
Yap. Can you take pictures from that screen with photo settings without going back to LiveView?

(this is what ETTR expects in Always On / Auto Snap settings outside LiveView)

Morghus

  • New to the forum
  • *
  • Posts: 33
  • 6D/EOS M
Re: Auto ETTR on EOSM
« Reply #30 on: March 07, 2014, 10:10:10 PM »
No, unfortunately as soon as you press half shutter it goes back to LV

Morghus

  • New to the forum
  • *
  • Posts: 33
  • 6D/EOS M
Re: Auto ETTR on EOSM
« Reply #31 on: March 07, 2014, 10:52:29 PM »
I tried a few things:
  • lens_info.raw_shutter regains a value around 1 second after QR popped up
  • In PROP_HANDLER(PROP_GUI_STATE) I can't wait for that value because lens_info.raw_shutter only regains a value after this function returned (I actually tried this, as if I waited 2 seconds it took exactly 2 seconds for raw_shutter to get a value)
  • I tried creating a task with TASK_CREATE() and waiting for raw_shutter there, same behavior as if I just wait in PROP_HANDLER(PROP_GUI_STATE)
  • vsync_cbr is not called while QR is active, so I can't check raw_shutter there and, if necessary, start ETTR
  • debug_task sees raw_shutter regain a value before QR is over

I don't know if I should create a background task in ettr that always runs, like the vsync_cbr, checking for the right conditions... would be a waste of resources. I don't know if there are any background tasks that I could use for that, any suggestions?

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12564
Re: Auto ETTR on EOSM
« Reply #32 on: March 07, 2014, 10:59:57 PM »
What about something like this?

Code: [Select]
diff -r 811c68f776a5 modules/ettr/ettr.c
--- a/modules/ettr/ettr.c Thu Mar 06 22:29:09 2014 +0200
+++ b/modules/ettr/ettr.c Fri Mar 07 23:57:52 2014 +0200
@@ -620,6 +620,16 @@
 
 static int auto_ettr_work(int corr)
 {
+    if (it's going to call auto_ettr_work_m)
+    {
+        /* in M mode, wait until shutter speed is reported by Canon firmware */
+        while (lens_info.raw_shutter == 0)
+        {
+            msleep(50);
+            /* add some timeout handling, e.g. 1-2 seconds */
+        }
+    }
+
     /* save initial exposure settings so we can print them */
     char* expo_settings = get_current_exposure_settings();
     snprintf(prev_exposure_settings, sizeof(prev_exposure_settings), "%s", expo_settings);
@@ -699,7 +709,6 @@
     if (shooting_mode != SHOOTMODE_M && shooting_mode != SHOOTMODE_AV && shooting_mode != SHOOTMODE_TV && shooting_mode != SHOOTMODE_P && shooting_mode != SHOOTMODE_MOVIE) return;
     int is_m = (shooting_mode == SHOOTMODE_M || shooting_mode == SHOOTMODE_MOVIE);
     if (lens_info.raw_iso == 0 && is_m) return;
-    if (lens_info.raw_shutter == 0 && is_m) return;
     if (auto_ettr_running) return;
     if (is_hdr_bracketing_enabled() && !AUTO_ETTR_TRIGGER_BY_SET) return;

Basically, I've moved that check in the background task created from the prop handler; there you don't have any restrictions regarding waiting, and there should be no side effects for the other cameras.

1%

  • Developer
  • Hero Member
  • *****
  • Posts: 5936
  • 600D/6D/50D/EOSM/7D
Re: Auto ETTR on EOSM
« Reply #33 on: March 07, 2014, 11:00:57 PM »
why is it instant in av/tv?

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12564
Re: Auto ETTR on EOSM
« Reply #34 on: March 07, 2014, 11:02:57 PM »
In av/tv it only has to adjust exposure compensation; in M it decides shutter and ISO.

Imagine how it would look if it would also decide aperture.

Morghus

  • New to the forum
  • *
  • Posts: 33
  • 6D/EOS M
Re: Auto ETTR on EOSM
« Reply #35 on: March 07, 2014, 11:21:14 PM »
Works perfectly now! I added a timeout and a status, how does this look?

Code: [Select]
diff -r 811c68f776a5 modules/ettr/ettr.c
--- a/modules/ettr/ettr.c Thu Mar 06 22:29:09 2014 +0200
+++ b/modules/ettr/ettr.c Fri Mar 07 23:19:25 2014 +0100
@@ -40,6 +40,7 @@
 #define AUTO_ETTR_TRIGGER_BY_HALFSHUTTER_DBLCLICK (auto_ettr_trigger == 3)
 
 /* status codes */
+#define ETTR_EXPO_PRECOND_TIMEOUT -2
 #define ETTR_EXPO_LIMITS_REACHED -1
 #define ETTR_NEED_MORE_SHOTS 0
 #define ETTR_SETTLED 1
@@ -620,6 +621,21 @@
 
 static int auto_ettr_work(int corr)
 {
+    if (shooting_mode == SHOOTMODE_M || shooting_mode == SHOOTMODE_MOVIE)
+    {
+        /* in M mode, wait until shutter speed is reported by Canon firmware */
+        int waited = 0;
+        while (lens_info.raw_shutter == 0)
+        {
+            if (waited > 2000)
+            {
+                return ETTR_EXPO_PRECOND_TIMEOUT;
+            }
+            msleep(50);
+            waited += 50;
+        }
+    }
+
     /* save initial exposure settings so we can print them */
     char* expo_settings = get_current_exposure_settings();
     snprintf(prev_exposure_settings, sizeof(prev_exposure_settings), "%s", expo_settings);
@@ -671,6 +687,13 @@
         msleep(1000);
         bmp_printf(FONT_MED, 0, os.y0, "ETTR: expo limits reached\n%s", get_current_exposure_settings());
     }
+    else if (status == ETTR_EXPO_PRECOND_TIMEOUT)
+    {
+        beep_times(3);
+        ettr_pics_took = 0;
+        msleep(1000);
+        bmp_printf(FONT_MED, 0, os.y0, "ETTR: timeout while waiting for preconditions\n");
+    }
     else if (AUTO_ETTR_TRIGGER_AUTO_SNAP)
     {
         /* take another pic */
@@ -699,7 +722,6 @@
     if (shooting_mode != SHOOTMODE_M && shooting_mode != SHOOTMODE_AV && shooting_mode != SHOOTMODE_TV && shooting_mode != SHOOTMODE_P && shooting_mode != SHOOTMODE_MOVIE) return;
     int is_m = (shooting_mode == SHOOTMODE_M || shooting_mode == SHOOTMODE_MOVIE);
     if (lens_info.raw_iso == 0 && is_m) return;
-    if (lens_info.raw_shutter == 0 && is_m) return;
     if (auto_ettr_running) return;
     if (is_hdr_bracketing_enabled() && !AUTO_ETTR_TRIGGER_BY_SET) return;
 

Morghus

  • New to the forum
  • *
  • Posts: 33
  • 6D/EOS M
Re: Auto ETTR on EOSM
« Reply #36 on: March 08, 2014, 12:16:27 AM »

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12564
Re: Auto ETTR on EOSM
« Reply #37 on: March 08, 2014, 07:49:14 AM »
Great! Will try to polish them and merge later today or tomorrow, along with a few others in the queue that I have yet to try myself.