Skip to content

Commit

Permalink
EGS52: Simply torque req code
Browse files Browse the repository at this point in the history
  • Loading branch information
rnd-ash committed Feb 27, 2023
1 parent 6a6a9b3 commit d776d4f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/canbus/can_egs52.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit d776d4f

Please sign in to comment.