Skip to content

Commit

Permalink
Merge pull request #923 from frogonwheels/obd2ecu-positive-rpm
Browse files Browse the repository at this point in the history
OBD2ECU - Keep RPM positive
  • Loading branch information
dexterbg committed Aug 19, 2023
2 parents 6273de8 + 0f91376 commit 7a594f4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions vehicle/OVMS.V3/components/obd2ecu/src/obd2ecu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -583,9 +583,13 @@ void obd2ecu::IncomingFrame(CAN_frame_t* p_frame)

// Test if metric is from a script; if so, don't do the dongle workarounds (script will do this if needed)
if(m_pidmap[mapped_pid]->GetType() != obd2pid::Script)
{ metric = metric+jitter;
if(StandardMetrics.ms_v_pos_speed->AsFloat() < 1.0) metric = 500+jitter;
}
{
if(StandardMetrics.ms_v_pos_speed->AsFloat() < 1.0)
metric = 500;
else if (metric < 0)
metric = -metric;
metric += jitter;
}

FillFrame(&r_frame,reply,mapped_pid,metric,pid_format[mapped_pid]);
m_can->Write(&r_frame);
Expand Down

0 comments on commit 7a594f4

Please sign in to comment.