From 1ab4cc22cc167f31eb500e476cf41d290025d02c Mon Sep 17 00:00:00 2001 From: Brett Weiland Date: Sun, 20 Sep 2020 18:52:37 -0500 Subject: modified: maintain_focus.c --- maintain_focus.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) 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(); -- cgit v1.2.3