In setupmenu, case 'u': if (line < LINES) line++; should be changed into case 'u': if (line < LINES-1) line++;
In setupmenu,
case 'u':
if (line < LINES) line++;
should be changed into
case 'u':
if (line < LINES-1) line++;