- Writef("d%i\r\n", Item);
-
- // Read empty lines and echo-backs
- do {
- ret = ReadLine(sizeof(tmp)-1, tmp);
- if( ret == -1 ) {
- pthread_mutex_unlock(&gCoke_Mutex);
- return -1;
- }
- #if TRACE_COKE
- printf("Coke_DoDispense: read %i '%s'\n", ret, tmp);
- #endif
- } while( ret == 0 || tmp[0] == ':' || tmp[0] == 'd' );
-
- WaitForColon(); // Eat up rest of response
-
- #if TRACE_COKE
- printf("Coke_DoDispense: done\n");
- #endif
-
- // TODO: Regex instead?
- 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)
- ret = 0;
- }
- else {
- printf("Coke_DoDispense: Machine returned unknown value '%s'\n", tmp);
- ret = -1;
+ if( _WriteBit(ciCoke_DropBitBase + Slot, 1) )
+ {
+ perror("Coke_int_DropSlot - modbus_write_bit");
+ return -2;