Mercurial > tote-had
changeset 12:1298204d2f3d
Fix another off-by-one
| author | Radomir Dopieralski <sheep-devel@sheep.art.pl> |
|---|---|
| date | Thu, 07 Apr 2016 09:15:45 +0200 |
| parents | 5c99ed631554 |
| children | 94feb678de75 |
| files | controller/i2c.ino controller/leg.ino |
| diffstat | 2 files changed, 6 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/controller/i2c.ino Wed Apr 06 22:34:26 2016 +0200 +++ b/controller/i2c.ino Thu Apr 07 09:15:45 2016 +0200 @@ -24,8 +24,8 @@ void i2c_loop() { for (int leg = 0; leg < 4; ++leg) { - move_leg(leg, regs[leg * 4 + 0] + HOME, - regs[leg * 4 + 1] + HOME, - regs[leg * 4 + 2] - TIBIA); + move_leg(leg, regs[leg * 3 + 0] + HOME, + regs[leg * 3 + 1] + HOME, + regs[leg * 3 + 2] - TIBIA); } }
--- a/controller/leg.ino Wed Apr 06 22:34:26 2016 +0200 +++ b/controller/leg.ino Thu Apr 07 09:15:45 2016 +0200 @@ -53,7 +53,9 @@ double ankle = NAN; double knee = NAN; double hip = NAN; - if (leg_position[0] == x && leg_position[1] == y && leg_position[2] == z) { + if (leg_position[leg][0] == x && + leg_position[leg][1] == y && + leg_position[leg][2] == z) { return true; } leg_position[leg][0] = x;
