Pretty print Tv - page 2 - General Discussion and Assistance - CHDK Forum

Pretty print Tv

  • 31 Replies
  • 1363 Views
Re: Pretty print Tv
« Reply #10 on: 30 / July / 2021, 03:09:03 »
Advertisements
Doing a reply as my mod didn't appear to work, despite being logged in.

Just tried the id approach and it works.

33 = BULB and 30s = -15.

I can use the above to access my own look up table  :)
« Last Edit: 30 / July / 2021, 03:11:17 by pigeonhill »

Re: Pretty print Tv
« Reply #11 on: 30 / July / 2021, 06:12:47 »
@reyalp

I think I've spotted an error in the tv_id feedback on the M3.

BULB is 33, but because the fastest shutter goes faster than 1/1600, ie to 1/4000, id needs to return greater than 33, which is, of course BULB.

BULB needs to return some other number and the id needs to extend beyond 33.
« Last Edit: 30 / July / 2021, 06:29:28 by pigeonhill »

*

Offline reyalp

  • ******
  • 13363
Re: Pretty print Tv
« Reply #12 on: 31 / July / 2021, 19:43:33 »
That is aperture table should say shutter speed table and Av should be Tv etc. Or am I wrong?
Correct, I've updated the wiki.

Note that the "indexes" returned by the _id functions aren't actually 0 or 1 based array indexes. I think shutter speed generally has id = 0 == 1 second, but I wouldn't guarantee this is true in all cases. Just implementing your own table based on lookup from APEX*96 values might be more reliable.

Aperture mostly start around 9, but if there was a particular logic behind that, I'm not aware of it. In any case, you won't see it in script, because the current get_user_av_id appears to be broken (it current returns the APEX96 value...)
edit: fixed.

@reyalp

I think I've spotted an error in the tv_id feedback on the M3.

BULB is 33, but because the fastest shutter goes faster than 1/1600, ie to 1/4000, id needs to return greater than 33, which is, of course BULB.

BULB needs to return some other number and the id needs to extend beyond 33.
What is the actual user_tv propcase value when you select bulb? Or does it even reflect the bulb as a distinct value?

The current CHDK code doesn't have any concept of bulb, so I'm sure if it makes sense to add to the table. I'd need to look at where else it's used.

As far as adding functions to get the strings, I'd normally agree with msl's response
I think for such "cosmetic" things is a Lua library the better way.
But given that we have the strings in a table anyway, it seems like it might be worth adding. OTOH, the tables are kind of inconsistent and buggy...
« Last Edit: 31 / July / 2021, 21:11:50 by reyalp »
Don't forget what the H stands for.

Re: Pretty print Tv
« Reply #13 on: 01 / August / 2021, 02:00:49 »
@reyalp

Here are the numbers referenced against the Canon reporting, using:

Code: [Select]
print(get_user_tv_id().."/"..get_user_tv96())

BULB: 33/32767
1/2000: 33/1056
1/2500: 33/1088
1/3200: 33/1120
1/4000: 33/1152

All other shutter ids are well behaved and consistently map to tv96 values.

As I said before, the issue on the M3 is the tv_id reports 33 for bulb and all shutters faster than 1/2000.

BTW

Quote

The current CHDK code doesn't have any concept of bulb, so I'm sure if it makes sense to add to the table. I'd need to look at where else it's used.


I wasn’t suggesting extending the table, ‘just’ sorting out the tv_id.

Cheers

Garry


PS I can easily hack a solution, so no sweat if you don’t have the time to fix things.

PPS Have now hacked a fix in my M3 script
« Last Edit: 01 / August / 2021, 07:06:19 by pigeonhill »


Re: Pretty print Tv
« Reply #14 on: 04 / August / 2021, 02:49:02 »
@reyalp

Although this has been fixed for me, ie a hacked work around in my code, I have tried to look in the trunk and see where things are going wrong...this isn't straight forward :-(

Looking first in:
Code: [Select]
http://subversion.assembla.com/svn/chdk/trunk/platform/m3/shooting.c

Here things don't look right as the Tv table implies the camera explicitly goes beyond 30 secs, when in fact Canon BULB kicks in at the usual 30s (32s) point.

Thus the shutter table should, I think, look like this at the front:

Code: [Select]
// note camera supports up to 30s shutter
const ShutterSpeed shutter_speeds_table[] = {
    { -15, -480, "30",   30000000 },
    { -14, -448, "25",   25000000 },
    { -13, -416, "20",   20000000 },
    { -12, -384, "15",   15000000 },
    { -11, -352, "13",   13000000 },
    { -10, -320, "10",   10000000 },
    {  -9, -288, "8",     8000000 },
    {  -8, -256, "6",     6000000 },
    {  -7, -224, "5",     5000000 },
    {  -6, -192, "4",     4000000 },
    {  -5, -160, "3.2",   3200000 },
    {  -4, -128, "2.5",   2500000 },
    {  -3,  -96, "2",     2000000 },
    {  -2,  -64, "1.6",   1600000 },
    {  -1,  -32, "1.3",   1300000 },
    {   0,    0, "1",     1000000 },
    {   1,   32, "0.8",    800000 },
    {   2,   64, "0.6",    600000 },
    {   3,   96, "0.5",    500000 },
    {   4,  128, "0.4",    400000 },
    {   5,  160, "0.3",    300000 },
    {   6,  192, "1/4",    250000 },
    {   7,  224, "1/5",    200000 },
    {   8,  256, "1/6",    166667 },
    {   9,  288, "1/8",    125000 },
    {  10,  320, "1/10",   100000 },
    {  11,  352, "1/13",    76923 },
    {  12,  384, "1/15",    66667 },
    {  13,  416, "1/20",    50000 },
    {  14,  448, "1/25",    40000 },
    {  15,  480, "1/30",    33333 },
    {  16,  512, "1/40",    25000 },
    {  17,  544, "1/50",    20000 },
    {  18,  576, "1/60",    16667 },
    {  19,  608, "1/80",    12500 },
    {  20,  640, "1/100",   10000 },
    {  21,  672, "1/125",    8000 },
    {  22,  704, "1/160",    6250 },
    {  23,  736, "1/200",    5000 },
    {  24,  768, "1/250",    4000 },
    {  25,  800, "1/320",    3125 },
    {  26,  832, "1/400",    2500 },
    {  27,  864, "1/500",    2000 },
    {  28,  896, "1/640",    1563 },
    {  29,  928, "1/800",    1250 },
    {  30,  960, "1/1000",   1000 },
    {  31,  992, "1/1250",    800 },
    {  32, 1024, "1/1600",    625 },
    {  33, 1056, "1/2000",    500 },
};


Also note the shutter speed runs out at 1/2000, ie not at the camera's fastest shutter of 1/4000s.

I'm not sure if the above change will fix the problem, or we have to explicitly change a CHDK constant called SS_SIZE, which I can't find in the code, but gets called in

Code: [Select]
http://subversion.assembla.com/svn/chdk/trunk/core/shooting.c

For example:

Code: [Select]
// Find nearest entry in 'shutter_speeds_table' to the given 'tv96' value
static int find_nearest_shutter_speed_entry(short tv96)
{
    if (tv96 <= shutter_speeds_table[0].prop_id)
        return 0;

    unsigned i;
    for (i=0; i<SS_SIZE-1; i++)
    {
        if ((tv96 > shutter_speeds_table[i].prop_id) && (tv96 <= shutter_speeds_table[i+1].prop_id))
        {
            if ((tv96 - shutter_speeds_table[i].prop_id) < (shutter_speeds_table[i+1].prop_id - tv96))
                return i;
            else
                return i+1;
        }
    }

    return SS_SIZE-1;
}

Bottom line: what do you think? Have I analyzed the problem or not?
« Last Edit: 04 / August / 2021, 04:22:10 by pigeonhill »

Re: Pretty print Tv
« Reply #15 on: 05 / August / 2021, 02:17:47 »
@reyalp

Found the SS_SIZE in:

Code: [Select]
https://app.assembla.com/spaces/chdk/subversion/source/HEAD/trunk/platform/generic/shooting.c

That is:

Code: [Select]
const unsigned int SS_SIZE  = sizeof(shutter_speeds_table)/sizeof(shutter_speeds_table[0]);

Thus is looks like to me that 'all' that needs to be done is get the M3 shutter_speeds_table configured correctly.
« Last Edit: 05 / August / 2021, 02:22:20 by pigeonhill »

*

Offline reyalp

  • ******
  • 13363
Re: Pretty print Tv
« Reply #16 on: 05 / August / 2021, 02:50:57 »
Yes, SS_SIZE is calculated automatically.

I'm not clear what you mean by this though:
Quote
Here things don't look right as the Tv table implies the camera explicitly goes beyond 30 secs, when in fact Canon BULB kicks in at the usual 30s (32s) point.
Are you saying that the only way to achieve an exposure longer than 30s (without CHDK overrides) is to use bulb mode and physically hold the shutter for the full time?
Don't forget what the H stands for.

Re: Pretty print Tv
« Reply #17 on: 05 / August / 2021, 08:33:27 »
@reyalp

Quote
Are you saying that the only way to achieve an exposure longer than 30s (without CHDK overrides) is to use bulb mode and physically hold the shutter for the full

Yes. In fact all my cameras are different, eg:

G1X 60" to 1/4000, ie no BULB
G7X 250" to 1/2000, ie no BULB
G5X BULB 30 to 1/2000
M3 BULB 30 to 1/4000

The CHDK code indicates all that is required is to extend the shutter table out to 1/4000: IMHO

Cheers

Garry


UPDATE


@reyalp may I suggest that you also have an entry beyond 1/4000 to catch the Bulb apex96 value, ie 32767 for some reason.
« Last Edit: 05 / August / 2021, 09:02:08 by pigeonhill »


*

Offline reyalp

  • ******
  • 13363
Re: Pretty print Tv
« Reply #18 on: 05 / August / 2021, 13:46:01 »
@reyalp may I suggest that you also have an entry beyond 1/4000 to catch the Bulb apex96 value, ie 32767 for some reason.
Someone needs to look through the usage of this table and all the functions that refer to it to determine whether it makes sense to include bulb, and whether any additional changes are needed. For example, set_user_tv_by_id_rel seems like it would misbehave, although it presumably also misbehaves is with the current code if bulb is set.
Don't forget what the H stands for.

Re: Pretty print Tv
« Reply #19 on: 05 / August / 2021, 14:13:14 »
Quote
Someone needs to look through the usage of this table and all the functions that refer to it to determine whether it makes sense to include bulb, and whether any additional changes are needed.

I must say I only use (script) id on the M3 and I’ve already hacked a workaround.

Bottom line: may I suggest you ‘just’ extend the table to cover out to 1/4000 and keep the table as is at the other end, ie 250s. This should at least cover the non BULB use.

 

Related Topics