Honda K cam wheels #3405

This commit is contained in:
Andrey 2022-09-25 00:26:42 -04:00
parent 3156cf9bac
commit 612d52645a
4 changed files with 35 additions and 8 deletions

View File

@ -23,6 +23,8 @@ void setProteusHondaElement2003() {
// engineConfiguration->trigger.customTotalToothCount = 12;
// engineConfiguration->trigger.customSkippedToothCount = 0;
engineConfiguration->engineSyncCam = 1;
engineConfiguration->trigger.type = TT_HONDA_K_CRANK_12_1;
engineConfiguration->globalTriggerAngleOffset = 675;
@ -30,7 +32,7 @@ void setProteusHondaElement2003() {
// engineConfiguration->globalTriggerAngleOffset = 570;
engineConfiguration->vvtMode[0] = VVT_HONDA_K_INTAKE;
engineConfiguration->vvtMode[1] = VVT_FIRST_HALF;
engineConfiguration->vvtMode[1] = VVT_HONDA_K_EXHAUST;
engineConfiguration->vvtOffsets[0] = -41;
engineConfiguration->map.sensor.type = MT_DENSO183;

View File

@ -104,8 +104,15 @@ void CsvReader::processLine(EngineTestHelper *eth) {
efitick_t nowNt = getTimeNowNt();
TriggerValue event = newVvtState[vvtIndex] ^ engineConfiguration->invertCamVVTSignal ? TriggerValue::RISE : TriggerValue::FALL;
// todo: configurable selection of vvt mode - dual bank or dual cam single bank
int bankIndex = vvtIndex;
int camIndex = 0;
int bankIndex;
int camIndex;
if (twoBanksSingleCamMode) {
bankIndex = vvtIndex;
camIndex = 0;
} else {
bankIndex = vvtIndex / 2;
camIndex = vvtIndex % 2;
}
hwHandleVvtCamSignal(event, nowNt, bankIndex *2 + camIndex);
currentVvtState[vvtIndex] = newVvtState[vvtIndex];

View File

@ -9,6 +9,8 @@ const int NORMAL_ORDER[2] = {0, 1};
const int REVERSE_ORDER[2] = {1, 0};
class CsvReader {
public:
CsvReader(size_t triggerCount, size_t vvtCount) : CsvReader(triggerCount, vvtCount, 0.0) {}
@ -20,6 +22,8 @@ public:
}
~CsvReader();
bool twoBanksSingleCamMode = true;
void open(const char *fileName, const int* triggerColumnIndeces = NORMAL_ORDER, const int *vvtColumnIndeces = NORMAL_ORDER);
bool haveMore();
void processLine(EngineTestHelper *eth);

View File

@ -2,20 +2,34 @@
#include "logicdata_csv_reader.h"
static int getExhaustIndex() {
return getTriggerCentral()->vvtState[/*bankIndex*/0][/*camIndex*/1].currentCycle.current_index;
}
TEST(realk20, cranking) {
CsvReader reader(/* triggerCount */ 1, /* vvtCount */ 2);
reader.open("tests/trigger/resources/civic-K20-cranking.csv", NORMAL_ORDER, REVERSE_ORDER);
reader.twoBanksSingleCamMode = false;
EngineTestHelper eth (PROTEUS_HONDA_K);
while (reader.haveMore()) {
while (reader.haveMore() && reader.lineIndex() < 101) {
reader.processLine(&eth);
ASSERT_EQ(getExhaustIndex(), 0) << "Skipping until first exhaust event " << reader.lineIndex();
}
reader.haveMore();
reader.processLine(&eth);
ASSERT_EQ(getExhaustIndex(), 1) << "First exhaust event " << reader.lineIndex();
while (reader.haveMore()) {
reader.processLine(&eth);
ASSERT_TRUE(getExhaustIndex() != 0 ) << "At line " << reader.lineIndex();
}
ASSERT_EQ(173, getExhaustIndex()); // huh? not synching?
ASSERT_EQ(1182, round(Sensor::getOrZero(SensorType::Rpm)));
}