if (r >= 5) r--;
r = 1 << (r-1);
for (i = 0; i < 1000; i++) {
- if ((home_sensors & r) == 0) return 1;
+ if ((home_sensors & r) != 0) return 1;
delay(1);
}
/* it never left */
return 0;
}
-#define is_overcurrent() ((_io_ports[M6811_PORTE] & PORTE_MOTOR_NOT_OVERCURRENT)==0)
-
bool back_home(u8 slot) {
u8 i, r = slot%10;
if (r >= 5) r--;
r = 1 << (r-1);
for (i = 0; i < 5; i++) {
- if ((home_sensors & r) != 0) return 1;
- if (is_overcurrent()) return MOTOR_CURRENT_FAIL;
+ if ((home_sensors & r) == 0) return 1;
}
/* it never arrived */
return 0;
}
+#define is_overcurrent() ((_io_ports[M6811_PORTE] & PORTE_MOTOR_NOT_OVERCURRENT)==0)
bool motor_overcurrent() {
u8 good_passes = 0, t;
for (t = 0; t < 8; t++) {