From 320a0691870e4f9eea97bb49558a24a2cd742a6f Mon Sep 17 00:00:00 2001 From: Jérémy Dufour Date: Mon, 10 Mar 2008 15:53:16 +0100 Subject: * digital/io/src * correct a few bugs in the asserv module (thanks to ni): - return a positive value; - use the LSB part for the distance and X/Y positions; - update todo. --- digital/io/src/asserv.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'digital/io/src/asserv.c') diff --git a/digital/io/src/asserv.c b/digital/io/src/asserv.c index 298c774c..2171e04c 100644 --- a/digital/io/src/asserv.c +++ b/digital/io/src/asserv.c @@ -104,7 +104,7 @@ asserv_twi_send_command (uint8_t command, uint8_t length) /* Send command to the asserv */ if (twi_ms_send (AC_ASSERV_TWI_ADDRESS, asserv_twi_buffer, length + 2) != 0) - return -1; + return 1; /* Update until the command is sent */ asserv_twi_update (); @@ -140,9 +140,9 @@ void asserv_move_linearly (int32_t distance) { /* Put distance as parameter */ - asserv_twi_buffer_param[0] = v32_to_v8 (distance, 3); - asserv_twi_buffer_param[1] = v32_to_v8 (distance, 2); - asserv_twi_buffer_param[2] = v32_to_v8 (distance, 1); + asserv_twi_buffer_param[0] = v32_to_v8 (distance, 2); + asserv_twi_buffer_param[1] = v32_to_v8 (distance, 1); + asserv_twi_buffer_param[2] = v32_to_v8 (distance, 0); /* Send the linear move command to the asserv board */ asserv_twi_send_command ('l', 3); } @@ -193,9 +193,9 @@ asserv_set_x_position (int32_t x) /* 'X' subcommand */ asserv_twi_buffer_param[0] = 'X'; /* Put x position as parameter */ - asserv_twi_buffer_param[1] = v32_to_v8 (x, 3); - asserv_twi_buffer_param[2] = v32_to_v8 (x, 2); - asserv_twi_buffer_param[3] = v32_to_v8 (x, 1); + asserv_twi_buffer_param[1] = v32_to_v8 (x, 2); + asserv_twi_buffer_param[2] = v32_to_v8 (x, 1); + asserv_twi_buffer_param[3] = v32_to_v8 (x, 0); /* Send the set X position command to the asserv board */ asserv_twi_send_command ('p', 4); } @@ -207,9 +207,9 @@ asserv_set_y_position (int32_t y) /* 'Y' subcommand */ asserv_twi_buffer_param[0] = 'Y'; /* Put y position as parameter */ - asserv_twi_buffer_param[1] = v32_to_v8 (y, 3); - asserv_twi_buffer_param[2] = v32_to_v8 (y, 2); - asserv_twi_buffer_param[3] = v32_to_v8 (y, 1); + asserv_twi_buffer_param[1] = v32_to_v8 (y, 2); + asserv_twi_buffer_param[2] = v32_to_v8 (y, 1); + asserv_twi_buffer_param[3] = v32_to_v8 (y, 0); /* Send the set Y position command to the asserv board */ asserv_twi_send_command ('p', 4); } -- cgit v1.2.3