Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase max number of pwm outputs by 1, if a LED pin is defined #10127

Merged
merged 1 commit into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main/drivers/pwm_mapping.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ enum {
typedef struct {
int maxTimMotorCount;
int maxTimServoCount;
const timerHardware_t * timMotors[MAX_PWM_OUTPUT_PORTS];
const timerHardware_t * timServos[MAX_PWM_OUTPUT_PORTS];
const timerHardware_t * timMotors[MAX_PWM_OUTPUTS];
const timerHardware_t * timServos[MAX_PWM_OUTPUTS];
} timMotorServoHardware_t;

static pwmInitError_e pwmInitError = PWM_INIT_ERROR_NONE;
Expand Down
4 changes: 2 additions & 2 deletions src/main/drivers/pwm_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ typedef struct {
bool requestTelemetry;
} pwmOutputMotor_t;

static DMA_RAM pwmOutputPort_t pwmOutputPorts[MAX_PWM_OUTPUT_PORTS];
static DMA_RAM pwmOutputPort_t pwmOutputPorts[MAX_PWM_OUTPUTS];

static pwmOutputMotor_t motors[MAX_MOTORS];
static motorPwmProtocolTypes_e initMotorProtocol;
Expand Down Expand Up @@ -142,7 +142,7 @@ static void pwmOutConfigTimer(pwmOutputPort_t * p, TCH_t * tch, uint32_t hz, uin

static pwmOutputPort_t *pwmOutAllocatePort(void)
{
if (allocatedOutputPortCount >= MAX_PWM_OUTPUT_PORTS) {
if (allocatedOutputPortCount >= MAX_PWM_OUTPUTS) {
LOG_ERROR(PWM, "Attempt to allocate PWM output beyond MAX_PWM_OUTPUT_PORTS");
return NULL;
}
Expand Down
6 changes: 6 additions & 0 deletions src/main/drivers/pwm_output.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
#include "drivers/io_types.h"
#include "drivers/time.h"


#if defined(WS2811_PIN)
#define MAX_PWM_OUTPUTS (MAX_PWM_OUTPUT_PORTS + 1)
#else
#define MAX_PWM_OUTPUTS (MAX_PWM_OUTPUT_PORTS)
#endif
typedef enum {
DSHOT_CMD_SPIN_DIRECTION_NORMAL = 20,
DSHOT_CMD_SPIN_DIRECTION_REVERSED = 21,
Expand Down
Loading