forked from 400plus/400plus
-
Notifications
You must be signed in to change notification settings - Fork 1
/
shutter.c
82 lines (61 loc) · 1.35 KB
/
shutter.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
//#include <vxworks.h>
//#include <string.h>
//#include <ioLib.h>
//#include <clock.h>
//#include <time.h>
#include "main.h"
#include "macros.h"
#include "debug.h"
#include "firmware.h"
#include "firmware/camera.h"
#include "shutter.h"
void lock_sutter (void);
void wait_for_shutter(void);
void lock_sutter(void) {
shutter_lock = TRUE;
}
void wait_for_shutter(void) {
while (shutter_lock)
SleepTask(RELEASE_WAIT);
}
void wait_for_camera() {
while (! able_to_release())
SleepTask(RELEASE_WAIT);
}
int shutter_release() {
wait_for_camera();
lock_sutter ();
int result = press_button(IC_BUTTON_FULL_SHUTTER);
if (DPData.drive == DRIVE_MODE_TIMER)
SleepTask(SELF_TIMER_MS);
wait_for_shutter();
return result;
}
int shutter_release_bulb(int time) {
static int first = TRUE;
int button;
long delay;
int shutter_lag, mirror_lag;
if (first) {
first = FALSE;
shutter_lag = SHUTTER_LAG_1ST;
mirror_lag = MIRROR_LAG_1ST;
} else {
shutter_lag = SHUTTER_LAG_2ND;
mirror_lag = MIRROR_LAG_2ND;
}
if (DPData.drive == DRIVE_MODE_TIMER) {
button = IC_BUTTON_FULL_SHUTTER;
delay = time + shutter_lag + mirror_lag;
} else {
button = IC_BUTTON_HALF_SHUTTER;
delay = time + shutter_lag;
}
wait_for_camera();
lock_sutter ();
press_button(button);
SleepTask (delay);
press_button(button);
wait_for_shutter();
return 0;
}