A way to get_zoom() on EOS-M 100 - General Discussion and Assistance - CHDK Forum supplierdeeply

A way to get_zoom() on EOS-M 100

  • 13 Replies
  • 4912 Views
*

Offline Caefix

  • *****
  • 947
  • Sorry, busy deleting test shots...
A way to get_zoom() on EOS-M 100
« on: 17 / October / 2020, 11:55:37 »
Advertisements
 :xmas
Code: [Select]
A way to get_zoom() found on EOS-M 100

// core/shooting.c
int shooting_get_zoom()
{
if (conf.platformid==13009) return get_zoom_x(0);  // M100_15_45_STM = 0..30
    return lens_get_zoom_point();
}

// m100/main.c
int get_zoom_x(int zp) {
    int wfl = _GetLensWideFocalLength();
    if (!wfl) {
        return -1;  // manual lens
    }
// -- return _GetLensCurrentFocalLength()*100 / (wfl*100);
// ++ M100_15-45_STM, CAN_EF-S_18-55, CAN_50 1:1.8 II, ...?
    return (_GetLensCurrentFocalLength()*10000) / (wfl*666) -15;
}

:...;....1....;....2....;....3....;....4..

print(get_zoom(),-dof.focal_length,dof.eff_focal_length)

Step  -FL    EFL
  0   -15000 24000
  1   -16000 25600
  2   -17000 27200
  3   -18000 28800
  4   -19000 30400
  5   -20000 32000
  6   -21000 33600
  7   -22000 35200
  8   -23000 36800
  9   -24000 38400
  10  -25000 40000
  11  -26000 41600
  12  -27000 43200
  13  -28000 44800
  14  -29000 46400
  15  -30000 48000
  16  -31000 49600
  17  -32000 51200
  18  -33000 52800
  19  -34000 54400
  20  -35000 56000
  21  -36000 57600
  22  -37000 59200
  23  -38000 60800
  24  -39000 62400
  25  -40000 64000
  26  -41000 65600
  27  -42000 67200
  28  -43000 68800
  29  -44000 70400
  30  -45000 72000
 
CAN_EF-S_18-55
  0 -18000 28800
  30 -55000 88000

CAN_50 1:1.8 II
  0 -50000 80000
All lifetime is a loan from eternity.

*

Offline Caefix

  • *****
  • 947
  • Sorry, busy deleting test shots...
Re: A way to get_zoom() on EOS-M 100
« Reply #1 on: 19 / October / 2020, 11:20:05 »
 :xmas ... ready to go with other lenses... [?   ::)  ?]
Code: [Select]
core/shooting.c

int shooting_get_zoom()  -- 
{
if (zoom_steps==1) return get_zoom_x(0);
  //  EOS ext.lens // (M100_15_45_STM = 0..30 // EF-S 55-250mm IS STM=0..37 ) max. is valid for AVtable
    return lens_get_zoom_point();
}


void shooting_update_dof_values()  -- line 1185
{
  int zoom_point = shooting_get_zoom(); //--lens_get_zoom_point();
  int fl = get_focal_length(zoom_point);


  if (!min_av96_zoom_point_tbl) {
    short zp=zoom_points; if (zp==1) zp=51; // EF-S 55-250mm IS STM=0..37 + some bytes more for unk lenses.
    min_av96_zoom_point_tbl = (short *) malloc(zp * sizeof(short));
    if (min_av96_zoom_point_tbl) {
      memset(min_av96_zoom_point_tbl, 0, zp * sizeof(short));
    }



platform/m???/main.c

int get_zoom_x(int zp) {
    int wfl = _GetLensWideFocalLength();
    if (!wfl) {
        return 1;  // manual lens
    }
// ++ M100_15-45_STM, CAN_EF-S_18-55, CAN_50 1:1.8 II, CAN_EF_100-300, ...?
    return (_GetLensCurrentFocalLength()*15) / wfl -15;
}

....;....2....;....3....;....4..

print(get_min_av96(),get_av96(),get_max_av96(),get_user_av96(),get_user_av_id(),-dof.aperture)

« Last Edit: 21 / October / 2020, 12:22:32 by Caefix »
All lifetime is a loan from eternity.

*

Offline Caefix

  • *****
  • 947
  • Sorry, busy deleting test shots...
Re: A way to get_zoom() on EOS-M 100
« Reply #2 on: 20 / October / 2020, 11:19:22 »
What else can i do?
:-* Compile with upper lines and test with
EF-S 55-250mm IS STM
EF-M 11-22mm IS STM
If Your superzoom needs more steps zp=31 might be to low.
All lifetime is a loan from eternity.

*

Offline c_joerg

  • *****
  • 1251
Re: A way to get_zoom() on EOS-M 100
« Reply #3 on: 20 / October / 2020, 12:30:38 »
EF-M 11-22mm IS STM
One Step per mm.

EF-S 55-250mm IS STM
If Your superzoom needs more steps zp=31 might be to low.
37 Steps

Code: [Select]
55
60
61
64
70
79
84
89
100
109
113
117
121
124
127
135
143
146
152
157
163
166
172
175
180
183
189
191
194
200
211
216
225
227
233
237
250

But I don't know what the zoom steps on the M100 will bring me. The focal length is much more important.

It’s a benefit from a camera with a motor zoom. That is the smallest step size in which I can change the zoom.
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 Caefix

  • *****
  • 947
  • Sorry, busy deleting test shots...
Re: A way to get_zoom() on EOS-M 100
« Reply #4 on: 20 / October / 2020, 13:20:29 »
 :) Thx!
Probably we need not more precision here. Maybe it helps optimizing some AV-dependent values or compatibility with scripts or their logfiles. A constant 0 value might become boring if we can have senseful 0..37(++?) without risk.
Implementing focus is much less trivial. (How to name the addresses on low level, where to define...)
All lifetime is a loan from eternity.

*

Offline Caefix

  • *****
  • 947
  • Sorry, busy deleting test shots...
Re: A way to get_zoom() on EOS-M 100
« Reply #5 on: 21 / October / 2020, 11:53:21 »
 :) AV-trail through the tube.
Code: [Select]
0 -15000 24000 1 0 -420
348 456 864 384 384 -3513
1 0 7777 0 false 0
0 47 3386 0 -1 false 3386 -1 19 --
 1 -16000 25600 1 0 -420
348 348 864 384 384 -3513
1 0 7777 0 false 0
1 51 3851 0 -1 false 3851 -1 19 --
 2 -17000 27200 1 1 -420
348 348 864 384 384 -3513
1 0 7777 0 true 0
2 54 4347 0 -1 true 4347 -1 19 --
 3 -18000 28800 1 0 -420
360 360 876 384 384 -3668
1 0 7777 0 true 0
3 56 4667 0 -1 true 4667 -1 19 --
 4 -19000 30400 1 1 -420
372 360 888 384 384 -3830
1 0 7777 0 false 0
4 58 4980 0 -1 false 4980 -1 19 --
 5 -20000 32000 1 0 -420
372 372 888 384 384 -3830
1 0 7777 0 false 0
5 62 5517 0 -1 false 5517 -1 19 --
 6 -21000 33600 1 0 -420
384 384 900 384 384 -4000
1 0 7777 0 true 0
6 64 5824 0 -1 true 5824 -1 19 --
 7 -22000 35200 1 1 -420
384 384 900 384 384 -4000
1 0 7777 0 false 0
7 67 6390 0 -1 false 6390 -1 19 --
 8 -23000 36800 1 1 -420
396 396 912 384 384 -4177
1 0 7777 0 false 0
8 69 6689 0 -1 false 6689 -1 19 --
 9 -24000 38400 1 1 -420
396 396 912 384 384 -4177
1 0 7777 0 false 0
9 72 7282 0 -1 false 7282 -1 19 --
 10 -25000 40000 1 1 -420
408 408 924 384 384 -4362
1 0 7777 0 false 0
10 74 7566 0 -1 false 7566 -1 19 --
 11 -26000 41600 1 1 -420
408 408 924 384 384 -4362
1 0 7777 0 false 0
11 76 8183 0 -1 false 8183 -1 19 --
 12 -27000 43200 1 1 -420
420 420 936 384 384 -4555
1 0 7777 0 false 0
12 79 8450 0 -1 false 8450 -1 19 --
 13 -28000 44800 1 0 -420
432 420 948 384 384 -4757
1 0 7777 0 true 0
13 80 8702 0 -1 true 8702 -1 19 --
 14 -29000 46400 1 0 -420
444 432 960 384 384 -4967
1 0 7777 0 false 0
14 82 8940 0 -1 false 8940 -1 19 --
 15 -30000 48000 1 1 -420
444 444 960 384 384 -4967
1 0 7777 0 true 0
15 84 9567 0 -1 true 9567 -1 19 --
 16 -31000 49600 1 0 -420
444 444 960 384 384 -4967
1 0 7777 0 false 0
16 86 10214 0 -1 false 10214 -1 19 --
 17 -32000 51200 1 0 -420
456 444 972 384 384 -5187
1 0 7777 0 false 0
17 88 10422 0 -1 false 10422 -1 19 --
 18 -33000 52800 1 0 -420
456 456 972 384 384 -5187
1 0 7777 0 false 0
18 90 11083 0 -1 false 11083 -1 19 --
 19 -34000 54400 1 3612 -420
468 456 984 384 384 -5417
1 0 7777 0 false 0
19 92 11266 0 -1 false 11266 -1 19 --
 20 -35000 56000 1 0 -420
468 456 984 384 384 -5417
1 0 7777 0 false 0
20 95 11937 0 -1 false 11937 -1 19 --
 21 -36000 57600 1 7710 -420
480 480 996 384 384 -5657
1 0 7777 0 false 0
21 96 12094 0 -1 false 12094 -1 19 --
 22 -37000 59200 1 0 -420
480 480 996 384 384 -5657
1 0 7777 0 false 0
22 98 12774 0 -1 false 12774 -1 19 --
 23 -38000 60800 1 0 -420
480 480 996 384 384 -5657
1 0 7777 0 true 0
23 101 13473 0 -1 true 13473 -1 19 --
 24 -39000 62400 1 -24770 -420
492 492 1008 384 384 -5907
1 0 7777 0 false 0
24 103 13591 0 -1 false 13591 -1 19 --
 25 -40000 64000 1 3604 -420
492 492 1008 384 384 -5907
1 0 7777 0 false 0
25 105 14296 0 -1 false 14296 -1 19 --
 26 -41000 65600 1 3612 -420
504 504 1020 384 384 -6169
1 0 7777 0 false 0
26 107 14383 0 -1 false 14383 -1 19 --
 27 -42000 67200 1 0 -420
516 504 1032 384 384 -6442
1 0 7777 0 false 0
27 107 14454 0 -1 false 14454 -1 19 --
 28 -43000 68800 1 0 -420
516 504 1032 384 384 -6442
1 0 7777 0 true 0
28 110 15149 0 -1 true 15149 -1 19 --
 29 -44000 70400 1 0 -420
516 516 1032 384 384 -6442
1 0 7777 0 true 0
29 112 15861 0 -1 true 15861 -1 19 --
 30 -45000 72000 1 0 -420
516 516 1032 384 384 -6442
1 0 7777 0 false 0
30 115 16589 0 -1 false 16589 -1 19 --
*** UNTERBROCHEN ***
All lifetime is a loan from eternity.

*

Offline Caefix

  • *****
  • 947
  • Sorry, busy deleting test shots...
Re: A way to get_zoom() on EOS-M 100
« Reply #6 on: 23 / October / 2020, 13:57:38 »
In the first approach I would use an average get_focus_distace_upper and get_focus_distace_lower (from M3M10M100_Focus.lua) for the focus.
"Downside"  :-X it would look somehow(!!) like this: Probably not very satisfying with higher zoom or near infinity.
Code: [Select]
int   shooting_get_exif_subject_dist()          {
if(conf.platformid==13009) //  Edit:  Compiler warning, added  2*(   )
return (((unsigned short) *(unsigned short *)(0x001FC7FA)>>1)+
((unsigned short) *(unsigned short *)(0x001FC7FC)>>1));
return shooting_get_prop_int(PROPCASE_SUBJECT_DIST1); }


short shooting_is_infinity_distance()
{
  if (conf.platformid==13009) return ((unsigned short) *(unsigned short *)(0x001FC7FA)>65432)?1:0;
  return (shooting_get_lens_to_focal_plane_width() == 0)?1:0;
}

Based on the upper lines and ::) replacements
Code: [Select]
// console.c
#ifdef CAM_ILC // Eos-M
#define MAX_CONSOLE_HISTORY     100
#else
#define MAX_CONSOLE_HISTORY     30
#endif
// * /-------------------------------------------------------------------
static void save_console()
{
    FILE *fh = fopen("A/console.Log","wb");
    if(!fh) return;
short i=0;
static char const *c; c=&console_buf[0][0];
//        fwrite((char *)&console_buf,sizeof(console_buf),1,fh);

while (i<MAX_CONSOLE_HISTORY*(MAX_CONSOLE_LINE_LENGTH+1))
{
while (*c=='\0') { c++; i++;}
while (*c!='\0') {fwrite((char *)c,1,1,fh); c++; i++;}
fwrite((char *)"\n",1,1,fh);
while (i%(MAX_CONSOLE_LINE_LENGTH+1)!=0) {c++; i++;}
}
    fclose(fh);
}
//-------------------------------------------------------------------* /
    case KEY_LEFT:
save_console();
        break;

EDIT: Version for relase 1.6 attached.
« Last Edit: 25 / December / 2020, 11:40:20 by Caefix »
All lifetime is a loan from eternity.

*

Offline Caefix

  • *****
  • 947
  • Sorry, busy deleting test shots...
Re: A way to get_zoom() on EOS-M 100
« Reply #7 on: 26 / October / 2020, 12:30:16 »
 :D ... save for all cams.
Code: [Select]
//shooting.c
#include "console.h" // for research monitor, lines not logged.

#ifdef CAM_ILC  // lines ~125 -->> lines ~~1400
static unsigned short peeks(int a) {return (unsigned short) *(unsigned short *)(a);}
static int eos_m=0x001FC7FA; // m100_100a, 13009
//if (conf.platformid==12953) eos_m=0x00244916; // "m3"="101a"
//if (conf.platformid==12953) eos_m=0x0024495A; // "m3"="120f" default :)
//if (conf.platformid==12960) eos_m=0x00272016; // m10 110d, 110f, 110g
int   shooting_get_exif_subject_dist()          { return (peeks(eos_m)>>1)+(peeks(eos_m+2)>>1); }
#else
int   shooting_get_exif_subject_dist()          { return shooting_get_prop_int(PROPCASE_SUBJECT_DIST1); }
#endif



#ifdef CAM_ILC  // ~~1200
int shooting_get_canon_subject_distance()
{
return shooting_get_exif_subject_dist() * ( //  eos-M
       get_focal_length(get_zoom_x(0))*10 ) / get_focal_length(0);
}
short shooting_is_infinity_distance() {return (peeks(eos_m)>65432)?1:0;}
#else
short shooting_is_infinity_distance() {return
                           (shooting_get_lens_to_focal_plane_width() == 0)?1:0;}

int shooting_get_canon_subject_distance()
{
    return (lens_get_focus_pos_from_lens()); // not eos-M
}
#endif


// temp. helper: set shooting_set_zoom_rel(1) at top of script.Lua to get cam.
#ifdef CAM_ILC //   lines ~~1400
void shooting_set_zoom_rel(int v) {
switch (conf.platformid) {
case 13009: eos_m=0x001FC7FA; // m100_100a
break;
case 12953: eos_m=0x0024495A; // "m3"="120f" default :)
if (v==101) eos_m=0x00244916; // "m3"="101a"
break;
case 12960: eos_m=0x00272016; // m10 110d, 110f, 110g
break;
default: if (v>0xfffff) eos_m=v;
} // switch
}

void shooting_set_zoom_speed(int v) {}

void shooting_set_zoom(int v) {
char buf[88];  //  defined MAX_CONSOLE_LINE_LENGTH 44
    struct tm *ttm = get_localtime();
switch(v) {
case 0:
break;
    case 1: sprintf(buf, "%08d %05u <%05u, %2u", get_tick_count(), peeks(eos_m+2), peeks(eos_m), shooting_get_zoom() );
break;
    case 2: sprintf(buf, "%08d 0x%04x 0x%04x,%2u", get_tick_count(), peeks(eos_m+2), peeks(eos_m), shooting_get_zoom() );
break;
    default: sprintf(buf, "%08d :%02u:%02u:%02u,%6d", get_tick_count(), ttm->tm_hour, ttm->tm_min, ttm->tm_sec, v);
} // switch(v)
console_add_line(buf);
    if (conf.console_show) console_draw(1);
}

#else // not ILC
if get_zoom_steps()<2 then set_zoom_rel(1) end ----   ;)  ------->>   
Edit: Window updated to shooting.c  updated later. 
« Last Edit: 31 / October / 2020, 15:59:19 by Caefix »
All lifetime is a loan from eternity.


*

Offline Caefix

  • *****
  • 947
  • Sorry, busy deleting test shots...
Re: A way to get_zoom() on EOS-M 100
« Reply #8 on: 27 / October / 2020, 15:44:45 »
 :D If You want to go with old ubasic then You need at least:     (    (    (   (  ( (( :lol
Code: [Select]
// tokenizer.h
  TOKENIZER_GET_EFF_FOCAL_LENGTH,

// tokenizer.c
#define MAX_NUMLEN 9

  {"get_eff_focal_length",    TOKENIZER_GET_EFF_FOCAL_LENGTH},  // eq 35mm


// ubasic.c
#define MAX_STRINGLEN 128


  case TOKENIZER_GET_FOCAL_LENGTH:
    accept(TOKENIZER_GET_FOCAL_LENGTH);
    r = get_focal_length(shooting_get_zoom()); //--(lens_get_zoom_point()) wg.  EOS-M
    break;
  case TOKENIZER_GET_EFF_FOCAL_LENGTH:
    accept(TOKENIZER_GET_EFF_FOCAL_LENGTH);
    r = get_effective_focal_length(shooting_get_zoom());
    r = r * conf.zoom_scale / 100; // from gui_osd.c
break;
All lifetime is a loan from eternity.

*

Offline Caefix

  • *****
  • 947
  • Sorry, busy deleting test shots...
Re: A way to get_zoom() on EOS-M 100
« Reply #9 on: 30 / October / 2020, 12:54:34 »
:blink: Quests | :-X | Questions ?  :-*
Code: [Select]
                     // scale by users adapter lens eg. Canon Wide .42 or Canon Tele 1.75
                     fl = fl * conf.zoom_scale / 100;    //  gui_osd.c line...404
Could be best place for this lines in main.c, shooting.c, luascript.c & ubasic.c or in script?
How to find out ?
Do we need to feed missing values or tables with script?
Knows cam if -M or -EF is attached?
...

EDIT: read.c is nice for reading foward, but each backward jumps ~700 chars.
Realy nasty with slim lines. Now it´s easier to adjust the text one wants to read.
(With the keys around 'set'.)
 Version for relase 1.6 attached.
« Last Edit: 25 / December / 2020, 11:50:51 by Caefix »
All lifetime is a loan from eternity.

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal