From 7435bdc10ad7480cd938940495bf9d5a60d50a63 Mon Sep 17 00:00:00 2001 From: Zain Date: Thu, 1 Feb 2024 14:36:13 +0530 Subject: [PATCH] added description for mapping. --- src/motor_driver.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/motor_driver.c b/src/motor_driver.c index f315345..8907224 100644 --- a/src/motor_driver.c +++ b/src/motor_driver.c @@ -54,6 +54,7 @@ esp_err_t enable_motor_driver(motor_handle_t *motor, int motor_id) { } esp_err_t set_motor_speed(motor_handle_t motor, int direction, float speed) { + // map is used to map the speed from 0-100 to 0-MCPWM_TICKS. MCPWM_TICKS is the resolution of the pwm signal. It is calculated as MCPWM_TICKS = MCPWM_RESOLUTION / MCPWM_FREQ speed = (uint32_t)map(speed, 0, 100, 0, MCPWM_RESOLUTION / MCPWM_FREQ); if(direction == MOTOR_FORWARD){ motor->forward(motor);