summaryrefslogtreecommitdiff
path: root/analog
diff options
context:
space:
mode:
authorGuillaume Chevillot2008-03-10 21:29:07 +0100
committerGuillaume Chevillot2008-03-10 21:29:07 +0100
commit5d5ae7fbba19ac99eb4601aaa9f81488d8b25e1f (patch)
treeb3891f183ea82cecb8c1e7426aa6bc932fea9983 /analog
parent85c7e5bfab12e1c5a5e9cc2b5a2cac1f3acf0814 (diff)
Correct a bug in 'r' and 'l' command that resulted of a inverted value of PWM for '1' direction
Diffstat (limited to 'analog')
-rw-r--r--analog/motor-power-avr/src/main.c10
1 files 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;