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

Revision 835, 2.5 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
28    boot();
29}
30
31static struct {
32        int hackmode;
33        int canonmode;
34} modemap[] = {
35    { MODE_AUTO,               32768 },
36    { MODE_P,                  32772 },
37    { MODE_TV,                 32771 },
38    { MODE_AV,                 32770 },
39    { MODE_M,                  32769 },
40    { MODE_VIDEO_STD,          2597  },
41    { MODE_VIDEO_COMPACT,      2599  },
42    { MODE_STITCH,             33290 },
43    { MODE_SCN_WATER,          16406 }, 
44    { MODE_SCN_AQUARIUM,       16407 }, 
45    { MODE_SCN_NIGHT,          16398 }, 
46    { MODE_SCN_GRASS,          16402 },   
47    { MODE_SCN_SNOW,           16403 }, 
48    { MODE_SCN_BEACH,          16404 }, 
49    { MODE_SCN_FIREWORK,       16405 }, 
50    { MODE_INDOOR,             32785 },
51    { MODE_KIDS_PETS,          32784 },
52    { MODE_NIGHT_SNAPSHOT,     32779 },
53    { MODE_LANDSCAPE,          32780 },
54    { MODE_PORTRAIT,           32781 },
55};
56
57
58#define MODESCNT (sizeof(modemap)/sizeof(modemap[0]))
59
60
61static const int fl_tbl[] = {5800, 6420, 7060, 7700, 8340, 9950, 11550, 13160, 14750, 17150, 19570, 22760, 26750, 30750, 34800};
62#define NUM_FL (sizeof(fl_tbl)/sizeof(fl_tbl[0]))
63#define CF_EFL 60345
64
65const int zoom_points = NUM_FL;
66
67int get_effective_focal_length(int zp) {
68    return (CF_EFL*get_focal_length(zp))/10000;
69}
70
71int get_focal_length(int zp) {
72    if (zp<0) return fl_tbl[0];
73    else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1];
74    else return fl_tbl[zp];
75}
76
77int get_zoom_x(int zp) {
78    if (zp<1) return 10;
79    else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]*10/fl_tbl[0];
80    else return fl_tbl[zp]*10/fl_tbl[0];
81}
82
83
84int mode_get() {
85    int mode, i, t=0xFF;
86
87// play/rec without override
88//    mode  = (physw_status[1] & 0x02000000)?MODE_REC:MODE_PLAY;
89
90    mode = (playrec_mode==2 || playrec_mode==4 || playrec_mode==5)?MODE_REC:MODE_PLAY;
91   
92    _GetPropertyCase(PROPCASE_SHOOTING_MODE, &t, 4);
93    for (i=0; i<MODESCNT; ++i) {
94        if (modemap[i].canonmode == t) {
95            return (mode | (modemap[i].hackmode & MODE_SHOOTING_MASK));
96        }
97    }
98    return (mode);
99}
100
101long get_vbatt_min()
102{
103    return 2300;
104}
105
106long get_vbatt_max()
107{
108    return 2550;
109}
Note: See TracBrowser for help on using the repository browser.