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

Revision 847, 1.3 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"
5extern long link_bss_start;
6extern long link_bss_end;
7extern void boot();
8long get_sensor_width()
9{
10return 5760;
11}
12void startup()
13{
14long *bss = &link_bss_start;
15long *ptr;
16 
17if ((long)&link_bss_end > (MEMISOSTART + MEMISOSIZE)){
18started();
19shutdown();
20}
21 
22while (bss<&link_bss_end)
23*bss++ = 0;
24boot();
25}
26
27
28static const int fl_tbl[] = {7700, 9572, 11454, 13683, 16293, 19548, 23495, 28500};
29#define NUM_FL (sizeof(fl_tbl)/sizeof(fl_tbl[0]))
30#define CF_EFL 60869
31const int zoom_points = NUM_FL;
32int get_effective_focal_length(int zp) {
33return (CF_EFL*get_focal_length(zp))/10000;
34}
35int get_focal_length(int zp) {
36if (zp<0) return fl_tbl[0];
37else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1];
38else return fl_tbl[zp];
39}
40int get_zoom_x(int zp) {
41if (zp<1) return 10;
42else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]*10/fl_tbl[0];
43else return fl_tbl[zp]*10/fl_tbl[0];
44}
45#if 0
46int rec_switch_state(void) {
47// both were in the original mode_get() function, status unknown
48//      mode  = (physw_status[1] & 0x08000000)?MODE_PLAY:MODE_REC;
49//      mode  = (physw_status[0] & 0x00000040)?MODE_REC:MODE_PLAY;
50        return (physw_status[0] & 0x00000040);
51}
52#endif
53
54long get_vbatt_min()
55{
56return 3500;
57}
58long get_vbatt_max()
59{
60return 4100;
61}
Note: See TracBrowser for help on using the repository browser.