auto-sync
This commit is contained in:
parent
a81741dbbc
commit
5eaa81daf9
|
@ -239,7 +239,7 @@ void initInjectorCentral(Engine *engine) {
|
||||||
|
|
||||||
// todo: should we move this code closer to the injection logic?
|
// todo: should we move this code closer to the injection logic?
|
||||||
for (int i = 0; i < engineConfiguration->cylindersCount; i++) {
|
for (int i = 0; i < engineConfiguration->cylindersCount; i++) {
|
||||||
NamedOutputPin *output = &enginePins.coils[i];
|
NamedOutputPin *output = &enginePins.injectors[i];
|
||||||
|
|
||||||
outputPinRegisterExt2(output->name, output, boardConfiguration->injectionPins[i],
|
outputPinRegisterExt2(output->name, output, boardConfiguration->injectionPins[i],
|
||||||
&boardConfiguration->injectionPinMode);
|
&boardConfiguration->injectionPinMode);
|
||||||
|
|
|
@ -43,7 +43,7 @@ void SimplePwm::setSimplePwmDutyCycle(float dutyCycle) {
|
||||||
multiWave.setSwitchTime(0, dutyCycle);
|
multiWave.setSwitchTime(0, dutyCycle);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint64_t getNextSwitchTimeUs(PwmConfig *state) {
|
static efitimeus_t getNextSwitchTimeUs(PwmConfig *state) {
|
||||||
efiAssert(state->safe.phaseIndex < PWM_PHASE_MAX_COUNT, "phaseIndex range", 0);
|
efiAssert(state->safe.phaseIndex < PWM_PHASE_MAX_COUNT, "phaseIndex range", 0);
|
||||||
int iteration = state->safe.iteration;
|
int iteration = state->safe.iteration;
|
||||||
float switchTime = state->multiWave.getSwitchTime(state->safe.phaseIndex);
|
float switchTime = state->multiWave.getSwitchTime(state->safe.phaseIndex);
|
||||||
|
@ -87,7 +87,7 @@ void PwmConfig::handleCycleStart() {
|
||||||
/**
|
/**
|
||||||
* @return Next time for signal toggle
|
* @return Next time for signal toggle
|
||||||
*/
|
*/
|
||||||
static uint64_t togglePwmState(PwmConfig *state) {
|
static efitimeus_t togglePwmState(PwmConfig *state) {
|
||||||
#if DEBUG_PWM
|
#if DEBUG_PWM
|
||||||
scheduleMsg(&logger, "togglePwmState phaseIndex=%d iteration=%d", state->safe.phaseIndex, state->safe.iteration);
|
scheduleMsg(&logger, "togglePwmState phaseIndex=%d iteration=%d", state->safe.phaseIndex, state->safe.iteration);
|
||||||
scheduleMsg(&logger, "state->period=%f state->safe.period=%f", state->period, state->safe.period);
|
scheduleMsg(&logger, "state->period=%f state->safe.period=%f", state->period, state->safe.period);
|
||||||
|
@ -109,7 +109,7 @@ static uint64_t togglePwmState(PwmConfig *state) {
|
||||||
int cbStateIndex = state->safe.phaseIndex == 0 ? state->phaseCount - 1 : state->safe.phaseIndex - 1;
|
int cbStateIndex = state->safe.phaseIndex == 0 ? state->phaseCount - 1 : state->safe.phaseIndex - 1;
|
||||||
state->stateChangeCallback(state, cbStateIndex);
|
state->stateChangeCallback(state, cbStateIndex);
|
||||||
|
|
||||||
uint64_t nextSwitchTimeUs = getNextSwitchTimeUs(state);
|
efitimeus_t nextSwitchTimeUs = getNextSwitchTimeUs(state);
|
||||||
#if DEBUG_PWM
|
#if DEBUG_PWM
|
||||||
scheduleMsg(&logger, "%s: nextSwitchTime %d", state->name, nextSwitchTime);
|
scheduleMsg(&logger, "%s: nextSwitchTime %d", state->name, nextSwitchTime);
|
||||||
#endif
|
#endif
|
||||||
|
@ -140,7 +140,7 @@ static uint64_t togglePwmState(PwmConfig *state) {
|
||||||
* Main PWM loop: toggle pin & schedule next invocation
|
* Main PWM loop: toggle pin & schedule next invocation
|
||||||
*/
|
*/
|
||||||
static void timerCallback(PwmConfig *state) {
|
static void timerCallback(PwmConfig *state) {
|
||||||
uint64_t switchTimeUs = togglePwmState(state);
|
efitimeus_t switchTimeUs = togglePwmState(state);
|
||||||
scheduleTask2("pwm", &state->scheduling, switchTimeUs, (schfunc_t) timerCallback, state);
|
scheduleTask2("pwm", &state->scheduling, switchTimeUs, (schfunc_t) timerCallback, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,8 +53,10 @@ AdcConfiguration::AdcConfiguration(ADCConversionGroup* hwConfig) {
|
||||||
#define PWM_FREQ_FAST 100000 /* PWM clock frequency. I wonder what does this setting mean? */
|
#define PWM_FREQ_FAST 100000 /* PWM clock frequency. I wonder what does this setting mean? */
|
||||||
#define PWM_PERIOD_FAST 10 /* PWM period (in PWM ticks). */
|
#define PWM_PERIOD_FAST 10 /* PWM period (in PWM ticks). */
|
||||||
|
|
||||||
|
// is there a reason to have this configurable?
|
||||||
#define ADC_SLOW_DEVICE ADCD1
|
#define ADC_SLOW_DEVICE ADCD1
|
||||||
|
|
||||||
|
// is there a reason to have this configurable?
|
||||||
#define ADC_FAST_DEVICE ADCD2
|
#define ADC_FAST_DEVICE ADCD2
|
||||||
|
|
||||||
static char LOGGING_BUFFER[500];
|
static char LOGGING_BUFFER[500];
|
||||||
|
|
|
@ -36,7 +36,7 @@ void initOutputPinExt(const char *msg, OutputPin *outputPin, GPIO_TypeDef *port,
|
||||||
* here we check if another physical pin is already assigned to this logical output
|
* here we check if another physical pin is already assigned to this logical output
|
||||||
*/
|
*/
|
||||||
// todo: need to clear '&outputs' in io_pins.c
|
// todo: need to clear '&outputs' in io_pins.c
|
||||||
firmwareError("outputPin already assigned to %x%d", outputPin->port, outputPin->pin);
|
firmwareError("outputPin [%s] already assigned to %x%d", msg, outputPin->port, outputPin->pin);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
outputPin->currentLogicValue = INITIAL_PIN_STATE;
|
outputPin->currentLogicValue = INITIAL_PIN_STATE;
|
||||||
|
|
Loading…
Reference in New Issue