Skip to content

Commit

Permalink
Ford SENT ETB bench test in NJ #4745
Browse files Browse the repository at this point in the history
  • Loading branch information
rusefillc committed Nov 13, 2022
1 parent 58e08b5 commit 37194df
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions firmware/controllers/algo/defaults/default_base_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ void setDefaultBaseEngine() {

engineConfiguration->compressionRatio = 9;

engineConfiguration->sentErrorRate = 0.03; // 3% error rate

engineConfiguration->turbochargerFilter = 0.01f;

engineConfiguration->fuelAlgorithm = LM_SPEED_DENSITY;
Expand Down
7 changes: 5 additions & 2 deletions firmware/hw_layer/drivers/sent/sent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,8 @@ uint8_t sent_channel::crc6(uint32_t data)

static sent_channel channels[SENT_CHANNELS_NUM];

static float valueErrorRate = -1;

void sent_channel::Info(void)
{
int i;
Expand All @@ -520,6 +522,7 @@ void sent_channel::Info(void)
if (GetSignals(&stat, &sig0, &sig1) == 0) {
efiPrintf("Last valid fast msg Status 0x%01x Sig0 0x%03x Sig1 0x%03x", stat, sig0, sig1);
}
efiPrintf("valueErrorRate %f", valueErrorRate);

if (scMsgFlags) {
efiPrintf("Slow channels:");
Expand Down Expand Up @@ -608,9 +611,9 @@ float getSentValue(size_t index) {
if (ch.GetSignals(NULL, &sig0, &sig1) == 0) {
float maxValue = 0xfff;

float errorRate = 1.0 - (sig0 + sig1) / maxValue;
valueErrorRate = 1.0 - (sig0 + sig1) / maxValue;

if (absF(errorRate) < engineConfiguration->sentErrorRate) {
if (absF(valueErrorRate) <= engineConfiguration->sentErrorRate) {
/* scale to 0.0 .. 1.0 */
return sig1 / maxValue;
}
Expand Down

0 comments on commit 37194df

Please sign in to comment.