source: trunk/platform/a2000/main.c @ 835

Revision 835, 2.8 KB checked in by reyalp, 4 years ago (diff)

Second part of play/rec mode override support. See http://chdk.kernreaktor.org/mantis/view.php?id=64

  • use playrec_mode variable to detect play/rec state on all cameras except a560, ixus40_sd300, ixus50_sd400, ixus700_sd500
  • remove extraneous swivel screen stuff from cameras that don't have swivel screen: a2000, a530, a700, a710, sx110
  • use PROPCASE_SHOOTING_MODE instead of hard coded number on a530, ixus55_sd450, ixus60_sd600, ixus65_sd630, ixus950_sd850, ixus_izoom_sd30, s5is
  • misc comments
  • Property svn:eol-style set to native
Line 
1#include "lolevel.h"
2#include "platform.h"
3#include "core.h"
4#include "keyboard.h"
5
6
7extern long link_bss_start;
8extern long link_bss_end;
9extern void boot();
10
11
12void startup()
13{
14    long *bss = &link_bss_start;
15    long *ptr;
16
17    // sanity check
18    if ((long)&link_bss_end > (MEMISOSTART + MEMISOSIZE)){
19                        started();
20                        shutdown();
21    }
22
23    // initialize .bss senment
24    while (bss<&link_bss_end)
25                        *bss++ = 0;
26
27//debug_led(1);
28    boot();
29}
30
31static struct {
32        int hackmode;
33        int canonmode;
34} modemap[] = {
35  { MODE_VIDEO_STD,          2600  },  //Verified ok
36  { MODE_VIDEO_COMPACT,      2602  },  //Verified
37  { MODE_SCN_AQUARIUM,       16408 },  //Verified
38  { MODE_SCN_SNOW,           16404 },  //Verified
39  { MODE_SCN_FOLIAGE,        16403 },  //verified
40  { MODE_SCN_SUNSET,         16402 },  //verified
41  { MODE_SCN_NIGHT,          16398 },  //verified ok
42  { MODE_SCN_ISO_3200,       16413 },  //verified
43  { MODE_SCN_FIREWORK,       16406 },  //verified
44  { MODE_SCN_BEACH,          16405 },  //verified
45  { MODE_INDOOR,             32785 },  //verified ok
46  { MODE_KIDS_PETS,          32784 },  //verified ok
47  { MODE_NIGHT_SNAPSHOT,     32779 },  //verified ok
48  { MODE_LANDSCAPE,          32780 },  //verified ok
49  { MODE_PORTRAIT,           32781 },  //verified ok
50  { MODE_AUTO,               32768 },  //verified ok
51  { MODE_P,                  32772 },  //verified ok
52  { MODE_TV,                 32771 },  //verified
53  { MODE_AV,                 32770 },  //verified
54  { MODE_M,                  32769 },  //verified
55  { MODE_EASY,               33311 }   //verified ok
56};
57#define MODESCNT (sizeof(modemap)/sizeof(modemap[0]))
58
59int mode_get() {
60        int mode, i, t=0xFF;
61       
62        mode  = (playrec_mode==2 || playrec_mode==4 || playrec_mode==5)?MODE_REC:MODE_PLAY;
63       
64        _GetPropertyCase(PROPCASE_SHOOTING_MODE, &t, 4);
65        for (i=0; i<MODESCNT; ++i) {
66                if (modemap[i].canonmode == t) {
67                        return (mode | (modemap[i].hackmode & MODE_SHOOTING_MASK));
68                }
69        }
70        return (mode);
71}
72
73
74static const int fl_tbl[] = {6400, 6800, 7600, 8800, 10500, 12300, 14100, 16100, 18500, 21200, 24000, 27100, 30700, 35100, 38400};
75#define NUM_FL (sizeof(fl_tbl)/sizeof(fl_tbl[0]))
76
77// focal length range is 6.4 - 38.4 mm, 36 - 216 in 35-mm equivalent.
78// So, CF_EFL = 36/6.4 * 1000 = 56250 or 216/38.4 * 1000 = 56250.
79#define CF_EFL 5625
80
81const int zoom_points = NUM_FL;
82
83int get_effective_focal_length(int zp) {
84        return (CF_EFL*get_focal_length(zp))/1000;
85}
86
87int get_focal_length(int zp) {
88    if (zp<0) return fl_tbl[0];
89    else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1];
90    else return fl_tbl[zp];
91}
92
93int get_zoom_x(int zp) {
94    if (zp<1) return 10;
95    else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]*10/fl_tbl[0];
96    else return fl_tbl[zp]*10/fl_tbl[0];
97}
98
99
100long get_vbatt_min()
101{
102    return 2300;
103}
104
105long get_vbatt_max()
106{
107    return 2550;
108}
Note: See TracBrowser for help on using the repository browser.