diff --git a/306-controller_interface.X/app/kartculator.c b/306-controller_interface.X/app/kartculator.c index 3b271b5..88a490b 100644 --- a/306-controller_interface.X/app/kartculator.c +++ b/306-controller_interface.X/app/kartculator.c @@ -21,7 +21,15 @@ void calcPosition(uint8_t joy_pos){ } void calcSpeed(int32_t rpm) { - + int32_t calcSpeed; + if(rpm>=0){ + calcSpeed = rpm; + } else { + calcSpeed = -rpm; + } + calcSpeed *= 1000; + calcSpeed /= KART_CST.CONTROL_SPEED_FACTOR; + eKart.speed = (uint8_t) calcSpeed; } int16_t getTorque() {