From 5d5ae7fbba19ac99eb4601aaa9f81488d8b25e1f Mon Sep 17 00:00:00 2001 From: Guillaume Chevillot Date: Mon, 10 Mar 2008 21:29:07 +0100 Subject: Correct a bug in 'r' and 'l' command that resulted of a inverted value of PWM for '1' direction --- analog/motor-power-avr/src/main.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/analog/motor-power-avr/src/main.c b/analog/motor-power-avr/src/main.c index cccdd6a5..c5ce6581 100644 --- a/analog/motor-power-avr/src/main.c +++ b/analog/motor-power-avr/src/main.c @@ -171,8 +171,9 @@ proto_callback (uint8_t cmd, uint8_t size, uint8_t *args) case c ('l', 1): /* Set pwm value for _L_ side. - * - 0x7F: -max on duty cycle (direction = 0) * - 0x00: 0% on duty cycle (brake state) + * - 0x7F: max on duty cycle (direction = 0) + * - 0x80: 0% on duty cycle (brake state) * - 0xFF: max on duty cylcle (direction = 1) */ cmd_L_ = (int8_t) args[0]; if (cmd_L_ >= 0) @@ -181,7 +182,7 @@ proto_callback (uint8_t cmd, uint8_t size, uint8_t *args) } else { - start_motor_L_ (((-cmd_L_) << 1), 1); + start_motor_L_ ((cmd_L_ << 1), 1); } break; @@ -192,8 +193,9 @@ proto_callback (uint8_t cmd, uint8_t size, uint8_t *args) case c ('r', 1): /* Set pwm value for _R_ side. - * - 0x7F: -max on duty cycle (direction = 0) * - 0x00: 0% on duty cycle (brake state) + * - 0x7F: max on duty cycle (direction = 0) + * - 0x80: 0% on duty cycle (brake state) * - 0xFF: max on duty cylcle (direction = 1) */ cmd_R_ = (int8_t) args[0]; if (cmd_R_ >= 0) @@ -202,7 +204,7 @@ proto_callback (uint8_t cmd, uint8_t size, uint8_t *args) } else { - start_motor_R_ (((-cmd_R_) << 1), 1); + start_motor_R_ ((cmd_R_ << 1), 1); } break; -- cgit v1.2.3