void core_spytask() { int cnt = 1; int i=0; // Init camera_info bits that can't be done statically camera_info_init(); spytask_can_start=0; #ifdef OPT_EXMEM_MALLOC extern void exmem_malloc_init(void); exmem_malloc_init(); #endif #ifdef CAM_CHDK_PTP extern void init_chdk_ptp_task(); init_chdk_ptp_task(); #endif while((i++<400) && !spytask_can_start) msleep(10); started(); msleep(50); finished(); #if !CAM_DRYOS drv_self_unhide(); #endif conf_restore(); extern void gui_init(); gui_init(); #if CAM_CONSOLE_LOG_ENABLED extern void cam_console_init(); cam_console_init(); #endif mkdir("A/CHDK"); mkdir("A/CHDK/FONTS"); mkdir("A/CHDK/SYMBOLS"); mkdir("A/CHDK/SCRIPTS"); mkdir("A/CHDK/LANG"); mkdir("A/CHDK/BOOKS"); mkdir("A/CHDK/MODULES"); mkdir("A/CHDK/MODULES/CFG"); mkdir("A/CHDK/GRIDS"); mkdir("A/CHDK/CURVES"); mkdir("A/CHDK/DATA"); mkdir("A/CHDK/LOGS"); mkdir("A/CHDK/EDGE"); // Calculate the value of get_tick_count() when the clock ticks over to the next second // Used to calculate the SubSecondTime value when saving DNG files. long t1, t2; t2 = time(0); do { t1 = t2; camera_info.tick_count_offset = get_tick_count(); t2 = time(0); msleep(10); } while (t1 != t2); camera_info.tick_count_offset = camera_info.tick_count_offset % 1000; // remote autostart if (conf.script_startup==1) { script_autostart(); } else if (conf.script_startup==2) { conf.script_startup=0; conf_save(); script_autostart(); } shooting_init(); while (1) { if ( memdmptick && (get_tick_count() >= memdmptick) ) { memdmptick = 0; dump_memory(); } // Change ALT mode if the KBD task has flagged a state change gui_activate_alt_mode(); #ifdef CAM_LOAD_CUSTOM_COLORS // Color palette function extern void load_chdk_palette(); load_chdk_palette(); #endif if (raw_data_available) { raw_process(); extern void hook_raw_save_complete(); hook_raw_save_complete(); raw_data_available = 0; #ifdef CAM_HAS_GPS if( (int)conf.gps_waypoint_save == 1 ) wegpunkt(); #endif continue; } if ((camera_info.state.state_shooting_progress != SHOOTING_PROGRESS_PROCESSING) || recreview_hold) { if (((cnt++) & 3) == 0) gui_redraw(); } if (camera_info.state.state_shooting_progress != SHOOTING_PROGRESS_PROCESSING) { if (conf.show_histo) histogram_process(); #ifdef OPT_EDGEOVERLAY if(((gui_get_mode()==GUI_MODE_NONE) || (gui_get_mode()==GUI_MODE_ALT)) && conf.edge_overlay_thresh && conf.edge_overlay_enable) { // We need to skip first tick because stability static int skip_counter=1; if (skip_counter>0) { skip_counter--; } else { libedgeovr->edge_overlay(); } } #endif } if ((camera_info.state.state_shooting_progress == SHOOTING_PROGRESS_PROCESSING) && (!shooting_in_progress())) { camera_info.state.state_shooting_progress = SHOOTING_PROGRESS_DONE; } i = 0; #ifdef DEBUG_PRINT_TO_LCD sprintf(osd_buf, "%d", cnt ); // modify cnt to what you want to display draw_txt_string(1, i++, osd_buf, conf.osd_color); #endif if (camera_info.perf.md_af_tuning) { sprintf(osd_buf, "MD last %-4d min %-4d max %-4d avg %-4d", camera_info.perf.af_led.last, camera_info.perf.af_led.min, camera_info.perf.af_led.max, (camera_info.perf.af_led.count>0)?camera_info.perf.af_led.sum/camera_info.perf.af_led.count:0); draw_txt_string(1, i++, osd_buf, conf.osd_color); } // Process async module unload requests module_tick_unloader(); msleep(20); chdk_started_flag=1; } }
void core_spytask() { int cnt = 1; int i=0; raw_need_postprocess = 0; spytask_can_start=0; while((i++<400) && !spytask_can_start) msleep(10); started(); msleep(50); finished(); drv_self_unhide(); conf_restore(); gui_init(); #if CAM_CONSOLE_LOG_ENABLED console_init(); #endif mkdir("A/CHDK"); mkdir("A/CHDK/FONTS"); mkdir("A/CHDK/SYMBOLS"); mkdir("A/CHDK/SCRIPTS"); mkdir("A/CHDK/LANG"); mkdir("A/CHDK/BOOKS"); mkdir("A/CHDK/GRIDS"); #ifdef OPT_CURVES mkdir("A/CHDK/CURVES"); #endif mkdir("A/CHDK/DATA"); mkdir("A/CHDK/LOGS"); #ifdef OPT_EDGEOVERLAY mkdir("A/CHDK/EDGE"); #endif auto_started = 0; if (conf.script_startup==1) script_autostart(); // remote autostart if (conf.script_startup==2) { conf.script_startup=0; conf_save(); script_autostart(); } while (1) { if (raw_data_available) { raw_need_postprocess = raw_savefile(); hook_raw_save_complete(); raw_data_available = 0; continue; } if (state_shooting_progress != SHOOTING_PROGRESS_PROCESSING) { if (((cnt++) & 3) == 0) gui_redraw(); histogram_process(); #ifdef OPT_EDGEOVERLAY if(conf.edge_overlay_thresh && conf.edge_overlay_enable) edge_overlay(); #endif } if ((state_shooting_progress == SHOOTING_PROGRESS_PROCESSING) && (!shooting_in_progress())) { state_shooting_progress = SHOOTING_PROGRESS_DONE; if (raw_need_postprocess) raw_postprocess(); } msleep(20); } }