mirror of https://github.com/rusefi/rusefi-1.git
CJ125 unit-tests coverage #617
This commit is contained in:
parent
e28f2b0e3b
commit
f3f9223048
|
@ -253,3 +253,18 @@ void startSimplePwmExt(PwmConfig *state, const char *msg, brain_pin_e brainPin,
|
||||||
startSimplePwm(state, msg, output, frequency, dutyCycle, stateChangeCallback);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,20 +17,6 @@
|
||||||
#include "pin_repository.h"
|
#include "pin_repository.h"
|
||||||
#include "datalogging.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) {
|
void initPwmGenerator(void) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -304,8 +304,13 @@ static void cjStart(void) {
|
||||||
cjIdentify();
|
cjIdentify();
|
||||||
|
|
||||||
// Load calibration values
|
// Load calibration values
|
||||||
|
#if EFI_PROD_CODE
|
||||||
uint32_t storedLambda = backupRamLoad(BACKUP_CJ125_CALIBRATION_LAMBDA);
|
uint32_t storedLambda = backupRamLoad(BACKUP_CJ125_CALIBRATION_LAMBDA);
|
||||||
uint32_t storedHeater = backupRamLoad(BACKUP_CJ125_CALIBRATION_HEATER);
|
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 no calibration, try to calibrate now and store new values
|
||||||
if (storedLambda == 0 || storedHeater == 0) {
|
if (storedLambda == 0 || storedHeater == 0) {
|
||||||
cjCalibrate();
|
cjCalibrate();
|
||||||
|
|
Loading…
Reference in New Issue