diff --git a/src/main/drivers/pwm_output.h b/src/main/drivers/pwm_output.h index 8b912853c..1afbce395 100644 --- a/src/main/drivers/pwm_output.h +++ b/src/main/drivers/pwm_output.h @@ -52,8 +52,10 @@ typedef enum { #define PWM_BRUSHED_TIMER_MHZ 24 #endif -#ifdef USE_DSHOT +#if defined(USE_DSHOT) #define MAX_DSHOT_MOTORS 4 +#else +#define MAX_DSHOT_MOTORS 0 #endif #define MOTOR_DMA_BUFFER_SIZE 18 /* resolution + frame reset (2us) */ diff --git a/src/main/telemetry/esc_telemetry.c b/src/main/telemetry/esc_telemetry.c index c6c954303..6b57d07b8 100644 --- a/src/main/telemetry/esc_telemetry.c +++ b/src/main/telemetry/esc_telemetry.c @@ -56,6 +56,8 @@ set debug_mode = DEBUG_ESC_TELEMETRY in cli 3: current */ +#ifdef USE_DSHOT + typedef struct { bool skipped; int16_t temperature; @@ -269,7 +271,7 @@ void escTelemetryProcess(uint32_t currentTime) static void selectNextMotor(void) { escTelemetryMotor++; - if (escTelemetryMotor >= MAX_DSHOT_MOTORS) { // Motor count for Dshot limited to 4 + if (escTelemetryMotor > MAX_DSHOT_MOTORS-1) { // Motor count for Dshot limited to 4 escTelemetryMotor = 0; firstCycleComplete = true; } @@ -294,3 +296,5 @@ static uint8_t get_crc8(uint8_t *Buf, uint8_t BufLen) for(int i=0; i