hook and exposure counter test - General Discussion and Assistance - CHDK Forum supplierdeeply

hook and exposure counter test

  • 21 Replies
  • 8666 Views
*

Offline reyalp

  • ******
  • 14080
hook and exposure counter test
« on: 26 / July / 2015, 17:35:16 »
Advertisements
From the chdkptp thread:
I think the script shooting hooks could be useful in a script for testing hooking success under various shooting conditions...
This seems like a very good idea. In trunk 4194, I added hooktest.lua

This attempts to verify that each hook is reached, and also attempts to check whether the file counter increments by the time the raw hook is entered (i.e. is PAUSE_FOR_FILE_COUNTER required)

The script can test single shoot(), a burst of hold shoot_half + click shoot_full_only (referred to as "fast"), and continuous mode.

A pass / fail is printed in the console, and detailed results are logged in A/hooktest.log

If a hook isn't reached, the single shot test will generate errors like:
Code: [Select]
0020660: FAIL: hook_raw count 0 expect 1
and the fast and cont tests will generate errors like:
Code: [Select]
0037700: FAIL: hook_raw wait timeout

If the file counter isn't incremented when the raw hook is entered, you will get something like
Code: [Select]
0527810: FAIL: exp count 9812 expect 9813

All my cameras pass the tests, except for the A540 file counter issue mentioned below.

The log lines are timestamped with get_tick_count so you can see how much time passes waiting for the hooks etc. The exposure counter is also logged at various points.

There are a number of quirks and possible false positives:
* On old cameras like A540, get_exp_count() does not return the same value used for raw file numbering. This will cause the fast and cont exposure count tests to fail once per run. Due to a quirk in the script, only the first shot of a burst will be counted as a failure. On these cameras, it appears the file counter always updates after the raw hook, so code defines get_file_next_counter to be file counter + 1. However, get_exp_count() always returns the actual file counter. This has various implications for scripts that use get_exp_count()

* The test for PAUSE_FOR_FILE_COUNTER doesn't seem to be definitive. ixus140, which needs this but usually only requires a 10ms sleep didn't report any errors in a build with the define removed. I suspect this is due to the sleep loops in the hook system allowing enough time for it to increment. Shooting a burst of raw+jpeg in continuous mode and verifying there is an equal number of files is probably a better test.

* The file counter test tries to handle wrapping (9999->1) but I haven't verified this, and there may be other cases where the file counter will reset.

* If the camera isn't in canon continuous mode, the cont test will be skipped.

This script is currently only in the trunk, but aside from the new style script parameters, I think it should be compatible with 1.3.
Don't forget what the H stands for.

*

Offline c_joerg

  • *****
  • 1248
Re: hook and exposure counter test
« Reply #1 on: 27 / July / 2015, 14:10:40 »
Made two runs with S110…
One with Canon cont mode set and one without.
I have couple of fails, when I enable Canon cont mode but have not really understand why… ;)

 Huups … I’m a Full Member right now…  :)
« Last Edit: 27 / July / 2015, 14:18:51 by c_joerg »
M100 100a, M3 121a, G9x II (1.00c), 2*G1x (101a,100e), S110 (103a), SX50 (100c), SX230 (101a), S45,
Flickr https://www.flickr.com/photos/136329431@N06/albums
YouTube https://www.youtube.com/channel/UCrTH0tHy9OYTVDzWIvXEMlw/videos?shelf_id=0&view=0&sort=dd

*

Offline reyalp

  • ******
  • 14080
Re: hook and exposure counter test
« Reply #2 on: 27 / July / 2015, 16:12:19 »
Made two runs with S110…
One with Canon cont mode set and one without.
I have couple of fails, when I enable Canon cont mode but have not really understand why… ;)
Thanks.
The first one, I think the image count reset, maybe due to your folder / image number settings in the canon firmware. It expected the counter to be 4 after the shot, when it really reset to 1.

The cont result shows this camera needs PAUSE_FOR_FILE_COUNTER (and as a bonus, verifies that the script can detect this condition :D)
Code: [Select]
0110540: exp=0007 hook_raw wait
0110810: exp=7 hook_raw ready
0110840: FAIL: exp count 7 expect 8
0111050: exp count increment late: 180
This means that when the raw hook was ready, the exposure counter was still 0007. After 180ms, it became 0008, like it was supposed to be.

It turns out PAUSE_FOR_FILE_COUNTER is already 300 on this camera. This shows a mistake in my script logic,  I assumed the pause would be used if the hook was set and foolishly didn't check the code, but it's actually only used if CHDK raw or remote capture is enabled.

Since the max wait was 240, the current sx110 code should be fine.

I could make it wait if the hook was set, but it's probably better to just change the script result to an informational message, rather than forcing the pause on hook scripts that might not want the extra delay.
Don't forget what the H stands for.

*

Offline c_joerg

  • *****
  • 1248
Re: hook and exposure counter test
« Reply #3 on: 28 / July / 2015, 02:05:39 »
Quote
The first one, I think the image count reset, maybe due to your folder / image number settings in the canon firmware. It expected the counter to be 4 after the shot, when it really reset to 1.

On this run it was reset to 1, so first image was IMG_0001.
There is one think about cont mode, which I have also seen on G1x and I’m not sure, if this has something to do with this.
Sometimes I have one picture more as expect in cont mode. So when I run isoinc in cont mode from sv96=520 until 740, I expect 221 pictures. But sometimes I have 222 pictures. I thought, this has something to do with the method, how continues mode works.
M100 100a, M3 121a, G9x II (1.00c), 2*G1x (101a,100e), S110 (103a), SX50 (100c), SX230 (101a), S45,
Flickr https://www.flickr.com/photos/136329431@N06/albums
YouTube https://www.youtube.com/channel/UCrTH0tHy9OYTVDzWIvXEMlw/videos?shelf_id=0&view=0&sort=dd


*

Offline c_joerg

  • *****
  • 1248
Re: hook and exposure counter test
« Reply #4 on: 28 / July / 2015, 11:37:43 »
and the test from G1x...
M100 100a, M3 121a, G9x II (1.00c), 2*G1x (101a,100e), S110 (103a), SX50 (100c), SX230 (101a), S45,
Flickr https://www.flickr.com/photos/136329431@N06/albums
YouTube https://www.youtube.com/channel/UCrTH0tHy9OYTVDzWIvXEMlw/videos?shelf_id=0&view=0&sort=dd

*

Offline reyalp

  • ******
  • 14080
Re: hook and exposure counter test
« Reply #5 on: 28 / July / 2015, 22:39:18 »
I thought, this has something to do with the method, how continues mode works.
Quite possible, the camera might start a new shot when the script is processing the last shot but still has the shoot_full button held down.

Quote
and the test from G1x...
This looks pretty similar to s110. The first fail is the file counter resetting, and the ones in cont are for PAUSE_FOR_FILE_COUNTER
Quote
0116460: exp=7 hook_raw ready
0116470: FAIL: exp count 7 expect 8
0116720: exp count increment late: 220
In the code PAUSE_FOR_FILE_COUNTER is 150, so which is less than the time reported in the script, so there might be a problem.

To test, you can enable CHDK raw (not canon raw) and shoot some shots in continuous mode, without any script. 10 should be plenty. Then check if there is one raw for every jpeg file. If some raws are missing, there is a problem.

« Last Edit: 29 / July / 2015, 16:50:18 by reyalp »
Don't forget what the H stands for.

*

Offline c_joerg

  • *****
  • 1248
Re: hook and exposure counter test
« Reply #6 on: 29 / July / 2015, 12:04:09 »
Quote
To test, you can enable CHDK raw (not canon raw) and shoot some shots in continuous mode, without any script. 10 should be plenty. Then check if there is one raw for every jpeg file. If some raws are missing, there is a problem.

I make 4 tests in continuous mode, 2 with G1x and 2 with S110.

G1x
1)  IMG_0001.JPG .. IMG_00018.JPG and CRW_0001.DNG .. CRW_0017.DNG
     last DNG is missing
2)  IMG_0001.JPG .. IMG_00014.JPG and CRW_0001.DNG .. CRW_0013.DNG
     last DNG is missing again.

S110 (not SX110!)
1)  IMG_0001.JPG .. IMG_00016.JPG and CRW_0001.DNG .. CRW_0015.DNG
     last DNG is missing and CRW_0012.DNG is missing!
2)  IMG_0001.JPG .. IMG_00019.JPG and CRW_0001.DNG .. CRW_0019.DNG
     OK

 Something to worry about?


M100 100a, M3 121a, G9x II (1.00c), 2*G1x (101a,100e), S110 (103a), SX50 (100c), SX230 (101a), S45,
Flickr https://www.flickr.com/photos/136329431@N06/albums
YouTube https://www.youtube.com/channel/UCrTH0tHy9OYTVDzWIvXEMlw/videos?shelf_id=0&view=0&sort=dd

*

Offline reyalp

  • ******
  • 14080
Re: hook and exposure counter test
« Reply #7 on: 29 / July / 2015, 23:20:42 »
Something to worry about?
Yes, suggests both need a longer PAUSE_FOR_FILE_COUNTER. This should generally only cause a problem if you are shooting CHDK raw/DNG, so probably doesn't affect too many people using these cams. I'll post some test builds later.
Don't forget what the H stands for.


*

Offline reyalp

  • ******
  • 14080
Re: hook and exposure counter test
« Reply #8 on: 01 / August / 2015, 23:06:13 »
I updated the test script in trunk 4199. There's no need to re-check previously tested cameras.

Changes
* Do initial shot without exp count check to avoid false positives on counter reset.
If you have "auto reset" set in the camera numbering option and wipe the DCIM directory, the exposure counter seems to reset after the first shot. To avoid false positives, the "single" test does a shot without checking the exposure counter.

* Add script option for CHDK raw, off by default.
Because of the fact the PAUSE_FOR_FILE_COUNTER is only done if raw is enabled, it seems better to control this explicitly.

* Don't count late exp count increment as failure if raw not enabled
The script now only records a failure if the exposure counter was late, and raw was enabled. If it's late without raw enabled, it now prints / logs "PAUSE_FOR_FILE_COUNTER required?" at the end of the test.
If raw was enabled, it counts as a failure, since that indicates the pause wasn't long enough. It also prints "PAUSE_FOR_FILE_COUNTER short/missing?" at the end. Note this could get confused by raw exceptions, since the script only knows about whether raw was enabled in the menu, while the wait is only done if a raw would actually be saved.

* Print summary at end of test
In addition to the file counter message above,  if one of the hooks time out, messages will be printed + logged suggesting which hook to check.

* Include image dir in logging along with exp number.
This might clarify some of the counter reset cases, and also show bugs in the directory function.
Don't forget what the H stands for.

*

Offline reyalp

  • ******
  • 14080
Re: hook and exposure counter test
« Reply #9 on: 02 / August / 2015, 18:27:11 »
 c_joerg,

here are test builds
s110 103a https://app.box.com/s/a5yqsd83pgqzbnzaa8b2rsxunl4rx0pn
g1x 101a https://app.box.com/s/m66dzu1i4vvoldoteijgru4qk8avt6sx


To test:
In the raw menu, enable CHDK raw, disable DNG format
In miscellaneous -> debug, enable "Show Misc. vals". This will show 4 numbers in the lower right of the screen.
Shoot some photos in continuous mode, ~10 should be fine.
After shooting, note the values of FTO, FMN and FMX in the misc vals display.
As before, check if any jpegs don't have a matching CHDK raw.

The debug values are only reset on reboot.

FTO = number of times the full pause was used without the counter incrementing, either because the pause is too short, or the file counter is already incremented.
FMN = minimum time waited (if not FTO)
FMX = maximum time waited (if not FTO)

Debug patch is attached for future reference.
Don't forget what the H stands for.

 

Related Topics