source: trunk/lib/ubasic/camera_functions.c @ 977

Revision 977, 9.3 KB checked in by reyalp, 3 years ago (diff)

renames and cleanup in preparation for making script optional. From ultimA in http://chdk.setepontos.com/index.php?topic=5793.msg57064#msg57064

  • Property svn:eol-style set to native
Line 
1#ifdef UBASIC_TEST
2
3#include <stdio.h>
4
5static int tv=0, av=0, zoom=0, focus=0, iso=0, raw=0, raw_nr=0,autostart=0;
6int movie_status=0;
7int shot_histogram_enabled=0;
8int state_kbd_script_run=1;
9int zoom_points = 3;
10#define MODE_REC                0x0100
11
12void ubasic_camera_press(const char *s)
13{
14    printf("*** button press '%s' ***\n",s);
15}
16
17void ubasic_camera_release(const char *s)
18{
19    printf("*** button release '%s' ***\n",s);
20}
21
22void ubasic_camera_click(const char *s)
23{
24    printf("*** button click '%s' ***\n",s);
25}
26
27void ubasic_camera_sleep(int v)
28{
29    printf("*** sleep %d ***\n",v);
30}
31
32void ubasic_camera_shoot()
33{
34    printf("*** shoot ***\n");
35}
36
37void ubasic_camera_wait_click(int t)
38{
39    printf("*** wait_click %d ***\n", t);
40}
41
42int ubasic_camera_is_clicked(const char *s)
43{
44    printf("*** is_key '%s' ***\n", s);
45    return 1;
46}
47
48int shooting_get_tv()
49{
50    return tv;
51}
52
53void shooting_set_tv(int v)
54{
55    tv = v;
56    printf("*** set tv %d ***\n",v);
57}
58
59void shooting_set_tv_rel(int v)
60{
61    tv += v;
62    printf("*** set tv rel %d ***\n",v);
63}
64
65int shooting_get_av()
66{
67    return av;
68}
69
70void shooting_set_av(int v)
71{
72    av = v;
73    printf("*** set av %d ***\n",v);
74}
75
76void shooting_set_av_rel(int v)
77{
78    av += v;
79    printf("*** set av rel %d ***\n",v);
80}
81
82int shooting_get_zoom()
83{
84    return zoom;
85}
86
87void shooting_set_zoom(int v)
88{
89    zoom = v;
90    printf("*** set zoom %d ***\n",v);
91}
92
93void shooting_set_zoom_rel(int v)
94{
95    zoom += v;
96    printf("*** set zoom rel %d ***\n",v);
97}
98
99void shooting_set_zoom_speed(int v)
100{
101    printf("*** set zoom speed %d ***\n",v);
102}
103
104int shooting_get_focus()
105{
106    return focus;
107}
108
109void shooting_set_focus(int v)
110{
111    focus = v;
112    printf("*** set focus %d ***\n",v);
113}
114
115int shooting_get_iso()
116{
117    return iso;
118}
119
120void shooting_set_iso(int v)
121{
122    iso = v;
123    printf("*** set iso %d ***\n",v);
124}
125//ARM Begin
126int shooting_get_iso_real()
127{
128  return iso;
129}
130//ARM End
131void script_console_add_line(const char *str) {
132    printf(">>> %s\n", str);
133}
134
135void script_console_set_layout(int x1, int y1, int x2, int y2) {
136    printf(">>> set console layout to %d %d %d %d\n", x1,y1,x2,y2);
137}
138
139void script_console_set_autoredraw(int value) {
140    printf(">>> set console auto_redraw to %d\n", x1);
141}
142
143void script_console_redraw() {
144    printf("*** console redraw ***\n");
145}
146
147void script_console_clear() {
148    printf("*** clear console ***\n");
149}
150int md_detect_motion(void)
151{
152    printf("*** md_detect_motion ***\n");
153        return 0;
154}
155int md_get_cell_diff(int column, int row)
156{
157    printf("*** md_get_sell_diff %d %d ***\n", column, row);
158        return 0;
159}
160int md_init_motion_detector()
161{
162    printf("*** md_init_motion_detector ***\n");
163        return 0;
164}
165void camera_set_nr(to)
166{
167        raw_nr = to;
168    printf("*** set raw nr %d ***\n",raw_nr);
169};
170
171int camera_get_nr(to)
172{
173    printf("*** get raw nr ***\n");
174        return raw_nr;
175};
176
177void camera_set_raw(int mode)
178{
179        raw = mode;
180    printf("*** set raw %d ***\n",raw);
181}
182
183int ubasic_camera_get_raw()
184{
185        return raw;
186}
187void shooting_set_prop(int id, int v)
188{
189    printf("*** set prop %d %d ***\n",id, v);
190}
191int shooting_get_prop(int id)
192{
193        return 0;
194}
195long stat_get_vbatt()
196{
197        return 4085;
198}
199void camera_set_led(int led, int state, int bright)
200{
201    printf("*** set led %d %d %d ***\n",led, state, bright);
202}
203int shooting_get_day_seconds()
204{
205        return 0;
206}
207
208int shooting_get_tick_count()
209{
210        return 0;
211}
212int camera_get_script_autostart()
213{
214        return 0;
215}
216void camera_set_script_autostart(int state)
217{
218        autostart = state;
219    printf("*** set autostart %d ***\n",autostart);
220}
221int get_usb_power(int edge)
222{
223        return 0;
224}
225int GetTotalCardSpaceKb()
226{
227        return 0;
228}
229int GetFreeCardSpaceKb()
230{
231        return 0;
232}
233
234int GetJpgCount()
235{
236    printf("*** GetJpgCount ***\n");
237    return 0;
238}
239
240int GetRawCount()
241{
242    printf("*** GetRawCount ***\n");
243    return 0;
244}
245
246void exit_alt()
247{
248    printf("*** exit alt ***\n");
249
250}
251
252void shooting_set_user_tv_by_id(int v)
253{
254    printf("*** shooting_set_user_tv_by_id %d ***\n", v);
255}
256
257void shooting_set_user_tv_by_id_rel(int v)
258{
259    printf("*** shooting_set_user_tv_by_id_rel %d ***\n", v);
260}
261
262void shooting_set_sv96(short sv96, short is_now)
263{
264    printf("*** shooting_set_sv96 %d %d ***\n", sv96, is_now);
265}
266
267short shooting_get_av96()
268{
269    printf("*** shooting_get_av96 ***\n");
270    return 0;
271}
272
273short shooting_get_user_av96()
274{
275    printf("*** shooting_get_user_av96 ***\n");
276    return 0;
277}
278
279int shooting_get_user_av_id()
280{
281    printf("*** shooting_get_user_av_id ***\n");
282    return 0;
283}
284
285void shooting_set_av96(short v,short is_now)
286{
287    printf("*** shooting_set_av96 %d %d ***\n", v, is_now);
288}
289
290void shooting_set_av96_direct(short v, short is_now)
291{
292    printf("*** shooting_set_av96_direct %d %d ***\n", v, is_now);
293}
294
295void shooting_set_user_av96(short v)
296{
297    printf("*** shooting_set_user_av96 %d ***\n", v);
298}
299
300void shooting_set_user_av_by_id(int v)
301{
302    printf("*** shooting_set_user_av_by_id %d ***\n", v);
303}
304
305void shooting_set_user_av_by_id_rel(int v)
306{
307    printf("*** shooting_set_user_av_by_id_rel %d ***\n", v);
308}
309
310int shooting_get_subject_distance()
311{
312    printf("*** shooting_get_subject_distance ***\n");
313    return 1000;
314}
315
316int shooting_get_near_limit_of_acceptable_sharpness()
317{
318    printf("*** shooting_get_near_limit_of_acceptable_sharpness ***\n");
319    return 500;
320}
321
322int shooting_get_far_limit_of_acceptable_sharpness()
323{
324    printf("*** shooting_get_far_limit_of_acceptable_sharpness ***\n");
325    return 1500;
326}
327
328int shooting_get_depth_of_field()
329{
330    printf("*** shooting_get_depth_of_field ***\n");
331    return 1000;
332}
333
334int shooting_get_hyperfocal_distance()
335{
336    printf("*** shooting_get_hyperfocal_distance ***\n");
337    return 1000;
338}
339
340int mode_get()
341{
342    printf("*** mode_get ***\n");
343    return MODE_REC;
344}
345
346short shooting_get_focus_mode()
347{
348    printf("*** shooting_get_focus_mode ***\n");
349    return 0;
350}
351
352short shooting_get_iso_market()
353{
354    printf("*** shooting_get_iso_market ***\n");
355    return 100;
356}
357
358short shooting_get_bv96()
359{
360    printf("*** shooting_get_bv96 ***\n");
361    return 32;
362}
363
364short shooting_get_sv96()
365{
366    printf("*** shooting_get_sv96 ***\n");
367    return 32;
368}
369
370void shooting_set_iso_real(short iso, short is_now)
371{
372    printf("*** shooting_set_iso_real %d %d ***\n", iso, is_now);
373}
374
375int shooting_get_iso_mode()
376{
377    printf("*** shooting_get_iso_mode ***\n");
378    return 0;
379}
380
381void shooting_set_iso_mode(int v)
382{
383    printf("*** shooting_set_iso_mode %d ***\n", v);
384}
385
386void shooting_set_nd_filter_state(short v, short is_now)
387{
388    printf("*** shooting_set_nd_filter_state %d %d ***\n", v, is_now);
389}
390
391void camera_shutdown_in_a_second()
392{
393    printf("*** camera_shutdown_in_a_second ***\n");
394}
395
396short shooting_get_tv96()
397{
398    printf("*** shooting_get_tv96 ***\n");
399    return 0;
400}
401
402short shooting_get_user_tv96()
403{
404    printf("*** shooting_get_user_tv96 ***\n");
405    return 0;
406}
407
408int shooting_get_user_tv_id()
409{
410    printf("*** shooting_get_user_tv_id ***\n");
411    return 0;
412}
413
414void shooting_set_tv96(short v, short is_now)
415{
416    printf("*** shooting_set_tv96 %d %d ***\n", v, is_now);
417}
418
419void shooting_set_shutter_speed_ubasic(int t, short is_now)
420{
421    printf("*** shooting_set_shutter_speed_ubasic %d %d ***\n", t, is_now);
422}
423
424void shooting_set_tv96_direct(short v, short is_now)
425{
426    printf("*** shooting_set_tv96_direct %d %d ***\n", v, is_now);
427}
428
429void shooting_set_user_tv96(short v)
430{
431    printf("*** shooting_set_user_tv96 %d ***\n", v);
432}
433
434int get_exposure_counter(void)
435{
436    printf("*** get_exposure_counter ***\n");
437        return 123;
438}
439
440
441int ubasic_camera_is_pressed(const char *v)
442{
443    printf("*** ubasic_camera_is_pressed %s ***\n", v);
444        return 0;
445}
446
447
448int shot_histogram_get_range(int from, int to)
449{
450    printf("*** shot_histogram_get_range %d,%d ***\n", from,to);
451        return 100;
452}
453
454void script_print_screen_statement(int v)
455{
456    printf("*** script_print_screensatement %d ***\n", v);
457}
458
459int get_tick_count(void)
460{
461    printf("*** get_tick_count ***\n");
462        // what should it return ?
463        return 10;
464}
465
466short shooting_get_drive_mode()
467{
468    printf("*** shooting_get_drive_mode ***\n");
469        // what should it return ?
470        return 10;
471}
472
473int shot_histogram_isenabled()
474{
475    printf("*** shot_histogram_isenabled ***\n");
476        return shot_histogram_enabled;
477}
478
479int get_ccd_temp()
480{
481    printf("*** get_ccd_temp ***\n");
482        return 69;
483}
484int get_optical_temp()
485{
486    printf("*** get_optical_temp ***\n");
487        return 69;
488}
489
490int get_battery_temp()
491{
492    printf("*** get_battery_temp ***\n");
493        return 69;
494}
495
496void play_sound()
497{
498    printf("*** play_sound ***\n");
499}       
500
501void TurnOnBackLight()
502{
503    printf("*** TurOnBackLight ***\n");
504}
505
506void TurnOffBackLight()
507{
508    printf("*** TurnOffBackLight ***\n");
509}
510
511void DoAFLock()
512{
513    printf("*** DoAFLock ***\n");
514}
515
516void UnlockAF()
517{
518    printf("*** UnlockAF ***\n");
519}
520
521int shot_histogram_set(int x)
522{
523    printf("*** shot_histogram_set ***\n");
524        return 1;
525}
526
527void levent_set_record()
528{
529    printf("*** levent_set_record ***\n");
530}
531
532void levent_set_play()
533{
534    printf("*** levent_set_play ***\n");
535}
536
537int set_capture_mode(int x)
538{
539    printf("*** set_capture_mode %d ***\n",x);
540        return 1;
541}
542
543int shooting_set_mode_chdk(int x)
544{
545    printf("*** set_capture_mode_canon %d ***\n",x);
546        return 1;
547}
548
549int shooting_set_mode_canon(int x)
550{
551    printf("*** set_capture_mode_canon %d ***\n",x);
552        return 1;
553}
554
555int shooting_mode_chdk2canon(int chdkmode)
556{
557    printf("*** shooting_mode_chdk2canon %d ***\n",chdkmode);
558        if(chdkmode < 1 || chdkmode > 50)
559                return 0;
560        return 1;
561}
562#endif
Note: See TracBrowser for help on using the repository browser.