source: branches/release-1_0/platform/sx210is/main.c @ 1739

Revision 1739, 1.4 KB checked in by philmoz, 15 months ago (diff)

A few updates:

  • increase auto ISO max allowed value from 800 to 3200
  • fix auto ISO bug where values not always initialised correctly
  • fix strrchr for SX10 1.00c (thx srsa_4c)
  • add DNG_LENS_INFO for SX210, signature finder now finds focus len table in firmware
  • update SX210 (main.c) to use firmware focus len table (thx srsa_4c for pointing out mistake in prev table)
  • 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
15
16        long *bss = &link_bss_start;
17        long *ptr;
18
19        // sanity check
20        if ((long)&link_bss_end > (MEMISOSTART + MEMISOSIZE)){
21                started();
22                shutdown();
23        }
24
25        // initialize .bss senment
26        while (bss<&link_bss_end)
27                *bss++ = 0;
28
29
30        boot();
31}
32
33
34//zoom position is get_parameter_data(87)
35
36// Focus length table in firmware @ 0xfffea1cc
37#define NUM_FL 126              // 0 - 125, entries in firmware (3 words each entry, first is FL)
38extern int focus_len_table[NUM_FL*3];
39
40// Focal length range is 5.0 - 70,0 mm, 27.3 - 392 in 35-mm equivalent.
41// So, CF_EFL = 27.3/5.0*10000=54600 or392/70*10000=56000
42// diff = 54600 - 54566.6 = 1400, split it 1400 / 2 = 700
43// add to base 56000 + 700 = 56700
44// divide by 10 to avoid overflow in get_effective_focal_length()
45#define CF_EFL  5670
46const int zoom_points = NUM_FL;
47
48int get_effective_focal_length(int zp) {
49        return (CF_EFL*get_focal_length(zp))/1000;
50}
51
52int get_focal_length(int zp) {
53        if (zp < 0) zp = 0;
54        else if (zp >= NUM_FL) zp = NUM_FL-1;
55        return focus_len_table[zp*3];
56}
57
58int get_zoom_x(int zp) {
59        return get_focal_length(zp)*10/focus_len_table[0];
60}
61
62
63long get_vbatt_min()
64{
65        return 3280;  // min observed was 3.408, then it died
66}
67
68long get_vbatt_max()
69{
70        return 4057;  // fresh from change (actual was 4.127)
71}
Note: See TracBrowser for help on using the repository browser.