From: John Hodge Date: Sat, 19 Feb 2011 04:56:06 +0000 (+0800) Subject: Reset slot names on startup X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;ds=sidebyside;h=54085f9d3fa0c1b1eeb3a82a0c4a6e3400d9961c;p=tpg%2Fopendispense2.git Reset slot names on startup --- diff --git a/src/server/handler_coke.c b/src/server/handler_coke.c index decdf4d..ee7b869 100644 --- a/src/server/handler_coke.c +++ b/src/server/handler_coke.c @@ -50,6 +50,24 @@ int Coke_InitHandler() if( giCoke_SerialFD == -1 ) { fprintf(stderr, "ERROR: Unable to open coke serial port ('%s')\n", gsCoke_SerialPort); } + else { + // Reset the slot names. + // - Dunno why this is needed, but the machine plays silly + // sometimes. + write(giCoke_SerialFD, "n0 Slot0\n", 9); + WaitForColon(); + write(giCoke_SerialFD, "n1 Slot0\n", 9); + WaitForColon(); + write(giCoke_SerialFD, "n2 Slot0\n", 9); + WaitForColon(); + write(giCoke_SerialFD, "n3 Slot0\n", 9); + WaitForColon(); + write(giCoke_SerialFD, "n4 Slot0\n", 9); + WaitForColon(); + write(giCoke_SerialFD, "n5 Slot0\n", 9); + WaitForColon(); + write(giCoke_SerialFD, "n6 Coke\n", 8); + } CompileRegex(&gCoke_StatusRegex, "^slot\\s+([0-9]+)\\s+([^:]+):([a-zA-Z]+)\\s*", REG_EXTENDED); return 0;