--- a/brewco/keyboard.c Sat Nov 28 13:47:00 2015 +0100 +++ b/brewco/keyboard.c Sat Nov 28 20:15:38 2015 +0100 @@ -64,6 +64,28 @@ int keypressed(void); + +/* + * Wait for a key. Return the pressed key. + */ +int keywait(void) +{ + int key; + + do { + usleep(50000); + slcdDummy(slcdHandle); + key = keycheck(); + if (my_shutdown) + return KEY_NONE; + } while (key == KEY_NONE); + + fprintf(stdout, "keywait %d\n", key); + return key; +} + + + /* * Check for a key. Return last pressed key or none. */ @@ -99,9 +121,9 @@ #ifdef HAVE_WIRINGPI_H -PI_THREAD (my_panel_loop) +PI_THREAD (my_keyboard_loop) #else -void *my_panel_loop(void *threadid) +void *my_keyboard_loop(void *threadid) #endif { int Return = 0, Enter = 0, Up = 0, Down = 0, Backlight = LCD_SLEEP, AnyKey = FALSE; @@ -114,9 +136,9 @@ pinMode(PANEL_DOWN, INPUT); #endif - syslog(LOG_NOTICE, "Thread my_panel_loop started"); + syslog(LOG_NOTICE, "Thread my_keyboard_loop started"); if (debug) - fprintf(stdout, "Thread my_panel_loop started\n"); + fprintf(stdout, "Thread my_keyboard_loop started\n"); /* * Loop forever until the external shutdown variable is set. @@ -215,20 +237,6 @@ if (Backlight > 0) { Backlight--; } - -#ifdef HAVE_WIRINGPI_H -// piLock(LOCK_MENU); -#endif -// if (setupmenu != MENU_NONE) { -// if (menutimer < MENU_TIMEOUT) -// menutimer++; -// else { -// setupmenu = MENU_NONE; -// } -// } -#ifdef HAVE_WIRINGPI_H -// piUnlock(LOCK_MENU); -#endif } } @@ -238,9 +246,9 @@ usleep(10000); } - syslog(LOG_NOTICE, "Thread my_panel_loop stopped"); + syslog(LOG_NOTICE, "Thread my_keyboard_loop stopped"); if (debug) - fprintf(stdout, "Thread my_panel_loop stopped\n"); + fprintf(stdout, "Thread my_keyboard_loop stopped\n"); return 0; }