summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--maintain_focus.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/maintain_focus.c b/maintain_focus.c
index dd90038..a1121a6 100644
--- a/maintain_focus.c
+++ b/maintain_focus.c
@@ -100,35 +100,42 @@ int main() {
printw("%s", key_help_msg);
printw("Level 3:\t\t%i\nLevel 2:\t\t%i\nLevel 1:\t\t%i\n", focal_distance[2], focal_distance[1], focal_distance[0]);
refresh();
+ flushinp();
switch(getch()) {
case 'q':
focal_distance[2]++;
set_widget_value(focus_widget, "Near 3", FOCUS_WIDGET_NAME, cam, context);
+ usleep(500000);
break;
case 'w':
focal_distance[1]++;
set_widget_value(focus_widget, "Near 2", FOCUS_WIDGET_NAME, cam, context);
+ usleep(250000);
break;
case 'e':
focal_distance[0]++;
set_widget_value(focus_widget, "Near 1", FOCUS_WIDGET_NAME, cam, context);
+ usleep(125000);
break;
case 'a':
if(focal_distance[2] > 0) {
focal_distance[2]--;
set_widget_value(focus_widget, "Far 3", FOCUS_WIDGET_NAME, cam, context);
+ usleep(500000);
}
break;
case 's':
if(focal_distance[1] > 0) {
focal_distance[1]--;
set_widget_value(focus_widget, "Far 2", FOCUS_WIDGET_NAME, cam, context);
+ usleep(250000);
}
break;
case 'd':
if(focal_distance[0] > 0) {
focal_distance[0]--;
set_widget_value(focus_widget, "Far 1", FOCUS_WIDGET_NAME, cam, context);
+ usleep(125000);
}
break;
case 'Q':
@@ -148,6 +155,21 @@ int main() {
clear();
printw("Restoring focus...\n");
+ for(; focal_distance[2] >= 1; focal_distance[2]--) {
+ set_widget_value(focus_widget, "Near 3", FOCUS_WIDGET_NAME, cam, context);
+ usleep(500000);
+ }
+
+ for(; focal_distance[1] >= 1; focal_distance[1]--) {
+ set_widget_value(focus_widget, "Near 2", FOCUS_WIDGET_NAME, cam, context);
+ usleep(250000);
+ }
+
+ for(; focal_distance[0] >= 1; focal_distance[0]--) {
+ set_widget_value(focus_widget, "Near 1", FOCUS_WIDGET_NAME, cam, context);
+ usleep(125000);
+ }
+
printw("Done!\n");
user_conf();