From 37ee298c4b7ae134f1a00c59e02641a8e654731b Mon Sep 17 00:00:00 2001 From: Bernard Blackham Date: Mon, 21 Jun 2004 14:07:42 +0000 Subject: [PATCH] To romP --- ROM2/motors.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/ROM2/motors.c b/ROM2/motors.c index 13316ff..725c93e 100644 --- a/ROM2/motors.c +++ b/ROM2/motors.c @@ -99,29 +99,27 @@ bool left_home(u8 slot) { 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++) { -- 2.20.1