source: trunk/core/main.c @ 732

Revision 732, 2.8 KB checked in by EWAVR, 4 years ago (diff)
  • ixus970_sd890 fixup
  • increased startup time (for big and slow cards)
  • Property svn:eol-style set to native
RevLine 
[1]1#include "platform.h"
2#include "core.h"
3#include "conf.h"
4#include "keyboard.h"
5#include "stdlib.h"
6#include "gui.h"
[42]7#include "histogram.h"
[243]8#include "raw.h"
9#include "motion_detector.h"
[552]10#ifdef OPT_EDGEOVERLAY
11        #include "edgeoverlay.h"
12#endif
[243]13static int raw_need_postprocess;
[252]14static volatile int spytask_can_start;
[1]15
16void core_hook_task_create(void *tcb)
17{
18}
19
20void core_hook_task_delete(void *tcb)
21{
[252]22char *name = (char*)(*(long*)((char*)tcb+0x34));
[272]23 if (strcmp(name,"tInitFileM")==0) core_spytask_can_start();
[1]24}
25
[172]26
27long core_get_noise_reduction_value()
28{
[243]29    return conf.raw_nr;
[172]30}
31
32
[28]33void dump_memory()
34{
35    int fd;
[243]36    static int cnt=1;
37    static char fn[32];
[1]38
[252]39
[28]40    started();
[243]41        mkdir("A/DCIM");
42        mkdir("A/DCIM/100CANON");
43        sprintf(fn, "A/DCIM/100CANON/CRW_%04d.JPG", cnt++);
[104]44        fd = open(fn, O_WRONLY|O_CREAT, 0777);
[243]45        if (fd) {
[343]46#ifdef CAMERA_ixus65_sd630 // Zero is not readable on ixus65!
47            write(fd, (int*)0xFFFF0000, 4);
48            write(fd, (int*)4, 0x1900-4);
49#else
[104]50            write(fd, (void*)0, 0x1900);
[343]51#endif
[104]52            write(fd, (void*)0x1900, 32*1024*1024-0x1900);
53            close(fd);
[28]54        }
[243]55    vid_bitmap_refresh();
[28]56    finished();
57}
58
[243]59static volatile long raw_data_available;
[106]60
61/* called from another process */
62void core_rawdata_available()
[1]63{
[106]64    raw_data_available = 1;
65}
66
[270]67void core_spytask_can_start() {
68        spytask_can_start = 1;
69}
70
[1]71void core_spytask()
72{
[243]73    int cnt = 1;
[252]74    int i=0;
[1]75
[243]76    raw_need_postprocess = 0;
77
[252]78    spytask_can_start=0;
[1]79
[732]80    while((i++<400) && !spytask_can_start) msleep(10);
[1]81
82    started();
[104]83    msleep(50);
[1]84    finished();
[713]85    drv_self_unhide();
[1]86
[252]87    conf_restore();
88    gui_init();
89
[343]90#if CAM_CONSOLE_LOG_ENABLED
91    console_init();
92#endif
93
[243]94    mkdir("A/CHDK");
95    mkdir("A/CHDK/FONTS");
[416]96    mkdir("A/CHDK/SYMBOLS");
[243]97    mkdir("A/CHDK/SCRIPTS");
98    mkdir("A/CHDK/LANG");
99    mkdir("A/CHDK/BOOKS");
100    mkdir("A/CHDK/GRIDS");
[556]101#ifdef OPT_CURVES
[416]102    mkdir("A/CHDK/CURVES");
[546]103#endif
[428]104    mkdir("A/CHDK/DATA");
[489]105    mkdir("A/CHDK/LOGS");
[581]106#ifdef OPT_EDGEOVERLAY
[580]107    mkdir("A/CHDK/EDGE");
108#endif
[246]109    auto_started = 0;
[533]110
[416]111    if (conf.script_startup==1) script_autostart();                             // remote autostart
112        if (conf.script_startup==2) {
113                conf.script_startup=0;
114                conf_save();
115                script_autostart();
116        }
[1]117    while (1){
[106]118
119        if (raw_data_available){
[243]120            raw_need_postprocess = raw_savefile();
[106]121            hook_raw_save_complete();
122            raw_data_available = 0;
123            continue;
124        }
125
[243]126        if (state_shooting_progress != SHOOTING_PROGRESS_PROCESSING) {
127            if (((cnt++) & 3) == 0)
128                gui_redraw();
[1]129
[243]130            histogram_process();
[552]131#ifdef OPT_EDGEOVERLAY
[416]132        if(conf.edge_overlay_thresh && conf.edge_overlay_enable) edge_overlay();
[552]133#endif
[243]134        }
[28]135
[243]136        if ((state_shooting_progress == SHOOTING_PROGRESS_PROCESSING) && (!shooting_in_progress())) {
[1]137            state_shooting_progress = SHOOTING_PROGRESS_DONE;
[243]138            if (raw_need_postprocess) raw_postprocess();
139        }
[1]140
[104]141        msleep(20);
[1]142    }
143}
144
[416]145
146
[428]147
Note: See TracBrowser for help on using the repository browser.