modified: maintain_focus.c

This commit is contained in:
Brett Weiland 2020-09-20 18:52:37 -05:00
parent ac650d65b0
commit 1ab4cc22cc

View File

@ -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();