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

Revision 847, 1.2 KB checked in by reyalp, 3 years ago (diff)

Mode override support. See http://chdk.kernreaktor.org/mantis/view.php?id=64
All cameras except ixus40_sd400 should be supported

rec_mode_active (checks play_rec_mode, weak, can be overriden on cameras that need it)
screen_opened, screen_rotated: only defined on swivel screen cams, check phsw_ bits for screen pos

  • move old play/rec checking code to rec_switch_state. #ifdef'd out for now
  • move mode enum into it's own header file: modelist.h to allow easy lua generation.
  • use playrec_mode on tx1

+ add new generated lua file LUALIB/GEN/modelist.lua
+ add lua library LUALIB/capmode.lua see http://chdk.wikia.com/wiki/LUA/Scripts:Standard/Lualib/Capmode
+ add test scripts see

http://chdk.wikia.com/wiki/UBASIC/Scripts:Standard/Test/Setmode
http://chdk.wikia.com/wiki/LUA/Scripts:Standard/Test/Setmode

  • 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
31
32static const int fl_tbl[] = {5800, 6420, 7060, 7700, 8340, 9950, 11550, 13160, 14750, 17150, 19570, 22760, 26750, 30750, 34800};
33#define NUM_FL (sizeof(fl_tbl)/sizeof(fl_tbl[0]))
34#define CF_EFL 60345
35
36const int zoom_points = NUM_FL;
37
38int get_effective_focal_length(int zp) {
39    return (CF_EFL*get_focal_length(zp))/10000;
40}
41
42int get_focal_length(int zp) {
43    if (zp<0) return fl_tbl[0];
44    else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1];
45    else return fl_tbl[zp];
46}
47
48int get_zoom_x(int zp) {
49    if (zp<1) return 10;
50    else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]*10/fl_tbl[0];
51    else return fl_tbl[zp]*10/fl_tbl[0];
52}
53
54#if 0
55int rec_switch_state(void) {
56        return (physw_status[1] & 0x02000000);
57}
58#endif
59
60
61long get_vbatt_min()
62{
63    return 2300;
64}
65
66long get_vbatt_max()
67{
68    return 2550;
69}
Note: See TracBrowser for help on using the repository browser.