From d776d4f5e70a2ace519ab605eeb2656ddbc91cf5 Mon Sep 17 00:00:00 2001 From: Ashcon Mohseninia Date: Mon, 27 Feb 2023 07:40:31 +0000 Subject: [PATCH] EGS52: Simply torque req code --- src/canbus/can_egs52.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/canbus/can_egs52.cpp b/src/canbus/can_egs52.cpp index b4fa5e71..2e1ea3bc 100644 --- a/src/canbus/can_egs52.cpp +++ b/src/canbus/can_egs52.cpp @@ -534,13 +534,15 @@ void Egs52Can::set_gearbox_ok(bool is_ok) { } void Egs52Can::set_torque_request(TorqueRequest request, float amount_nm) { - bool dyn0 = false; + bool dyn0 = request != TorqueRequest::None; // Markes torque request active bool dyn1 = false; bool min = false; bool max = false; uint16_t trq = 0; if (request != TorqueRequest::None) { trq = (amount_nm + 500) * 4; + } else { + trq = 0; } // Type of request bit switch(request) { @@ -570,18 +572,15 @@ void Egs52Can::set_torque_request(TorqueRequest request, float amount_nm) { case TorqueRequest::Exact: case TorqueRequest::LessThan: case TorqueRequest::MoreThan: - dyn0 = true; dyn1 = false; break; case TorqueRequest::ExactFast: case TorqueRequest::LessThanFast: case TorqueRequest::MoreThanFast: - dyn0 = true; dyn1 = true; break; case TorqueRequest::None: default: - dyn0 = false; dyn1 = false; break; }