X-Git-Url: https://git.ucc.asn.au/?p=uccvend-snackrom.git;a=blobdiff_plain;f=ROM2%2Fmain.c;h=ffeb9d2561883be5805f6fd076954adc7363bcfa;hp=c2758019387da8443fa96bd909b820ac3937774e;hb=45c42e3e9f2149e45f6642ac3fbab9010bc05455;hpb=3781ef6863f304c8242fc1216cddbdbb0c74bebe diff --git a/ROM2/main.c b/ROM2/main.c index c275801..ffeb9d2 100644 --- a/ROM2/main.c +++ b/ROM2/main.c @@ -58,6 +58,18 @@ void selection_menu() { set_msg("ENTER SELECTION OR INSERT COINS", WRAP_SCROLL); } +void load_default_msg() { + /* FIXME: want this message to be changeable from the server */ + set_msg("UNIVERSITY COMPUTER CLUB *** INSERT COINS OR USER-ID *** ", + WRAP_SCROLL); +} + +void service_menu() { + while (door_open()) { /* don't quit until door is closed */ + + } +} + int main() { /* do stuff */ set_msg("UNIVERSITY", WRAP_NONE); @@ -67,9 +79,7 @@ int main() { set_msg(" CLUB ", WRAP_NONE); delay(1000); - /* FIXME: want this message to be changeable from the server */ - set_msg("UNIVERISTY COMPUTER CLUB *** INSERT COINS OR USER-ID ***", - WRAP_SCROLL); + load_default_msg(); while(1) { /* this needs to be a relatively tight loop to make sure we catch * keypresses at the main menu @@ -82,6 +92,7 @@ int main() { switch (server_authenticate(uid, pin)) { case AUTH_GOOD: selection_menu(); + break; case AUTH_BAD: set_msg(" BAD USER ", WRAP_NONE); delay(1000); @@ -100,7 +111,16 @@ int main() { pin = 0; /* move on */ } + load_default_msg(); } + + /* test door switch */ + if (door_open()) { + service_menu(); + load_default_msg(); + } + + /* check on coin mech */ } }