* fix unit-tests

* add cam/vvt support to trigger_emulator

---------

Co-authored-by: andreika-git <andrei.home@gmail.com>
Co-authored-by: rusefillc <sdfsdfqsf2334234234>
This commit is contained in:
rusefillc 2023-10-26 14:10:51 -04:00 committed by GitHub
parent 2507d4e467
commit 9c54180bf6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 4 deletions

View File

@ -43,7 +43,7 @@ TriggerEmulatorHelper::TriggerEmulatorHelper() {
static OutputPin emulatorOutputs[PWM_PHASE_MAX_WAVE_PER_PWM];
void TriggerEmulatorHelper::handleEmulatorCallback(const MultiChannelStateSequence& multiChannelStateSequence, int stateIndex) {
void TriggerEmulatorHelper::handleEmulatorCallback(int ch, const MultiChannelStateSequence& multiChannelStateSequence, int stateIndex) {
efitick_t stamp = getTimeNowNt();
// todo: code duplication with TriggerStimulatorHelper::feedSimulatedEvent?
@ -131,7 +131,7 @@ static void emulatorApplyPinState(int stateIndex, PwmConfig *state) /* pwm_gen_c
/**
* this callback would invoke the input signal handlers directly
*/
helper.handleEmulatorCallback(
helper.handleEmulatorCallback(0,
*state->multiChannelStateSequence,
stateIndex);
}

View File

@ -7,6 +7,9 @@
#pragma once
// 1 crank and CAMS_PER_BANK cam channels
#define NUM_EMULATOR_CHANNELS (1 + CAMS_PER_BANK)
class PwmConfig;
class MultiChannelStateSequence;
@ -24,7 +27,7 @@ void disableTriggerStimulator();
class TriggerEmulatorHelper {
public:
TriggerEmulatorHelper();
void handleEmulatorCallback(const MultiChannelStateSequence& mcss, int stateIndex);
void handleEmulatorCallback(int ch, const MultiChannelStateSequence& mcss, int stateIndex);
};
int getPreviousIndex(const int currentIndex, const int size);

View File

@ -21,7 +21,7 @@ TEST(miata, miata_na_tdc) {
int time = getSimulatedEventTime(shape, i);
eth.setTimeAndInvokeEventsUs(time);
emulatorHelper.handleEmulatorCallback(
emulatorHelper.handleEmulatorCallback(0,
shape.wave,
i % shape.getSize());
}