summaryrefslogtreecommitdiff
path: root/digital/asserv/src
diff options
context:
space:
mode:
authorNicolas Schodet2008-04-22 21:57:05 +0200
committerNicolas Schodet2008-04-22 21:57:05 +0200
commit157aee8d63e31da7687492601f3efe5bed21f4ad (patch)
treefb6e1490e2da33594d0d138a1650b64558775383 /digital/asserv/src
parent846f73eb9aac840c86b9f79874244002c9e47e0e (diff)
* digital/asserv/src:
- fixed bug for negatives 'l' twi commands.
Diffstat (limited to 'digital/asserv/src')
-rw-r--r--digital/asserv/src/asserv/twi_proto.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/digital/asserv/src/asserv/twi_proto.c b/digital/asserv/src/asserv/twi_proto.c
index 809f5112..85ad6d2c 100644
--- a/digital/asserv/src/asserv/twi_proto.c
+++ b/digital/asserv/src/asserv/twi_proto.c
@@ -123,7 +123,10 @@ twi_proto_callback (u8 *buf, u8 size)
* - 3b: theta consign offset. */
speed_theta.use_pos = speed_alpha.use_pos = 1;
speed_theta.pos_cons = pos_theta.cons;
- speed_theta.pos_cons += v8_to_v32 (0, buf[2], buf[3], buf[4]);
+ if (buf[2] & 0x80)
+ speed_theta.pos_cons += v8_to_v32 (0xff, buf[2], buf[3], buf[4]);
+ else
+ speed_theta.pos_cons += v8_to_v32 (0, buf[2], buf[3], buf[4]);
speed_alpha.pos_cons = pos_alpha.cons;
state_start (&state_main, MODE_SPEED, 0);
break;