diff options
author | Brett Weiland <brett_weiland@bpcspace.com> | 2020-09-20 18:52:37 -0500 |
---|---|---|
committer | Brett Weiland <brett_weiland@bpcspace.com> | 2020-09-20 18:52:37 -0500 |
commit | 1ab4cc22cc167f31eb500e476cf41d290025d02c (patch) | |
tree | 7b325cbfd541131bcf76cef077e8f57c8513c837 | |
parent | ac650d65b065faaec76b8327e493757344195cc9 (diff) |
modified: maintain_focus.c
-rw-r--r-- | maintain_focus.c | 22 |
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(); |