Mitsubishi 4G93 Trigger issues #4918

adding more info on the trigger images
This commit is contained in:
Andrey 2023-01-03 15:44:13 -05:00
parent bfbcb5ffb4
commit 0337cb44ac
5 changed files with 4496 additions and 4391 deletions

View File

@ -584,6 +584,13 @@ expected<TriggerDecodeResult> TriggerDecoderBase::decodeTriggerEvent(
} }
toothed_previous_time = nowNt; toothed_previous_time = nowNt;
#if EFI_UNIT_TEST
if (wasSynchronized) {
int uiGapIndex = (currentCycle.current_index) % triggerShape.getLength();
gapRatio[uiGapIndex] = triggerSyncGapRatio;
}
#endif // EFI_UNIT_TEST
} }
if (getShaftSynchronized() && !isValidIndex(triggerShape)) { if (getShaftSynchronized() && !isValidIndex(triggerShape)) {

View File

@ -92,6 +92,13 @@ public:
*/ */
void incrementShaftSynchronizationCounter(); void incrementShaftSynchronizationCounter();
#if EFI_UNIT_TEST
/**
* used for trigger export only
*/
float gapRatio[PWM_PHASE_MAX_COUNT * 6];
#endif // EFI_UNIT_TEST
int64_t getTotalEventCounter() const; int64_t getTotalEventCounter() const;
expected<TriggerDecodeResult> decodeTriggerEvent( expected<TriggerDecodeResult> decodeTriggerEvent(

View File

@ -215,6 +215,7 @@ struct_no_prefix engine_configuration_s
#define TRIGGER_GAPS_COUNT "gapsCount" #define TRIGGER_GAPS_COUNT "gapsCount"
#define TRIGGER_GAP_FROM "gapFrom" #define TRIGGER_GAP_FROM "gapFrom"
#define TRIGGER_GAP_TO "gapTo" #define TRIGGER_GAP_TO "gapTo"
#define TRIGGER_WITH_SYNC "isSynchronizationNeeded"
! !
! all the xxx_PACKING_xxx constants are about persisting tables in compact for, for example packing RPM with 50 increment in a byte ! all the xxx_PACKING_xxx constants are about persisting tables in compact for, for example packing RPM with 50 increment in a byte

View File

@ -3,10 +3,16 @@
*/ */
#include "pch.h" #include "pch.h"
// uncomment to test starting from specific trigger
//#define TEST_FROM_TRIGGER_ID ((int)TT_MAZDA_MIATA_NA)
// uncomment to test only newest trigger // uncomment to test only newest trigger
//#define TEST_FROM_TRIGGER_ID ((int)TT_UNUSED - 1) //#define TEST_FROM_TRIGGER_ID ((int)TT_UNUSED - 1)
#define TEST_FROM_TRIGGER_ID 1 #define TEST_FROM_TRIGGER_ID 1
#define TEST_TO_TRIGGER_ID TT_UNUSED
// uncomment to test only one trigger
//#define TEST_TO_TRIGGER_ID (TEST_FROM_TRIGGER_ID + 1)
struct TriggerExportHelper struct TriggerExportHelper
{ {
FILE* fp; FILE* fp;
@ -35,7 +41,7 @@ INSTANTIATE_TEST_SUITE_P(
AllTriggersFixture, AllTriggersFixture,
// Test all triggers from the first valid trigger thru the last // Test all triggers from the first valid trigger thru the last
// (Skip index 0, that's custom toothed wheel which is covered by others) // (Skip index 0, that's custom toothed wheel which is covered by others)
::testing::Range((trigger_type_e)TEST_FROM_TRIGGER_ID, TT_UNUSED) ::testing::Range((trigger_type_e)TEST_FROM_TRIGGER_ID, (trigger_type_e)TEST_TO_TRIGGER_ID)
); );
extern bool printTriggerDebug; extern bool printTriggerDebug;
@ -57,6 +63,13 @@ TEST_P(AllTriggersFixture, TestTrigger) {
Engine* engine = &e; Engine* engine = &e;
EngineTestHelperBase base(engine, &pc.engineConfiguration, &pc); EngineTestHelperBase base(engine, &pc.engineConfiguration, &pc);
#if EFI_UNIT_TEST
extern TriggerDecoderBase initState;
for (size_t i = 0;i<efi::size(initState.gapRatio);i++) {
initState.gapRatio[i] = -1;
}
#endif // EFI_UNIT_TEST
engineConfiguration->trigger.type = tt; engineConfiguration->trigger.type = tt;
setCamOperationMode(); setCamOperationMode();
@ -75,6 +88,7 @@ TEST_P(AllTriggersFixture, TestTrigger) {
fprintf(fp, "%s=%s\n", TRIGGER_IS_SECOND_WHEEL_CAM, shape->isSecondWheelCam ? "true" : "false"); fprintf(fp, "%s=%s\n", TRIGGER_IS_SECOND_WHEEL_CAM, shape->isSecondWheelCam ? "true" : "false");
fprintf(fp, "%s=%d\n", TRIGGER_CYCLE_DURATION, (int)shape->getCycleDuration()); fprintf(fp, "%s=%d\n", TRIGGER_CYCLE_DURATION, (int)shape->getCycleDuration());
fprintf(fp, "%s=%d\n", TRIGGER_GAPS_COUNT, shape->gapTrackingLength); fprintf(fp, "%s=%d\n", TRIGGER_GAPS_COUNT, shape->gapTrackingLength);
fprintf(fp, "%s=%d\n", "isSynchronizationNeeded", shape->isSynchronizationNeeded);
for (int i = 0; i < shape->gapTrackingLength; i++) { for (int i = 0; i < shape->gapTrackingLength; i++) {
fprintf(fp, "%s.%d=%f\n", TRIGGER_GAP_FROM, i, shape->syncronizationRatioFrom[i]); fprintf(fp, "%s.%d=%f\n", TRIGGER_GAP_FROM, i, shape->syncronizationRatioFrom[i]);
fprintf(fp, "%s.%d=%f\n", TRIGGER_GAP_TO, i, shape->syncronizationRatioTo[i]); fprintf(fp, "%s.%d=%f\n", TRIGGER_GAP_TO, i, shape->syncronizationRatioTo[i]);
@ -84,10 +98,12 @@ TEST_P(AllTriggersFixture, TestTrigger) {
for (size_t i = 0; i < shape->getLength(); i++) { for (size_t i = 0; i < shape->getLength(); i++) {
int triggerDefinitionCoordinate = (shape->getTriggerWaveformSynchPointIndex() + i) % shape->getSize(); int triggerDefinitionCoordinate = (shape->getTriggerWaveformSynchPointIndex() + i) % shape->getSize();
fprintf(fp, "event %d %d %d %.2f\n", fprintf(fp, "event %d %d %d %.2f %f\n",
i, i,
shape->triggerSignalIndeces[triggerDefinitionCoordinate], shape->triggerSignalIndeces[triggerDefinitionCoordinate],
shape->triggerSignalStates[triggerDefinitionCoordinate], shape->triggerSignalStates[triggerDefinitionCoordinate],
triggerFormDetails->eventAngles[i]); triggerFormDetails->eventAngles[i],
initState.gapRatio[i]
);
} }
} }

File diff suppressed because it is too large Load Diff