Skip to content

Commit

Permalink
Update EGS51 CAN P2
Browse files Browse the repository at this point in the history
  • Loading branch information
rnd-ash committed Sep 12, 2024
1 parent e5e1327 commit c54c8f3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 25 deletions.
29 changes: 5 additions & 24 deletions src/canbus/can_egs51.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,19 +118,19 @@ int Egs51Can::get_static_engine_torque(const uint32_t expire_time_ms) {
MS_310_EGS51 ms310;
if (this->ms51.get_MS_310(GET_CLOCK_TIME(), expire_time_ms, &ms310)) {
int max = this->get_maximum_engine_torque(expire_time_ms);
int drag = ms310.DRG_TORQUE*3;
//int drag = ms310.DRG_TORQUE*3;
int ind = ms310.IND_TORQUE*3;
return MIN((ind - drag), max);
return ind;
} else {
return INT_MAX;
}
return INT_MAX;
}

int Egs51Can::get_driver_engine_torque(const uint32_t expire_time_ms) {
MS_310_EGS51 ms310;
if (this->ms51.get_MS_310(GET_CLOCK_TIME(), expire_time_ms, &ms310)) {
return ms310.IND_TORQUE*3;
MS_210_EGS51 ms210;
if (this->ms51.get_MS_210(GET_CLOCK_TIME(), expire_time_ms, &ms210)) {
return ms210.M_ESP*3;
} else {
return INT_MAX;
}
Expand Down Expand Up @@ -223,25 +223,6 @@ uint16_t Egs51Can::get_fuel_flow_rate(const uint32_t expire_time_ms) {
}
}

TccReqState Egs51Can::get_engine_tcc_override_request(const uint32_t expire_time_ms) {
MS_210_EGS51 ms210;
MS_308_EGS51 ms308;
TccReqState ret = TccReqState::None;
// Check for slip first
if (this->ms51.get_MS_210(GET_CLOCK_TIME(), expire_time_ms, &ms210)) {
if (ms210.KUEB_S_A) {
ret = TccReqState::Slipping;
}
}
// Then check if engine wants open
if (this->ms51.get_MS_308(GET_CLOCK_TIME(), expire_time_ms, &ms308)) {
if (ms308.KUEB_O_A) {
ret = TccReqState::Open;
}
}
return ret;
}

void Egs51Can::set_clutch_status(TccClutchStatus status) {
switch(status) {
case TccClutchStatus::Open:
Expand Down
1 change: 0 additions & 1 deletion src/canbus/can_egs51.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ class Egs51Can: public EgsBaseCan {
uint16_t get_fuel_flow_rate(const uint32_t expire_time_ms) override;
//
bool get_is_brake_pressed(const uint32_t expire_time_ms) override;
TccReqState get_engine_tcc_override_request(const uint32_t expire_time_ms) override;

/**
* Setters
Expand Down

0 comments on commit c54c8f3

Please sign in to comment.