From 9d6cec88897ad8b0fc0df9c36ea81e001a137ace Mon Sep 17 00:00:00 2001 From: EmanuelFeru Date: Tue, 17 Mar 2020 15:38:35 +0100 Subject: [PATCH] Hovercar minor update - put by default TORQUE mode. Hovercar works best in Torque mode - made the brake pedal more aggressive. Gives a better braking feel. --- Inc/config.h | 2 ++ Src/main.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Inc/config.h b/Inc/config.h index 12b402e..8687389 100644 --- a/Inc/config.h +++ b/Inc/config.h @@ -298,6 +298,8 @@ // ############################ VARIANT_HOVERCAR SETTINGS ############################ #ifdef VARIANT_HOVERCAR + #undef CTRL_MOD_REQ + #define CTRL_MOD_REQ 3 // HOVERCAR works best in TORQUE Mode #define CONTROL_ADC // use ADC as input. disable CONTROL_SERIAL_USART2, FEEDBACK_SERIAL_USART2, DEBUG_SERIAL_USART2! #define ADC_PROTECT_ENA // ADC Protection Enable flag. Use this flag to make sure the ADC is protected when GND or Vcc wire is disconnected #define ADC_PROTECT_TIMEOUT 30 // ADC Protection: number of wrong / missing input commands before safety state is taken diff --git a/Src/main.c b/Src/main.c index a20e421..e0b48f8 100644 --- a/Src/main.c +++ b/Src/main.c @@ -205,10 +205,10 @@ int main(void) { #ifdef VARIANT_HOVERCAR // Calculate speed Blend, a number between [0, 1] in fixdt(0,16,15) uint16_t speedBlend; - speedBlend = (uint16_t)(((CLAMP(speedAvgAbs,30,90) - 30) << 15) / 60); // speedBlend [0,1] is within [30 rpm, 90rpm] + speedBlend = (uint16_t)(((CLAMP(speedAvgAbs,10,60) - 10) << 15) / 50); // speedBlend [0,1] is within [10 rpm, 60rpm] // Check if Hovercar is physically close to standstill to enable Double tap detection on Brake pedal for Reverse functionality - if (speedAvgAbs < 20) { + if (speedAvgAbs < 60) { multipleTapDet(cmd1, HAL_GetTick(), &MultipleTapBreak); // Break pedal in this case is "cmd1" variable }