source: trunk/platform/ixus220_elph300hs/shooting.c @ 1442

Revision 1442, 5.1 KB checked in by philmoz, 18 months ago (diff)

Update for IXUS 220 from jstanley0
http://chdk.setepontos.com/index.php?topic=6341.msg77008#msg77008

Line 
1#include "lolevel.h"
2#include "platform.h"
3#include "core.h"
4#include "conf.h"
5#include "keyboard.h"
6#include "stdlib.h"
7#include "platform.h"
8
9#define PARAM_FILE_COUNTER      0x3B
10#define PARAM_EXPOSURE_COUNTER  0x02
11
12// borrowed from IXUS 200, which is similar
13// but not exactly the same lens
14const ApertureSize aperture_sizes_table[] = {
15        {  9, 293, "2.8" },
16        { 10, 306, "3.2" },
17        { 11, 321, "3.2" },
18        { 12, 338, "3.5" },
19        { 13, 358, "3.5" },
20        { 14, 383, "4.0" },
21        { 15, 413, "4.5" },
22        { 16, 435, "5.0" },
23        { 17, 449, "5.0" },
24        { 18, 472, "5.6" },
25        { 19, 466, "5.6" },
26        { 20, 499, "5.9" },
27};
28
29const ShutterSpeed shutter_speeds_table[] = {
30        { -12, -384, "15", 15000000 },
31        { -11, -352, "13", 13000000 },
32        { -10, -320, "10", 10000000 },
33        {  -9, -288, "8",   8000000 },
34        {  -8, -256, "6",   6000000 },
35        {  -7, -224, "5",   5000000 },
36        {  -6, -192, "4",   4000000 },
37        {  -5, -160, "3.2", 3200000 },
38        {  -4, -128, "2.5", 2500000 },
39        {  -3,  -96, "2",   2000000 },
40        {  -2,  -64, "1.6", 1600000 },
41        {  -1,  -32, "1.3", 1300000 },
42        {   0,    0, "1",   1000000 },
43        {   1,   32, "0.8",  800000 },
44        {   2,   64, "0.6",  600000 },
45        {   3,   96, "0.5",  500000 },
46        {   4,  128, "0.4",  400000 },
47        {   5,  160, "0.3",  300000 },
48        {   6,  192, "1/4",  250000 },
49        {   7,  224, "1/5",  200000 },
50        {   8,  256, "1/6",  166667 },
51        {   9,  288, "1/8",  125000 },
52        {  10,  320, "1/10", 100000 },
53        {  11,  352, "1/13",  76923 },
54        {  12,  384, "1/15",  66667 },
55        {  13,  416, "1/20",  50000 },
56        {  14,  448, "1/25",  40000 },
57        {  15,  480, "1/30",  33333 },
58        {  16,  512, "1/40",  25000 },
59        {  17,  544, "1/50",  20000 },
60        {  18,  576, "1/60",  16667 },
61        {  19,  608, "1/80",  12500 },
62        {  20,  640, "1/100", 10000 },
63        {  21,  672, "1/125",  8000 },
64        {  22,  704, "1/160",  6250 },
65        {  23,  736, "1/200",  5000 },
66        {  24,  768, "1/250",  4000 },
67        {  25,  800, "1/320",  3125 },
68        {  26,  832, "1/400",  2500 },
69        {  27,  864, "1/500",  2000 },
70        {  28,  896, "1/640",  1563 },
71        {  29,  928, "1/800",  1250 },
72        {  30,  960, "1/1000", 1000 },
73        {  31,  992, "1/1250",  800 },
74        {  32, 1024, "1/1600",  625 },
75        {  33, 1056, "1/2000",  500 },
76        {  34, 1088, "1/2500",  400 },
77        {  35, 1120, "1/3200",  313 },
78};
79
80const ISOTable iso_table[] = {
81        {  0,    0, "Auto", -1},
82        {  1,  100,  "100", -1},
83        {  2,  200,  "200", -1},
84        {  3,  400,  "400", -1},
85        {  4,  800,  "800", -1},
86        {  5, 1600, "1600", -1},
87        {  6, 3200, "3200", -1},
88};
89
90// modemap, values have been verified for IXUS220HS on 1.00c/1.01a/1.01c
91// http://chdk.setepontos.com/index.php?topic=6341.msg76892#msg76892
92static const CapturemodeMap modemap[] = {
93    { MODE_AUTO,                32768 },
94    { MODE_P,                   32772 },
95
96    { MODE_PORTRAIT,            32783 },
97    { MODE_KIDS_PETS,           32786 },
98    { MODE_SCN_SMART_SHUTTER,   33321 },
99    { MODE_SCN_HIGHSPEED_BURST, 33288 },
100    { MODE_SCN_BEST_IMAGE,      33289 },
101    { MODE_NIGHT_SCENE,         33325 },
102    { MODE_LOWLIGHT,            32801 },
103    { MODE_SCN_FISHEYE,         33323 },
104    { MODE_SCN_MINIATURE,       33324 },
105    { MODE_SCN_TOY_CAMERA,      33327 },
106    { MODE_SCN_MONOCHROME,      33330 },
107    { MODE_SCN_SUPER_VIVID,     33318 },
108    { MODE_SCN_POSTER_EFFECT,   33319 },
109    { MODE_COLOR_ACCENT,        33309 },
110    { MODE_COLOR_SWAP,          33310 },
111    { MODE_SCN_BEACH,           32791 },
112    { MODE_SCN_UNDERWATER,      32793 },
113    { MODE_SCN_FOLIAGE,         32789 },
114    { MODE_SCN_SNOW,            32790 },
115    { MODE_SCN_SNOW,            32774 },       
116    { MODE_SCN_STITCH,          33292 },
117       
118    { MODE_VIDEO_MOVIE_DIGEST,  33333 },
119    { MODE_VIDEO_SUPER_SLOW,     2626 },
120       
121    // cannot be called directly from Canon options but probably needed
122    { MODE_SCN_FACE_SELF_TIMER, 33320 },
123    { MODE_SCN_WINK_SELF_TIMER, 33322 },
124    { MODE_SCN_FIREWORK,        32792 },
125
126};
127
128#include "../generic/shooting.c"
129
130// Override ISO settings (need to do this before exposure calc for ISO as well as after)
131void __attribute__((naked,noinline)) shooting_expo_iso_override(void){
132 asm volatile("STMFD   SP!, {R0-R12,LR}\n");
133
134    if ((state_kbd_script_run) && (photo_param_put_off.sv96))
135    {
136        shooting_set_sv96(photo_param_put_off.sv96, SET_NOW);
137        // photo_param_put_off.sv96 is not reset here, it will be reset in next call to shooting_expo_param_override
138    }
139    else if ((conf.iso_override_value) && (conf.iso_override_koef) && !(conf.override_disable==1))
140        shooting_set_iso_real(shooting_get_iso_override_value(), SET_NOW);
141    else if (conf.autoiso_enable && shooting_get_flash_mode()/*NOT FOR FLASH AUTO MODE*/ && !(conf.override_disable==1 && conf.override_disable_all))
142        shooting_set_autoiso(shooting_get_iso_mode());
143
144 asm volatile("LDMFD   SP!, {R0-R12,PC}\n");
145}
146
147long get_file_next_counter() {
148        return get_file_counter();
149}
150
151long get_target_file_num() {
152        long n;
153
154
155        n = get_file_next_counter();
156
157    n = (n>>4)&0x3FFF;
158
159    return n;
160}
161
162void get_target_dir_name(char *out)
163{       
164        extern void _GetImageFolder(char*,int,int,int);
165        _GetImageFolder(out,get_file_next_counter(),0x400,time(NULL));
166}
167
168long get_target_dir_num() {
169        long n;
170
171        n = get_file_next_counter();
172        n = (n>>18)&0x3FF;
173        return n;
174}
175
176int circle_of_confusion = 5;
177
Note: See TracBrowser for help on using the repository browser.