- if (last_key == KEY_RESET)
- display_buf[display_pos] = 'R';
- else
- display_buf[display_pos] = '0'+(last_key%10);
- display_pos++;
- display_pos %= 10;
- set_msg(display_buf);
+ if (last_key == KEY_RESET) {
+ cur_motor[0] = 0xff;
+ } else {
+ if (cur_motor[0]) {
+ cur_motor[1] = last_key%10;
+ display_buf[1] = cur_motor[0]+'0';
+ set_msg(display_buf);
+ dispense_motor(cur_motor[0]*10 + cur_motor[1]);
+ set_msg(" DONE ");
+ display_buf[0] = ' ';
+ display_buf[1] = ' ';
+ cur_motor[0] = 0xff;
+ delay(1000);
+ } else {
+ cur_motor[0] = last_key%10;
+ display_buf[0] = cur_motor[0]+'0';
+ set_msg(display_buf);
+ }
+ }