mirror of https://github.com/rusefi/wideband.git
f1_dual: fix aux pwm outputs (#119)
Co-authored-by: Andrey Gusakov <dron0gus@gmail.com>
This commit is contained in:
parent
55f65ad02d
commit
700d763c29
|
@ -28,6 +28,13 @@ PWMConfig auxPwmConfig = {
|
||||||
|
|
||||||
static Pwm auxDac(AUXOUT_DAC_PWM_DEVICE);
|
static Pwm auxDac(AUXOUT_DAC_PWM_DEVICE);
|
||||||
|
|
||||||
|
static const uint8_t auxOutPwmCh[] = {
|
||||||
|
AUXOUT_DAC_PWM_CHANNEL_0,
|
||||||
|
#if (AFR_CHANNELS > 1)
|
||||||
|
AUXOUT_DAC_PWM_CHANNEL_1,
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
extern float clampF(float min, float clamp, float max);
|
extern float clampF(float min, float clamp, float max);
|
||||||
|
|
||||||
void SetAuxDac(int channel, float voltage)
|
void SetAuxDac(int channel, float voltage)
|
||||||
|
@ -37,7 +44,7 @@ void SetAuxDac(int channel, float voltage)
|
||||||
duty = 1.0 - duty;
|
duty = 1.0 - duty;
|
||||||
duty = clampF(0, duty, 1);
|
duty = clampF(0, duty, 1);
|
||||||
|
|
||||||
auxDac.SetDuty(channel ? AUXOUT_DAC_PWM_CHANNEL_1 : AUXOUT_DAC_PWM_CHANNEL_0, duty);
|
auxDac.SetDuty(auxOutPwmCh[channel], duty);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: merge with some other communication thread? */
|
/* TODO: merge with some other communication thread? */
|
||||||
|
|
Loading…
Reference in New Issue