- sprintf(tmp, "d%i\r\n", Item);
- write(giCoke_SerialFD, tmp, 4);
-
- // Read empty lines
- while( (ret = ReadLine(sizeof(tmp)-1, tmp)) == -1 );
- if( ret == -1 ) return -1;
- // Read d%i
- while( tmp[0] == ':' ) {
- ret = ReadLine(sizeof(tmp)-1, tmp);
- if( ret == -1 ) return -1;
- }
- // Get status
- ret = ReadLine(sizeof(tmp)-1, tmp);
- if( ret == -1 ) return -1;
-
- WaitForColon(); // Eat up rest of response
-
- #if TRACE_COKE
- printf("Coke_DoDispense: done\n");
- #endif
-
- // TODO: Regex
- if( strcmp(tmp, "ok") == 0 ) {
- // We think dispense worked
- // - The machine returns 'ok' if an empty slot is dispensed, even if
- // it doesn't actually try to dispense (no sound)
- return 0;
+ if( _WriteBit(ciCoke_DropBitBase + Slot, 1) )
+ {
+ perror("Coke_int_DropSlot - modbus_write_bit");
+ return -2;