X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=ROM2%2Fmotors.c;h=b0e4ee3cc3b27cdb43bbec9ba7b49260f34c6227;hb=de72195f371c5d1240309c067e8a43b0484d070a;hp=674483942718d3eec5d474fe3da9eee7a480157c;hpb=f454d8fbc15ff6516ba574e23692e8a65b9f16fd;p=uccvend-snackrom.git diff --git a/ROM2/motors.c b/ROM2/motors.c index 6744839..b0e4ee3 100644 --- a/ROM2/motors.c +++ b/ROM2/motors.c @@ -1,6 +1,20 @@ #include "motors.h" #include "vend.h" +const u8 motor_lookup[80] = +{ 1,12,23,34,46,57,68,79, + 11,22,33,44,56,67,78,89, + 21,32,43,54,66,77,88,99, + 31,42,53,64,76,87,98, + 9,41,52,63,74,86,97, + 8,19,51,62,73,84,96, + 7,18,29,61,72,83,94, + 6,17,28,39,71,82,93, + 4,16,27,38,49,81,92, + 3,14,26,37,48,59,91, + 2,13,24,36,47,58,69, +}; + void motor_shift_send(u8 data) { u8 i; /* load it in, MSB first */ @@ -81,7 +95,7 @@ bool left_home(u8 slot) { r = 1 << r; for (i = 0; i < 5; i++) - if (home_sensors & r == 0) return 1; + if ((home_sensors & r) == 0) return 1; /* it never left */ return 0; @@ -94,7 +108,7 @@ bool back_home(u8 slot) { for (i = 0; i < 5; i++) { if (home_sensors & r) return 1; - if (_io_ports[M6811_PORTE] & PORTE_MOTOR_OVERCURRENT == 0) return 1; + if ((_io_ports[M6811_PORTE] & PORTE_MOTOR_OVERCURRENT) == 0) return 1; } /* it never left */