D20 porting thread - page 3 - DryOS Development - CHDK Forum supplierdeeply

D20 porting thread

  • 45 Replies
  • 13005 Views
*

Offline lapser

  • *****
  • 1093
Re: D20 porting thread
« Reply #20 on: 23 / August / 2013, 16:23:10 »
Advertisements
What code are you looking at? In platform/d20/lib.c you should see the following:

See the following http://trac.assembla.com/chdk/changeset/3007/trunk and forum link in the commit message.
Thanks reyalp. Oops, I'm still back on 2995. That would explain it.

[EDIT] Everything works right in Trunk 3038 now. Thanks again.
« Last Edit: 23 / August / 2013, 17:00:46 by lapser »
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

*

Offline lapser

  • *****
  • 1093
Re: D20 porting thread
« Reply #21 on: 23 / August / 2013, 20:45:20 »
I discovered that there is no <display> button on the D20. Like the G1X, it uses the <down> button for <display> too. The G1X maps an extra button to <display>, but the only extra button on the D20 appears to be the <video> button.

Would it be OK to map the <video> button to both <video> and <display> for script input? Could we also map the <play> button to <display>, in case <video> is being used as <alt>?

Also, how often do the files in the full version of CHDK (i.e. the CHDK folder) change? That is, when do I have to update all the files on the SD card instead just the compiled ones? I updated the full versions for 1.3 for all my cameras, but I'm not sure this was necessary.
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

*

Offline reyalp

  • ******
  • 13386
Re: D20 porting thread
« Reply #22 on: 23 / August / 2013, 20:53:19 »
Would it be OK to map the <video> button to both <video> and <display> for script input? Could we also map the <play> button to <display>, in case <video> is being used as <alt>?
I think it would be better to make the script adapt it's button usage rather than make keys aliases to things that they don't actually do. If you map video to display, then click("display") will start recording a video.

This raises an issue the issue that there isn't a good way for a script to find out what buttons are present. Perhaps we can address this in 1.3.
Quote
Also, how often do the files in the full version of CHDK (i.e. the CHDK folder) change? That is, when do I have to update all the files on the SD card instead just the compiled ones? I updated the full versions for 1.3 for all my cameras, but I'm not sure this was necessary.
They change when they change, the only way to know is to follow the svn commits. In general, it's pretty rare, and the most likely changes would be something new in one of the autogenerated lua files.
Don't forget what the H stands for.

*

Offline lapser

  • *****
  • 1093
Re: D20 porting thread
« Reply #23 on: 23 / August / 2013, 21:58:16 »
I think it would be better to make the script adapt it's button usage rather than make keys aliases to things that they don't actually do. If you map video to display, then click("display") will start recording a video.
On the G1X, <display> is mapped to the "metering" button. I just wrote a script that does click("display"), and it clicks the metering button. Yes, that's not ideal, but I can't imagine a script clicking that button on the G1X. However, the <video> button is a different story.

One idea would be to give each key name an input and an output mapping. click("display") and click("down") would both click the same key, since it's double mapped depending on context. But is_key("display") would map to the "metering" (or "video" button on the D20). This way, a script could depend on a camera independent minimal set of buttons that would include display, up, down, left, right, set, menu, shoot_full, shoot_half, video, zoom in, and zoom out.
Quote
This raises an issue that there isn't a good way for a script to find out what buttons are present. Perhaps we can address this in 1.3.
That would be nice, too. Maybe that could be another auto generated file in CHDK/LUALIB even?
Quote
They change when they change, the only way to know is to follow the svn commits. In general, it's pretty rare, and the most likely changes would be something new in one of the autogenerated lua files.
I noticed that CHDKPTP and PTPCamGUI were showing various errors related to those lua files, although they still worked. The errors seem to have gone away since I updated the files. Does that sound like what might happen with older files?
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos


*

Offline reyalp

  • ******
  • 13386
Re: D20 porting thread
« Reply #24 on: 23 / August / 2013, 22:14:35 »
That would be nice, too. Maybe that could be another auto generated file in CHDK/LUALIB even?
Hmm. Currently the generated files are not unique to the build, that is lualib/gen will is identical for every build. I think we want to keep it that way, and adding 100+ unique files with the key list for each camera would not be good. We could define "key sets" like we have "propsets" but there's a lot of weird variations and someone would have to go back and define them all for every camera.

Since we already have a keymap in kbd.c, it seems like exposing that in some form would be better. Maybe something like is_valid_key("keyname") or something that returns a list.
Quote
I noticed that CHDKPTP and PTPCamGUI were showing various errors related to those lua files, although they still worked. The errors seem to have gone away since I updated the files. Does that sound like what might happen with older files?
Without knowing what the errors are, it's hard to say. chdkptp does rely on the modelist
Don't forget what the H stands for.

*

Offline lapser

  • *****
  • 1093
Re: D20 porting thread
« Reply #25 on: 24 / September / 2013, 23:34:53 »
I've been working with ND filters lately, and decided to explore the D20. The D20 uses the ND filter as an Aperture adjustment, so there are really only 2 apertures. The D20 automatically sets the ND filter IN or OUT based on the measured light level. All it has is "P" mode, so there's no way to manually set the Aperture (no Av mode).

To get the camera to switch the ND filter to IN, you can point it at a light bulb. Doing this zoomed out I get:

av96=387  for a low light scene
av96=579  pointed at a bright light bulb

So the ND filter density is 192, or 2 f-stops. For each zoom step, you can just add 192 to av96 if the ND filter is IN.

http://chdk.setepontos.com/index.php?topic=9722.msg100580#msg100580
I looked at the log data mentioned in this post, and it looks like the ND filter was always OUT.  set_nd_filter() doesn't work, because the camera just overrides it to set aperture.

Here's the script I used: The script takes a picture every time av96 changes. I looked at the pictures in play mode on the camera, and added the displayed Aperture to the log every time it changed.
Code: [Select]
--[[
@title Aperture Test
@param p Log File
@default p 1
--]]
function press_half()
  press("shoot_half")
  repeat sleep(10) until get_shooting()
end

function release_half()
  release("shoot_half")
  while(get_shooting())do sleep(10) end
end

print_screen(p)
print(os.date())
bi=get_buildinfo()
print("platform: ",bi.platform,bi.platsub)

nzoom=get_zoom_steps()-1
print("nzoom=",nzoom)
set_zoom_speed(100)
av0=0
repeat
  for z=0,nzoom do
    set_zoom(z)
    press_half()
    av=get_av96()
    if(av~=av0)then
      click("shoot_full_only")
      av0=av
      print()
    end
    release_half()
    print(z,av,get_exp_count())
  end
  print("set repeats, menu exits")
  wait_click()
until is_key("menu")
Here's the log data, with [added explanations]:
Code: [Select]
Tue Sep 24 19:16:04 2013
platform:  d20 100b
nzoom= 128

[pointed at low light scene so ND filter is OUT]
[zoom step | av96 | IMG_xxxx | Displayed aperture (in play mode)]
0 387 748 [F3.9]
1 387 748
2 387 748
3 387 748
4 387 748
5 387 748
6 387 748
7 387 748
8 387 748

9 388 749
10 388 749
11 388 749
12 388 749
13 388 749
14 388 749
15 388 749
16 388 749
17 388 749

18 389 750
19 389 750
20 389 750
21 389 750
22 389 750
23 389 750
24 389 750

25 390 751
26 390 751
27 390 751
28 390 751
29 390 751
30 390 751

31 391 752
32 391 752
33 391 752
34 391 752
35 391 752

36 392 753
37 392 753
38 392 753
39 392 753

40 393 754
41 393 754
42 393 754
43 393 754

44 394 755
45 394 755
46 394 755
47 394 755

48 395 756
49 395 756
50 395 756

51 396 757
52 396 757
53 396 757

54 397 758
55 397 758
56 397 758

57 398 759
58 398 759
59 398 759

60 399 760
61 399 760
62 399 760

63 400 761 [F4.5]
64 400 761

65 401 762
66 401 762
67 401 762

68 402 763
69 402 763

70 403 764
71 403 764

72 404 765
73 404 765

74 405 766
75 405 766

76 406 767
77 406 767

78 407 768
79 407 768

80 408 769
81 408 769

82 409 770
83 409 770

84 410 771
85 410 771

86 411 772
87 411 772

88 412 773

89 413 774
90 413 774

91 414 775

92 415 776
93 415 776

94 416 777
95 416 777

96 417 778

97 418 779
98 418 779

99 419 780

100 420 781
101 420 781

102 421 782

103 422 783
104 422 783

105 423 784

106 424 785

107 425 786
108 425 786

109 426 787

110 427 788

111 428 789
112 428 789

113 429 790

114 430 791

115 431 792
116 431 792

117 432 793 [F5.0]

118 433 794

119 434 795
120 434 795

121 435 796

122 436 797

123 437 798
124 437 798

125 438 799
126 438 799

127 439 800
128 439 800

[Pointed at bright light bulb so ND filter is IN]
set repeats, menu exits

0 579 801 [F8.0]
1 579 801
2 579 801
3 579 801
4 579 801
5 579 801
6 579 801
7 579 801
8 579 801

9 580 802
10 580 802
11 580 802
12 580 802
13 580 802
14 580 802
15 580 802
16 580 802
17 580 802

18 581 803
19 581 803
20 581 803
21 581 803
22 581 803
23 581 803
24 581 803

25 582 804
26 582 804
27 582 804
28 582 804
29 582 804
30 582 804

31 583 805
32 583 805
33 583 805
34 583 805
35 583 805

36 584 806
37 584 806
38 584 806
39 584 806

40 585 807
41 585 807
42 585 807
43 585 807

44 586 808
45 586 808
46 586 808
47 586 808

48 587 809
49 587 809
50 587 809

51 588 810
52 588 810
53 588 810

54 589 811
55 589 811
56 589 811

57 590 812
58 590 812
59 590 812

60 591 813
61 591 813
62 591 813

63 592 814 [F9.0]
64 592 814

65 593 815
66 593 815
67 593 815

68 594 816
69 594 816

70 595 817
71 595 817

72 596 818
73 596 818

74 597 819
75 597 819

76 598 820
77 598 820

78 599 821
79 599 821

80 600 822
81 600 822

82 601 823
83 601 823

84 602 824
85 602 824

86 603 825
87 603 825

88 604 826

89 605 827
90 605 827

91 606 828

92 607 829
93 607 829

94 608 830
95 608 830

96 609 831

97 610 832
98 610 832

99 611 833

100 612 834
101 612 834

102 613 835

103 614 836
104 614 836

105 615 837

106 616 838

107 617 839
108 617 839

109 618 840

110 619 841

111 620 842
112 620 842

113 621 843

114 622 844

115 623 845
116 623 845

117 624 846 [F10]

118 625 847

119 626 848
120 626 848

121 627 849

122 628 850

123 629 851
124 629 851

125 630 852
126 630 852

127 631 853
128 631 853
set repeats, menu exits
*** FINISHED ***

Here's the current aperture table in shooting.c for D20:
Code: [Select]
//TO DO: Is this right? http://chdk.setepontos.com/index.php?topic=9722.msg100580#msg100580
const ApertureSize aperture_sizes_table[] = {
    {  9, 387, "3.9" },
    { 10, 399, "3.9" },
    { 11, 431, "4.5" },
    { 12, 439, "5.0" },
    { 13, 575, "8.0" },
    { 14, 600, "9.0" },
    { 15, 618, "10.0" },
};
I don't think these table values are correct. Maybe reyalp  can help me understand where the table comes from? This is reyalp's table from the D10:
Code: [Select]
// These F-numbers are the "mock" values shown by the cam.
// They're linked to FL (zoom) and ND filter.
// aperture_sizes_table[].id is just a serial number.
const ApertureSize aperture_sizes_table[] = { // PROPCASE 23
    {  9, 292, "2.8" }, // zoom 1.0
    { 10, 308, "3.2" }, // zoom 1.2
    { 11, 326, "3.2" }, // etc.
    { 12, 348, "3.5" },
    { 13, 375, "4.0" },
    { 14, 409, "4.5" },
    { 15, 449, "4.9" },
// The rest are the same physical apertures as above, but with ND:
    { 16, 575, "8.0" },
    { 17, 591, "9.0" },
    { 18, 609, "9.0" },
    { 19, 631, "10.0" },
    { 20, 658, "11.0" },
    { 21, 692, "13.0" },
    { 22, 732, "14.0" },
};

« Last Edit: 24 / September / 2013, 23:36:24 by lapser »
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

*

Offline reyalp

  • ******
  • 13386
Re: D20 porting thread
« Reply #26 on: 25 / September / 2013, 00:50:10 »
http://chdk.setepontos.com/index.php?topic=9722.msg100580#msg100580
I looked at the log data mentioned in this post, and it looks like the ND filter was always OUT.  set_nd_filter() doesn't work, because the camera just overrides it to set aperture.
I wouldn't expect set_nd_filter to affect the propcase or exif values, it doesn't on my D10. As far as I know, the av is only updated to reflect the ND filter when the canon firmware controls it.

The correct way to determine whether set_nd_filter works is to set the shutter speed and ISO to fixed values, and see if you get a visible difference with the ND forced to in and forced out. It has nothing to do with the Av table stuff below.

Quote
I don't think these table values are correct.
Why not? Aside from 3.9 appearing twice, it seems OK to me. You script shows that the av96 values varies continuously with zoom, but there are only a few values displayed in the UI. This is typical for cameras with a lot of zoom steps.

The table is mainly used for cameras that have an adjustable aperture anyway, so it probably doesn't matter at all.
Don't forget what the H stands for.

*

Offline lapser

  • *****
  • 1093
Re: D20 porting thread
« Reply #27 on: 25 / September / 2013, 02:07:20 »
I wouldn't expect set_nd_filter to affect the propcase or exif values, it doesn't on my D10. As far as I know, the av is only updated to reflect the ND filter when the canon firmware controls it.
That's what I found. set_nd_filter() gets overridden by the camera. It does work in half shoot, though, when it's modified in CHDK to use SET_NOW.

I'm using another script with my CHDK mods to measure actual exposures with the ND filter IN and OUT using get_shot_meter(). The D20 is pretty close to 192 ev96 units actual measured difference.
I get 276 for the G1X ND filter density, 342 for the SX50, and 356 for the SX260. But I need to repeat the tests under better lighting conditions. I'm planning to use the values to switch the ND filter in automatically for shutter times < 1/1000 second. I need a precise ev96 density to avoid a sudden change in exposure.
Quote
Quote
I don't think these table values are correct.
Why not? Aside from 3.9 appearing twice, it seems OK to me. You script shows that the av96 values varies continuously with zoom, but there are only a few values displayed in the UI. This is typical for cameras with a lot of zoom steps.
Well, it seems like the last 3 values in the table should be the same as the first 3, plus 192. Here's where my Canon F-stop display changed

387  [F3.9]
400  [F4.5]
432  [F5.0]

579  [F8.0]
592  [F9.0]
624  [F10]

Why aren't these the values to use in the table? Is the table value supposed to be half way to the next higher value, or something?
Quote
The table is mainly used for cameras that have an adjustable aperture anyway, so it probably doesn't matter at all.
I can't argue with that! But I'm just trying to understand how the table is generated and used, in case I decide to set the aperture in the future.
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos


Re: D20 porting thread
« Reply #28 on: 05 / November / 2013, 23:39:14 »
Awesome work guys! I see it's posted!
Will there ever be manual override?

Thanks!
« Last Edit: 06 / November / 2013, 00:42:00 by nycrayjai »

Re: D20 porting thread
« Reply #29 on: 06 / March / 2014, 21:07:28 »
I've been thinking about purchasing a used D10 or D20.  The D10 has the 2.8 aperture while the D20 has the 3.9.  Anyone have an opinion as to if that would matter much?  These would be used exclusively for lightning photos and would be left out during the storm and collected later.  I do this now with my S100, S110 and ELPH 300 HS using housings.  Just wondering if that 2.8 of the D10 would be the decider.  I'm not worried about which one is more noisy as I cap my ISO at 600 for these type of activities.  Thanks.

 

Related Topics