From 025b687673854f23e385cde4cf60cf10d9e0f6a6 Mon Sep 17 00:00:00 2001 From: rusefillc <48498823+rusefillc@users.noreply.github.com> Date: Mon, 29 May 2023 17:45:08 -0400 Subject: [PATCH] auxout: no need to invert PWM signal in software (#248) Co-authored-by: Andrey Gusakov --- firmware/auxout.cpp | 1 - firmware/boards/f1_dual/io/io_pins.h | 2 +- firmware/boards/f1_rev2/io/io_pins.h | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/firmware/auxout.cpp b/firmware/auxout.cpp index 2e23203..b6e29d8 100644 --- a/firmware/auxout.cpp +++ b/firmware/auxout.cpp @@ -82,7 +82,6 @@ void SetAuxDac(int channel, float voltage) { voltage = voltage / AUXOUT_GAIN; auto duty = voltage / VCC_VOLTS; - duty = 1.0 - duty; duty = clampF(0, duty, 1); auxDac.SetDuty(auxOutPwmCh[channel], duty); diff --git a/firmware/boards/f1_dual/io/io_pins.h b/firmware/boards/f1_dual/io/io_pins.h index 8b1183e..24f4a23 100644 --- a/firmware/boards/f1_dual/io/io_pins.h +++ b/firmware/boards/f1_dual/io/io_pins.h @@ -55,7 +55,7 @@ // PB15 - TIM1_CH3N #define AUXOUT_DAC_PWM_CHANNEL_1 2 // CH2N and CH3N are complementary outputs -#define AUXOUT_DAC_PWM_OUTPUT_MODE PWM_COMPLEMENTARY_OUTPUT_ACTIVE_HIGH +#define AUXOUT_DAC_PWM_OUTPUT_MODE PWM_COMPLEMENTARY_OUTPUT_ACTIVE_LOW #define ID_SEL1_PORT GPIOC #define ID_SEL1_PIN 13 diff --git a/firmware/boards/f1_rev2/io/io_pins.h b/firmware/boards/f1_rev2/io/io_pins.h index f3d2e85..aae02b0 100644 --- a/firmware/boards/f1_rev2/io/io_pins.h +++ b/firmware/boards/f1_rev2/io/io_pins.h @@ -47,7 +47,7 @@ // PB15 - TIM1_CH3N #define AUXOUT_DAC_PWM_CHANNEL_1 2 // CH2N and CH3N are complementary outputs -#define AUXOUT_DAC_PWM_OUTPUT_MODE PWM_COMPLEMENTARY_OUTPUT_ACTIVE_HIGH +#define AUXOUT_DAC_PWM_OUTPUT_MODE PWM_COMPLEMENTARY_OUTPUT_ACTIVE_LOW #define ID_SEL1_PORT GPIOC #define ID_SEL1_PIN 13