From bb6a24659b2bc0027e3c84bdd2f3598fc118a34c Mon Sep 17 00:00:00 2001 From: Alexander Bobkov Date: Sun, 29 Dec 2024 02:22:41 -0500 Subject: [PATCH] ESP-IDF Robot Controls --- ESP-IDF_Robot/main/rc.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ESP-IDF_Robot/main/rc.h b/ESP-IDF_Robot/main/rc.h index 57ce865dd..c4e1481dc 100644 --- a/ESP-IDF_Robot/main/rc.h +++ b/ESP-IDF_Robot/main/rc.h @@ -74,8 +74,12 @@ static void rc_get_raw_data() { m.motor1_rpm_pcm = 0; m.motor2_rpm_pcm = 0; } - if (rescale_raw_val(adc_raw[0][0]) >= 4000) + if (rescale_raw_val(adc_raw[0][0]) >= 4000) { m.motor1_rpm_pcm = rescale_raw_val(adc_raw[0][0]); + } + else if (rescale_raw_val(adc_raw[0][0]) < 4000) { + m.motor1_rpm_pcm = -rescale_raw_val(adc_raw[0][0]); + } // Cut-off power if joystick is nearly center /*if (rescale_raw_val(adc_raw[0][0]) < 4000)