CJ125 unit-tests coverage #617

This commit is contained in:
rusefi 2018-11-03 13:45:36 -04:00
parent e28f2b0e3b
commit f3f9223048
3 changed files with 20 additions and 14 deletions

View File

@ -253,3 +253,18 @@ void startSimplePwmExt(PwmConfig *state, const char *msg, brain_pin_e brainPin,
startSimplePwm(state, msg, output, frequency, dutyCycle, stateChangeCallback);
}
/**
* This method controls the actual hardware pins
*
* This method takes ~350 ticks.
*/
void applyPinState(PwmConfig *state, int stateIndex) {
efiAssertVoid(CUSTOM_ERR_6663, stateIndex < PWM_PHASE_MAX_COUNT, "invalid stateIndex");
efiAssertVoid(CUSTOM_ERR_6664, state->multiWave.waveCount <= PWM_PHASE_MAX_WAVE_PER_PWM, "invalid waveCount");
for (int waveIndex = 0; waveIndex < state->multiWave.waveCount; waveIndex++) {
OutputPin *output = state->outputPins[waveIndex];
int value = state->multiWave.waves[waveIndex].pinStates[stateIndex];
output->setValue(value);
}
}

View File

@ -17,20 +17,6 @@
#include "pin_repository.h"
#include "datalogging.h"
/**
* This method controls the actual hardware pins
*
* This method takes ~350 ticks.
*/
void applyPinState(PwmConfig *state, int stateIndex) {
efiAssertVoid(CUSTOM_ERR_6663, stateIndex < PWM_PHASE_MAX_COUNT, "invalid stateIndex");
efiAssertVoid(CUSTOM_ERR_6664, state->multiWave.waveCount <= PWM_PHASE_MAX_WAVE_PER_PWM, "invalid waveCount");
for (int waveIndex = 0; waveIndex < state->multiWave.waveCount; waveIndex++) {
OutputPin *output = state->outputPins[waveIndex];
int value = state->multiWave.waves[waveIndex].pinStates[stateIndex];
output->setValue(value);
}
}
void initPwmGenerator(void) {
}

View File

@ -304,8 +304,13 @@ static void cjStart(void) {
cjIdentify();
// Load calibration values
#if EFI_PROD_CODE
uint32_t storedLambda = backupRamLoad(BACKUP_CJ125_CALIBRATION_LAMBDA);
uint32_t storedHeater = backupRamLoad(BACKUP_CJ125_CALIBRATION_HEATER);
#else
uint32_t storedLambda = 0;
uint32_t storedHeater = 0;
#endif
// if no calibration, try to calibrate now and store new values
if (storedLambda == 0 || storedHeater == 0) {
cjCalibrate();