Pretty print Tv - General Discussion and Assistance - CHDK Forum

Pretty print Tv

  • 31 Replies
  • 5183 Views
Pretty print Tv
« on: 28 / July / 2021, 13:58:40 »
Advertisements
Does anyone know if there is a Lua function or call to convert APEX values to shutter speed, ie in an intelligent way so that I get a text field back eg 15, 8 or 1/10 or 1/125 etc


Before I spend time and write my own  ;)


Cheers


Garry

*

Offline Caefix

  • *****
  • 945
  • Sorry, busy deleting test shots...
Re: Pretty print Tv
« Reply #1 on: 28 / July / 2021, 14:30:50 »
Before I spend time and write my own  ;)


Cheers
There´s a shutter_speeds_table in .../platform/.../shooting.c   :xmas and
Code: [Select]
// core/gui.c lines 1285++
static const char* tv_override[]={
#ifdef CAM_EXT_TV_RANGE
    // add very long time exposures as approximately powers of 2, adding 15 exposures
    "2048","1625","1290","1024","812","645","512","406","322","256","203","161","128","101","80",
#endif
    "64","50.8", "40.3", "32", "25.4","20","16", "12.7", "10","8", "6.3","5","4","3.2", "2.5","2",
    "1.6", "1.3", "1", "0.8", "0.6", "0.5", "0.4", "0.3", "1/4", "1/5", "1/6", "1/8", "1/10", "1/13",
    "1/15", "1/20", "1/25", "1/30", "1/40", "1/50", "1/60", "1/80", "1/100", "1/125", "1/160", "1/200",
    "1/250", "1/320", "1/400", "1/500", "1/640","1/800", "1/1000", "1/1250", "1/1600","1/2000","1/2500",
    "1/3200","1/4000", "1/5000", "1/6400", "1/8000", "1/10000", "1/12500", "1/16000", "1/20000", "1/25000",
    "1/32000", "1/40000", "1/50000", "1/64000","1/80000", "1/100k"
};
All lifetime is a loan from eternity.

Re: Pretty print Tv
« Reply #2 on: 28 / July / 2021, 14:41:40 »
Quote
There´s a shutter_speeds_table in .../platform/.../shooting.c   :xmas

Yes, I’m aware of that and can create my own table ;-)

I was asking if there was a plug and play Lua function ;-)

No big deal, I’ll write my own.

Cheers

Garry

*

Offline msl

  • *****
  • 1280
  • A720 IS, SX220 HS 1.01a
    • CHDK-DE links
Re: Pretty print Tv
« Reply #3 on: 29 / July / 2021, 07:18:31 »
For a text field as shutter speed value you need a lookup table. There is no explicit Lua function. Because of the CHDK Lua integer limitation is only a conversion for TV96 in msec available.

https://chdk.fandom.com/wiki/Script_commands#tv96_to_usec

The CHDKplus script has a good example for a lookup table: https://chdk.fandom.com/wiki/CHDKplus

msl
CHDK-DE:  CHDK-DE links


Re: Pretty print Tv
« Reply #4 on: 29 / July / 2021, 12:16:05 »
Quote

The CHDKplus script has a good example for a lookup table


Thanks for the link.

*

Offline Caefix

  • *****
  • 945
  • Sorry, busy deleting test shots...
Re: Pretty print Tv
« Reply #5 on: 29 / July / 2021, 14:19:17 »
Could it be exposed to Lua-script, like a dof.value  :-* ?
Code: [Select]
// core/shooting.c line 764++
// Only needed on VxWorks
#if CAM_DRAW_EXPOSITION
// compare PROPCASE_TV with shutter_speeds_table
char* shooting_get_tv_str()
{
    return (char*)shutter_speeds_table[find_nearest_shutter_speed_entry(shooting_get_tv96())].name;
}
#endif
All lifetime is a loan from eternity.

Re: Pretty print Tv
« Reply #6 on: 29 / July / 2021, 16:39:43 »
Quote

Could it be exposed to Lua-script, like a dof.value


A question for @reyalp maybe.

The use case is for script writers to have easy access to a string of the shutter speed and, ideally, aperture.

Cheers

Garry

*

Offline msl

  • *****
  • 1280
  • A720 IS, SX220 HS 1.01a
    • CHDK-DE links
Re: Pretty print Tv
« Reply #7 on: 29 / July / 2021, 17:10:35 »
I think for such "cosmetic" things is a Lua library the better way.

Btw, for aperture values you can use the Lua function av96_to_aperture().

msl
CHDK-DE:  CHDK-DE links


Re: Pretty print Tv
« Reply #8 on: 29 / July / 2021, 17:40:11 »
Quote

Btw, for aperture values you can use the Lua function av96_to_aperture().


Does this suggest we should have a tv96_to_tv_str()  ;)

Re: Pretty print Tv
« Reply #9 on: 30 / July / 2021, 02:45:16 »
Just had a thought, but haven't had time to try it out yet.

If I use get_user_tv_id this should give me an index that I can use to access my lookup table.

BTW the current text needs tweaking:

Quote
get_user_tv_id

Returns the index in the aperture table found in the camera's CHDK shooting.c file for the current Av setting in APEX96 units for M (manual) or Av (aperture priority) modes on cameras that support those modes.
*** Just tried it an it works, ie, on the M3, BULB = -33 and 30s = -15. I can now use this to index my look up table :-)
***UPDATE
Just tried it and all OK, ie on the M3, I'm sure it will vary with cameras, BULB is -33 and 30s is -15 :-)

That is aperture table should say shutter speed table and Av should be Tv etc. Or am I wrong?
« Last Edit: 30 / July / 2021, 03:07:07 by pigeonhill »

 

Related Topics