More useful error messages
To romK
motor_num = cur_motor[0]%10;
motor_num *= 10;
motor_num += cur_motor[1];
- dispense_motor(motor_num);
+ switch (dispense_motor(motor_num)) {
+ case MOTOR_HOME_FAIL:
+ set_msg(" HOME FAIL ");
+ break;
+ case MOTOR_CURRENT_FAIL:
+ set_msg(" OVER CRNT ");
+ break;
+ case MOTOR_SUCCESS:
+ set_msg("THANK YOU");
+ break;
+ default:
+ set_msg("ERRRRRRRR?");
+ break;
+ }
- set_msg("THANK YOU");
display_buf[0] = ' ';
display_buf[1] = ' ';
cur_motor[0] = 0xff;
bool left_home(u8 slot) {
u8 i, r = slot%10;
if (r >= 5) r--;
- r = 1 << r;
+ r = 1 << (r-1);
for (i = 0; i < 5; i++)
if ((home_sensors & r) == 0) return 1;
bool back_home(u8 slot) {
u8 i, r = slot%10;
if (r >= 5) r--;
- r = 1 << r;
+ r = 1 << (r-1);
for (i = 0; i < 5; i++) {
if (home_sensors & r) return 1;