From 2e925de36f95f2b0a451709fa0b2134826530de5 Mon Sep 17 00:00:00 2001 From: Bas Delfos Date: Thu, 10 Nov 2016 23:54:23 +0100 Subject: [PATCH] Fix for AFROMINI failing build in Travis CI --- src/main/drivers/pwm_output.h | 4 +++- src/main/telemetry/esc_telemetry.c | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) 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