Multiple Bug's (Live View / Zoom / Shoot) - page 5 - General Discussion and Assistance - CHDK Forum

Multiple Bug's (Live View / Zoom / Shoot)

  • 54 Replies
  • 1394 Views
*

Offline srsa_4c

  • ******
  • 3979
Re: Multiple Bug's (Live View / Zoom / Shoot)
« Reply #40 on: 31 / August / 2019, 05:33:32 »
Advertisements
Procedure is allways !Helperl.bas, see Reply #1, that´s working with all (cams without (key or zoom) issue, (SX700 etc.)).
I do use Zoom keys until crash (at once or later "accidently").
Yeah, I was afraid of that - an all-in-one ubasic script utilizing your language modifications.

Turns out there is an old thread dedicated to set_zoom (thx to waterwingz), with several test scripts.
Can we agree on using the following ones for stress testing: Lua script for cameras with only a few zoom steps and this modified script for cameras where the previous script gets stuck in a loop?

edit:
@ Replay 22 : 4) Subject distance (focus) is re-set to the stored value.
That value might be out of range now, refocus deshifting lenses until mechanical impossible.
-> blocking, Led Panic or even ugly noise. How to avoid that?
As far as I'm concerned, the firmware function we use is safe and does not cause lens damage. The camera is only instructed to set the focus to a certain distance - if it can't be done then the focus will just be elsewhere.
Do you have a camera that produces "ugly noise" after set_zoom or set_focus?
« Last Edit: 31 / August / 2019, 05:41:21 by srsa_4c »

*

Offline Caefix

  • *
  • 28
  • Sorry, busy deleting test shots...
Re: Multiple Bug's (Live View / Zoom / Shoot)
« Reply #41 on: 31 / August / 2019, 14:26:47 »
z4 + zoom_only test great now even if r=0.
Ork moved.
1st. fast approach to modyfy testscript for next stage.
Running it with click line I got Gromlog...

& Sorry, timeout till monday.
Btw. ubasic: no modifations here, they wouldn´t help here either.
All lifetime is a loan from eternity.

*

Offline srsa_4c

  • ******
  • 3979
Re: Multiple Bug's (Live View / Zoom / Shoot)
« Reply #42 on: 31 / August / 2019, 16:58:33 »
z4 + zoom_only test great now even if r=0.
What's the zoom_only test?
Quote
1st. fast approach to modyfy testscript for next stage.
Running it with click line I got Gromlog...
zoomin() can set a negative zoom which is probably not what you want. I'm also not sure whether messing with shoot_half (and aflock) right before/after calling set_zoom is a good idea: the firmware initiated focus adjustment can clash with the CHDK initiated focus adjustment.

*

Offline Caefix

  • *
  • 28
  • Sorry, busy deleting test shots...
Re: Multiple Bug's (Live View / Zoom / Shoot)
« Reply #43 on: 02 / September / 2019, 14:12:09 »
zoom_only: Megaautofocus has no complication by keys or focus...
Testfiles are growing between debugging and rebugging, reacting to messages.
Neg. zoom is probably ignored, not disturbing here.
Script is beautyfied by more switches and logging now. Never ready, for sure.
Set_aflock seems the good idea here, click absolut not.
"ugly noise" after strange gymnastics only. Not quite easy to reproduce, but no need...
All lifetime is a loan from eternity.


*

Offline srsa_4c

  • ******
  • 3979
Re: Multiple Bug's (Live View / Zoom / Shoot)
« Reply #44 on: 06 / September / 2019, 19:21:06 »
I came up with this patch, testing a theory. Test builds for sx210 and sx230 101b are attached.
The change, compared to ztest4, is that set_zoom won't attempt focusing when servo AF or continuous AF is active.
Any crashes when using these builds? I can't get my sx280 to crash either using a vanilla build or with this mod.
Code: [Select]
Index: core/shooting.c
===================================================================
--- core/shooting.c (revision 5266)
+++ core/shooting.c (working copy)
@@ -1212,7 +1212,25 @@
 #if defined(CAM_NEED_SET_ZOOM_DELAY)
         msleep(CAM_NEED_SET_ZOOM_DELAY);
 #endif
+#if defined(CAM_FOCUS_AFTER_ZOOM_ONLY_WHEN_POSSIBLE)
+        if (
+#ifdef PROPCASE_CONTINUOUS_AF
+            !shooting_get_prop(PROPCASE_CONTINUOUS_AF)
+#else
+            1
+#endif
+#ifdef PROPCASE_SERVO_AF
+            &&
+            !shooting_get_prop(PROPCASE_SERVO_AF)
+#endif
+        )
+        {
+            while (focus_busy) msleep(10);
+            shooting_set_focus(dist, SET_NOW);
+        }
+#else  // !CAM_FOCUS_AFTER_ZOOM_ONLY_WHEN_POSSIBLE
         shooting_set_focus(dist, SET_NOW);
+#endif // CAM_FOCUS_AFTER_ZOOM_ONLY_WHEN_POSSIBLE
     }
 }
 
Index: include/camera.h
===================================================================
--- include/camera.h (revision 5266)
+++ include/camera.h (working copy)
@@ -237,6 +237,7 @@
                                                 // different from CAM_USB_EVENTID since it should be undefined on most cameras
 
     #undef  CAM_NEED_SET_ZOOM_DELAY             // Define to add a delay after setting the zoom position before resetting the focus position in shooting_set_zoom
+    #undef  CAM_FOCUS_AFTER_ZOOM_ONLY_WHEN_POSSIBLE // When defined: wait in shooting_set_zoom() while focus busy, skip focusing in continuous focus modes
 
     #undef  CAM_USE_ALT_SET_ZOOM_POINT          // Define to use the alternate code in lens_set_zoom_point()
     #undef  CAM_USE_ALT_PT_MoveOpticalZoomAt    // Define to use the PT_MoveOpticalZoomAt() function in lens_set_zoom_point()
Index: platform/sx210is/platform_camera.h
===================================================================
--- platform/sx210is/platform_camera.h (revision 5266)
+++ platform/sx210is/platform_camera.h (working copy)
@@ -107,6 +107,11 @@
 
     #define CAM_AV_OVERRIDE_IRIS_FIX        1
 
+    #define CAM_FOCUS_AFTER_ZOOM_ONLY_WHEN_POSSIBLE 1 // alternative code path in shooting_set_zoom()
+    #define CAM_USE_OPTICAL_MAX_ZOOM_STATUS 1   // Use ZOOM_OPTICAL_MAX to reset zoom_status when switching from digital to optical zoom in gui_std_kbd_process()
+    #define CAM_USE_ALT_SET_ZOOM_POINT      1    // Define to use the alternate code in lens_set_zoom_point()
+    #define CAM_USE_ALT_PT_MoveOpticalZoomAt 1    // Define to use the PT_MoveOpticalZoomAt() function in lens_set_zoom_point()
+
     #define CAM_SD_OVER_IN_AFL              1
     #define CAM_SD_OVER_IN_MF               1
 
Index: platform/sx210is/sub/100c/stubs_entry.S
===================================================================
--- platform/sx210is/sub/100c/stubs_entry.S (revision 5266)
+++ platform/sx210is/sub/100c/stubs_entry.S (working copy)
@@ -42,7 +42,7 @@
 DEF(canon_menu_active                       ,0x0000368c) // Found @0xff891c4c
 DEF(canon_shoot_menu_active                 ,0x00008511) // Found @0xff9b5a6c
 DEF(playrec_mode                            ,0x000033bc) // Found @0xff883e64
-//DEF(zoom_status                             ,0x0000d544) // Found @0xffad4e40, ** != ** stubs_min = 0x0000d524 (0xD524)
+DEF(zoom_status                             ,0x0000d544) // Found @0xffad4e40
 DEF(some_flag_for_af_scan                   ,0x000075d8) // Found @0xff970d5c
 // focus_len_table contains zoom focus lengths for use in 'get_focal_length' (main.c).
 // each entry contains 3 int value(s), the first is the zoom focus length.
@@ -50,7 +50,7 @@
 DEF(focus_len_table                         ,0xfffea1cc) // Found @0xfffea1cc
 DEF(zoom_busy                               ,0x00007140) // Found @0xff969464
 DEF(focus_busy                              ,0x00006fc8) // Found @0xff9639d0
-//DEF(recreview_hold                          ,0x00004140) // Found @0xff8a3648, ** != ** stubs_min = 0x00008144 (0x804C+0xF8)
+DEF(recreview_hold                          ,0x00004140) // Found @0xff8a3648
 DEF(viewport_buffers                        ,0xffb64808) // Found @0xff84fd4c
 DEF(active_viewport_buffer                  ,0x00002058) // Found @0xff84fae8
 // Camera appears to have only 1 RAW buffer @ 0x41db3b80 (Found @0xffb2fb2c)
Index: platform/sx210is/sub/100c/stubs_min.S
===================================================================
--- platform/sx210is/sub/100c/stubs_min.S (revision 5266)
+++ platform/sx210is/sub/100c/stubs_min.S (working copy)
@@ -1,7 +1,5 @@
 #include "stubs_asm.h"
 
-DEF(zoom_status,                        0xD524)         // ASM1989  09.19.10 -> FFAD4E40  Like in sx20 at FFAAF3EC search for "TerminateDeliverToZoomController"
-DEF(recreview_hold,                     0x804C + 0xF8)  // ASM1989 08.30.2010 looks like FF9A0B38 0x804C  but not sure about 0x0C -> Not Ok 09.19.10 FF9A1684 like in sx20  was F8
 DEF(enabled_refresh_physical_screen,    0x9D48+0x20)    // found at FFA1EE18 and FFA1EFB4 and FFA1EE5C -> ASM1989 08.21.2010 ?guesswork, FFA1EDDC  ->0x20  , but maybe 24???
 DEF(led_table,                          0x24A0 + 0x04)  // found at FF860EF0 & FF860EEC  -> ASM1989 08.21.2010 double checked
 
Index: platform/sx280hs/platform_camera.h
===================================================================
--- platform/sx280hs/platform_camera.h (revision 5266)
+++ platform/sx280hs/platform_camera.h (working copy)
@@ -133,7 +133,8 @@
 
     #define CAM_USE_ALT_SET_ZOOM_POINT          1           // Define to use the alternate code in lens_set_zoom_point()
     #define CAM_USE_ALT_PT_MoveOpticalZoomAt    1           // Define to use the PT_MoveOpticalZoomAt() function in lens_set_zoom_point()
-    #define CAM_NEED_SET_ZOOM_DELAY             300
+    //#define CAM_NEED_SET_ZOOM_DELAY             300
+    #define CAM_FOCUS_AFTER_ZOOM_ONLY_WHEN_POSSIBLE 1 // alternative code path in shooting_set_zoom()
 
     #define MKDIR_RETURN_ONE_ON_SUCCESS         1    // mkdir() return 1 on success, 0 on fail.
 

*

Offline Caefix

  • *
  • 28
  • Sorry, busy deleting test shots...
Re: Multiple Bug's (Live View / Zoom / Shoot)
« Reply #45 on: 07 / September / 2019, 13:18:00 »
 ;) Ork comes in focus...

SX230 + !helperl.bas runs for the 1st time ever, no )(, no crash, few buts in other tests...
Ixus230HS is interesting, )( only, Autozum runs without crash in all settings, r=0.
/TEST/mftest.lua I found very useful to split focus from zoom issue.
« Last Edit: 07 / September / 2019, 14:26:25 by Caefix »
All lifetime is a loan from eternity.

*

Offline srsa_4c

  • ******
  • 3979
Re: Multiple Bug's (Live View / Zoom / Shoot)
« Reply #46 on: 08 / September / 2019, 07:32:24 »
SX230 + !helperl.bas runs for the 1st time ever, no )(, no crash
So, does that mean, ztest5 does not crash when doing set_zoom exercises? Same question for sx210.

You uploaded a lot of other things, I'll only address some of them now.
mftest only needs to be run to determine whether subject distance override is effective in three different modes:
- without any focus lock
- with AF lock enabled
- in MF mode

Setting the camera to manual focus mode requires that the port implements DoMFLock() and UnlockMF() correctly in platform/(camera)/wrappers.c . If the implementation is incorrect, the set_mf script command may not work.

If the camera crashes in one of the above mentioned modes, platform/(camera)/platform_camera.h needs to be changed accordingly by removing one of the following defines
Code: [Select]
    #define CAM_SD_OVER_IN_AF               1
    #define CAM_SD_OVER_IN_AFL              1
    #define CAM_SD_OVER_IN_MF               1
Once these adjustments are done, running mftest should not be necessary.

From your test runs, the sx210 and sx230 tends to crash when the camera's focus is not locked. These ports therefore already disable CAM_SD_OVER_IN_AF.

I see the sx240 crashed once after mftest activated set_mf. Can you check whether "safety mf" is enabled in the Canon menu?
This camera also seems to have succeeded setting focus in AF lock (when the script was set to bypass interlocks), but the port currently has
Code: [Select]
    #define CAM_SD_OVER_IN_AF                   1
    #define CAM_SD_OVER_IN_MF                   1
I wonder why...

*

Offline Caefix

  • *
  • 28
  • Sorry, busy deleting test shots...
Re: Multiple Bug's (Live View / Zoom / Shoot)
« Reply #47 on: 09 / September / 2019, 13:41:22 »
 :D sx210 & sx230:
Both cams passed : !Helperl.bas + oldUbasic + auto-mode + poointAF + md_detect + set_zoom + shooting.
& autozum4 with possible switches.

sx240 : safety mf probably doesn´t matter, both fails to same log.

PS: sx230 : Once I got a motion Vector romlog instead of testshot ??
« Last Edit: 09 / September / 2019, 13:51:58 by Caefix »
All lifetime is a loan from eternity.


*

Offline reyalp

  • ******
  • 12072
Re: Multiple Bug's (Live View / Zoom / Shoot)
« Reply #48 on: 09 / September / 2019, 16:03:46 »
Motion vector romlog previously seen at https://chdk.setepontos.com/index.php?topic=12523.0
A user also reported this to me on sx130 recently.
Don't forget what the H stands for.

*

Offline srsa_4c

  • ******
  • 3979
Re: Multiple Bug's (Live View / Zoom / Shoot)
« Reply #49 on: 09 / September / 2019, 18:16:51 »
:D sx210 & sx230:
Both cams passed : !Helperl.bas + oldUbasic + auto-mode + poointAF + md_detect + set_zoom + shooting.
& autozum4 with possible switches.
Thanks, I guess that's a yes.
Note that this change is solely about set_zoom and doesn't affect anything else.

Quote
sx240 : safety mf probably doesn´t matter, both fails to same log.
That's annoying. How come the defines for sx240 and sx260 (same port essentially) are almost completely wrong. Someone must have tested them earlier...?

@reyalp
Do you have something against adding this patch (I mean the core/shooting.c and include/camera.h part)? It's possible that it could be made better, but I'm not sure how.
The reason I came up with it is that I noticed that many of the set_zoom crashes happen in focus related parts of the firmware. The firmware variable failing a check was suspiciously close to what we call focus_busy. So I thought, instead of waiting blindly for an arbitrary amount of time, why not check for focus_busy? I'm assuming some of the routines we use for setting zoom also adjust focus which can clash with our focus setting attempt in shooting_set_zoom(). I added checks for PROPCASE_CONTINUOUS_AF and PROPCASE_SERVO_AF to hopefully avoid a situation where focus_busy remains busy for extended time, plus these modes adjust focus on their own anyway.

 

Related Topics