Skip to content

Commit

Permalink
Change selected F411 targets to use timer dshot instead of bitb… (#8978)
Browse files Browse the repository at this point in the history
Change selected F411 targets to use timer dshot instead of bitbang dshot
  • Loading branch information
mikeller committed Oct 16, 2019
2 parents 4612242 + d907d5f commit c37a7c9
Show file tree
Hide file tree
Showing 57 changed files with 78 additions and 58 deletions.
2 changes: 1 addition & 1 deletion src/main/cli/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ const clivalue_t valueTable[] = {
#ifdef USE_DSHOT
{ "dshot_idle_value", VAR_UINT16 | MASTER_VALUE, .config.minmaxUnsigned = { 0, 2000 }, PG_MOTOR_CONFIG, offsetof(motorConfig_t, digitalIdleOffsetValue) },
#ifdef USE_DSHOT_DMAR
{ "dshot_burst", VAR_UINT8 | HARDWARE_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_MOTOR_CONFIG, offsetof(motorConfig_t, dev.useBurstDshot) },
{ "dshot_burst", VAR_UINT8 | HARDWARE_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON_AUTO }, PG_MOTOR_CONFIG, offsetof(motorConfig_t, dev.useBurstDshot) },
#endif
#ifdef USE_DSHOT_TELEMETRY
{ "dshot_bidir", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_MOTOR_CONFIG, offsetof(motorConfig_t, dev.useDshotTelemetry) },
Expand Down
5 changes: 2 additions & 3 deletions src/main/drivers/dshot_dpwm.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,8 @@ motorDevice_t *dshotPwmDevInit(const motorDevConfig_t *motorConfig, uint16_t idl
case PWM_TYPE_DSHOT150:
loadDmaBuffer = loadDmaBufferDshot;
#ifdef USE_DSHOT_DMAR
if (motorConfig->useBurstDshot) {
useBurstDshot = true;
}
useBurstDshot = motorConfig->useBurstDshot == DSHOT_DMAR_ON ||
(motorConfig->useBurstDshot == DSHOT_DMAR_AUTO && !motorConfig->useDshotTelemetry);
#endif
break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/fc/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ static void validateAndFixConfig(void)
}

#if defined(USE_DSHOT_TELEMETRY)
if ((!usingDshotProtocol || (motorConfig()->dev.useDshotBitbang == DSHOT_BITBANG_OFF && motorConfig()->dev.useBurstDshot) || systemConfig()->schedulerOptimizeRate == SCHEDULER_OPTIMIZE_RATE_OFF)
if ((!usingDshotProtocol || (motorConfig()->dev.useDshotBitbang == DSHOT_BITBANG_OFF && motorConfig()->dev.useBurstDshot == DSHOT_DMAR_ON) || systemConfig()->schedulerOptimizeRate == SCHEDULER_OPTIMIZE_RATE_OFF)
&& motorConfig()->dev.useDshotTelemetry) {
motorConfigMutable()->dev.useDshotTelemetry = false;
}
Expand Down
6 changes: 6 additions & 0 deletions src/main/pg/motor.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ typedef enum {
DSHOT_BITBANGED_TIMER_TIM8,
} dshotBitbangedTimer_e;

typedef enum {
DSHOT_DMAR_OFF,
DSHOT_DMAR_ON,
DSHOT_DMAR_AUTO
} dshotDmar_e;

typedef struct motorDevConfig_s {
uint16_t motorPwmRate; // The update rate of motor outputs (50-498Hz)
uint8_t motorPwmProtocol; // Pwm Protocol
Expand Down
2 changes: 1 addition & 1 deletion src/main/target/AG3X/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#define USBD_PRODUCT_STRING "Asgard32 F7"
#endif

#define ENABLE_DSHOT_DMAR true
#define ENABLE_DSHOT_DMAR DSHOT_DMAR_ON

// Note, beeper is on the LED pin
#define LED0_PIN PC13
Expand Down
2 changes: 1 addition & 1 deletion src/main/target/AIKONF4/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#define BEEPER_PIN PB5
#define BEEPER_INVERTED

#define ENABLE_DSHOT_DMAR true
#define ENABLE_DSHOT_DMAR DSHOT_DMAR_ON

#define INVERTER_PIN_UART1 PC0

Expand Down
2 changes: 1 addition & 1 deletion src/main/target/AIRBOTF7/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#define BEEPER_PIN PB0
#define BEEPER_INVERTED

#define ENABLE_DSHOT_DMAR true
#define ENABLE_DSHOT_DMAR DSHOT_DMAR_ON

// *************** Gyro & ACC **********************
#define USE_SPI
Expand Down
2 changes: 1 addition & 1 deletion src/main/target/AIRF7/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#define BEEPER_PIN PB2
#define BEEPER_INVERTED

#define ENABLE_DSHOT_DMAR true
#define ENABLE_DSHOT_DMAR DSHOT_DMAR_ON

#define USE_TARGET_CONFIG

Expand Down
2 changes: 1 addition & 1 deletion src/main/target/BEEROTORF4/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#define BEEPER_INVERTED

// Tim_UP 1 (motors 1 & 2) conflicts with Tim 4 Ch 3 (LED_STRIP)
#define ENABLE_DSHOT_DMAR false
#define ENABLE_DSHOT_DMAR DSHOT_DMAR_OFF

// ICM20689 interrupt
#define USE_EXTI
Expand Down
2 changes: 1 addition & 1 deletion src/main/target/BETAFLIGHTF3/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#define BEEPER_PIN PC15
#define BEEPER_INVERTED

#define ENABLE_DSHOT_DMAR true
#define ENABLE_DSHOT_DMAR DSHOT_DMAR_ON

#define USABLE_TIMER_CHANNEL_COUNT 10

Expand Down
2 changes: 1 addition & 1 deletion src/main/target/CLRACINGF4/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#define BEEPER_INVERTED
#define BEEPER_PWM_HZ 3800 // Beeper PWM frequency in Hz

#define ENABLE_DSHOT_DMAR false // Motors 3 / 4 conflict with LED_STRIP if enabled
#define ENABLE_DSHOT_DMAR DSHOT_DMAR_OFF // Motors 3 / 4 conflict with LED_STRIP if enabled

#define INVERTER_PIN_UART1 PC0 // PC0 used as inverter select GPIO

Expand Down
2 changes: 1 addition & 1 deletion src/main/target/CLRACINGF7/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#define USBD_PRODUCT_STRING "CLRACINGF7"
#define USE_TARGET_CONFIG

#define ENABLE_DSHOT_DMAR true
#define ENABLE_DSHOT_DMAR DSHOT_DMAR_ON

#define LED0_PIN PB0
#define USE_BEEPER
Expand Down
2 changes: 1 addition & 1 deletion src/main/target/CRAZYBEEF3FR/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
#undef USE_TELEMETRY_SRXL
#endif

#define ENABLE_DSHOT_DMAR true
#define ENABLE_DSHOT_DMAR DSHOT_DMAR_ON

#define LED0_PIN PB3
#define USE_BEEPER
Expand Down
2 changes: 1 addition & 1 deletion src/main/target/DALRCF405/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
#define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC
#define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC

#define ENABLE_DSHOT_DMAR true
#define ENABLE_DSHOT_DMAR DSHOT_DMAR_ON

#define USE_ESCSERIAL
#define ESCSERIAL_TIMER_TX_PIN PA3
Expand Down
2 changes: 1 addition & 1 deletion src/main/target/DALRCF722DUAL/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#define TARGET_BOARD_IDENTIFIER "DLF7"
#define USBD_PRODUCT_STRING "DALRCF722DUAL"

#define ENABLE_DSHOT_DMAR true
#define ENABLE_DSHOT_DMAR DSHOT_DMAR_ON
#define LED0_PIN PC14

#define USE_BEEPER
Expand Down
2 changes: 1 addition & 1 deletion src/main/target/ELINF722/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
#define SERIALRX_UART SERIAL_PORT_USART1

#define DEFAULT_MIXER MIXER_QUADX
#define ENABLE_DSHOT_DMAR true
#define ENABLE_DSHOT_DMAR DSHOT_DMAR_ON
#define USE_ESCSERIAL
#define ESCSERIAL_TIMER_TX_PIN PB6

Expand Down
2 changes: 1 addition & 1 deletion src/main/target/EXF722DUAL/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

#define USBD_PRODUCT_STRING "EXF722DUAL"

#define ENABLE_DSHOT_DMAR true
#define ENABLE_DSHOT_DMAR DSHOT_DMAR_ON

#define LED0_PIN PC4

Expand Down
2 changes: 1 addition & 1 deletion src/main/target/FF_PIKOBLX/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#define TARGET_BOARD_IDENTIFIER "PIKO" // Furious FPV PIKOBLX
#endif

#define ENABLE_DSHOT_DMAR true
#define ENABLE_DSHOT_DMAR DSHOT_DMAR_ON
#define REMAP_TIM16_DMA


Expand Down
2 changes: 1 addition & 1 deletion src/main/target/FLYWOOF7DUAL/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#define TARGET_BOARD_IDENTIFIER "FWF7"
#define USBD_PRODUCT_STRING "FLYWOOF7DUAL"

#define ENABLE_DSHOT_DMAR true
#define ENABLE_DSHOT_DMAR DSHOT_DMAR_ON

#define LED0_PIN PC15

Expand Down
2 changes: 1 addition & 1 deletion src/main/target/FOXEERF405/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@

#define CURRENT_METER_SCALE_DEFAULT 166

#define ENABLE_DSHOT_DMAR true
#define ENABLE_DSHOT_DMAR DSHOT_DMAR_ON

#define USE_ESCSERIAL
#define ESCSERIAL_TIMER_TX_PIN PA3
Expand Down
2 changes: 1 addition & 1 deletion src/main/target/FOXEERF722DUAL/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#define TARGET_BOARD_IDENTIFIER "FXF7"
#define USBD_PRODUCT_STRING "FOXEER722DUAL"

#define ENABLE_DSHOT_DMAR true
#define ENABLE_DSHOT_DMAR DSHOT_DMAR_ON
#define LED0_PIN PC15

#define USE_BEEPER
Expand Down
2 changes: 1 addition & 1 deletion src/main/target/HAKRCF405/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
#define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC
#define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC

#define ENABLE_DSHOT_DMAR true
#define ENABLE_DSHOT_DMAR DSHOT_DMAR_ON

#define USE_ESCSERIAL
#define ESCSERIAL_TIMER_TX_PIN PA3
Expand Down
2 changes: 1 addition & 1 deletion src/main/target/HAKRCF411/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
#define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC
#define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC

#define ENABLE_DSHOT_DMAR true
#define ENABLE_DSHOT_DMAR DSHOT_DMAR_ON

#define USE_BEEPER
#define BEEPER_PIN PC14
Expand Down
2 changes: 1 addition & 1 deletion src/main/target/HAKRCF722/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
#define FLASH_CS_PIN PB12
#define FLASH_SPI_INSTANCE SPI2

#define ENABLE_DSHOT_DMAR true
#define ENABLE_DSHOT_DMAR DSHOT_DMAR_ON

#define USE_VCP

Expand Down
2 changes: 1 addition & 1 deletion src/main/target/IMPULSERCF3/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#define TARGET_BOARD_IDENTIFIER "IMF3"

#define ENABLE_DSHOT_DMAR true
#define ENABLE_DSHOT_DMAR DSHOT_DMAR_ON

#define LED0_PIN PB7

Expand Down
2 changes: 1 addition & 1 deletion src/main/target/JHEF7DUAL/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#define TARGET_BOARD_IDENTIFIER "JH7D"
#define USBD_PRODUCT_STRING "JHEF7DUAL"

#define ENABLE_DSHOT_DMAR true
#define ENABLE_DSHOT_DMAR DSHOT_DMAR_ON

#define LED0_PIN PA15

Expand Down
2 changes: 1 addition & 1 deletion src/main/target/LUXMINIF7/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#define BEEPER_PIN PB0
#define BEEPER_INVERTED

#define ENABLE_DSHOT_DMAR true
#define ENABLE_DSHOT_DMAR DSHOT_DMAR_ON



Expand Down
5 changes: 3 additions & 2 deletions src/main/target/MAMBAF411/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
#define BEEPER_PIN PB2
#define BEEPER_INVERTED

#define ENABLE_DSHOT_DMAR true
#define ENABLE_DSHOT_DMAR DSHOT_DMAR_AUTO
#define DSHOT_BITBANG_DEFAULT DSHOT_BITBANG_OFF

// ******* INVERTER PIN ********

Expand Down Expand Up @@ -123,4 +124,4 @@
#define TARGET_IO_PORTD (BIT(2))

#define USABLE_TIMER_CHANNEL_COUNT 8
#define USED_TIMERS ( TIM_N(1) | TIM_N(2) | TIM_N(3) | TIM_N(4) | TIM_N(10) | TIM_N(11) )
#define USED_TIMERS ( TIM_N(1) | TIM_N(2) | TIM_N(3) | TIM_N(4) | TIM_N(10) | TIM_N(11) )
4 changes: 2 additions & 2 deletions src/main/target/MAMBAF722/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#define BEEPER_PIN PB2
#define BEEPER_INVERTED

#define ENABLE_DSHOT_DMAR true
#define ENABLE_DSHOT_DMAR DSHOT_DMAR_ON

#define USE_PINIO
#define PINIO1_PIN PB0 // Bluetooth mode control, PB0 is connected to the 36 pin (P2.0) of the Bluetooth chip. Replace PB0 with the pin for your flight control and 36-pin connection
Expand Down Expand Up @@ -157,4 +157,4 @@
#define TARGET_IO_PORTD (BIT(2))

#define USABLE_TIMER_CHANNEL_COUNT 7
#define USED_TIMERS ( TIM_N(1) | TIM_N(2) | TIM_N(4) | TIM_N(8) | TIM_N(11) )
#define USED_TIMERS ( TIM_N(1) | TIM_N(2) | TIM_N(4) | TIM_N(8) | TIM_N(11) )
2 changes: 1 addition & 1 deletion src/main/target/MATEKF405/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#define BEEPER_PIN PC13
#define BEEPER_INVERTED

#define ENABLE_DSHOT_DMAR true
#define ENABLE_DSHOT_DMAR DSHOT_DMAR_ON

// *************** Gyro & ACC **********************
#define USE_SPI
Expand Down
4 changes: 3 additions & 1 deletion src/main/target/MATEKF411/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
#define BEEPER_PIN PB2
#define BEEPER_INVERTED

#define ENABLE_DSHOT_DMAR DSHOT_DMAR_AUTO
#define DSHOT_BITBANG_DEFAULT DSHOT_BITBANG_OFF

// *************** Gyro & ACC **********************
#define USE_SPI
#define USE_SPI_DEVICE_1
Expand Down Expand Up @@ -122,4 +125,3 @@

#define USABLE_TIMER_CHANNEL_COUNT 10
#define USED_TIMERS ( TIM_N(1)|TIM_N(2)|TIM_N(3)|TIM_N(4)|TIM_N(5)|TIM_N(9) )

3 changes: 3 additions & 0 deletions src/main/target/MATEKF411RX/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@

#define USE_SPI

#define ENABLE_DSHOT_DMAR DSHOT_DMAR_AUTO
#define DSHOT_BITBANG_DEFAULT DSHOT_BITBANG_OFF

// *************** SPI1 Gyro & ACC **********************
#define USE_SPI_DEVICE_1
#define SPI1_SCK_PIN PA5
Expand Down
2 changes: 1 addition & 1 deletion src/main/target/MATEKF722/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

#define USBD_PRODUCT_STRING "MatekF7"

#define ENABLE_DSHOT_DMAR true
#define ENABLE_DSHOT_DMAR DSHOT_DMAR_ON

#define LED0_PIN PB9
#define LED1_PIN PA14
Expand Down
2 changes: 1 addition & 1 deletion src/main/target/MATEKF722SE/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#define TARGET_BOARD_IDENTIFIER "MF7S"
#define USBD_PRODUCT_STRING "MATEKF722SE"

#define ENABLE_DSHOT_DMAR true
#define ENABLE_DSHOT_DMAR DSHOT_DMAR_ON

#define LED0_PIN PA14 //Blue SWCLK
#define LED1_PIN PA13 //Green SWDIO
Expand Down
2 changes: 1 addition & 1 deletion src/main/target/MERAKRCF405/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
#define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC
#define CURRENT_METER_SCALE_DEFAULT 179

#define ENABLE_DSHOT_DMAR true
#define ENABLE_DSHOT_DMAR DSHOT_DMAR_ON

#define USE_ESCSERIAL
#define ESCSERIAL_TIMER_TX_PIN PA3
Expand Down
2 changes: 1 addition & 1 deletion src/main/target/MERAKRCF722/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
#define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC
#define CURRENT_METER_SCALE_DEFAULT 179

#define ENABLE_DSHOT_DMAR true
#define ENABLE_DSHOT_DMAR DSHOT_DMAR_ON

#define USE_ESCSERIAL
#define ESCSERIAL_TIMER_TX_PIN PA3
Expand Down
2 changes: 1 addition & 1 deletion src/main/target/OMNIBUSF4/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
#define BEEPER_INVERTED

#if defined(OMNIBUSF4SD) || defined(DYSF4PRO)
#define ENABLE_DSHOT_DMAR true
#define ENABLE_DSHOT_DMAR DSHOT_DMAR_ON
#endif

#ifdef OMNIBUSF4SD
Expand Down
2 changes: 1 addition & 1 deletion src/main/target/OMNIBUSF4NANOV7/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#define BEEPER_PIN PC5
#define BEEPER_INVERTED

#define ENABLE_DSHOT_DMAR true
#define ENABLE_DSHOT_DMAR DSHOT_DMAR_ON

// *************** Gyro & ACC **********************
#define USE_SPI
Expand Down
2 changes: 1 addition & 1 deletion src/main/target/OMNIBUSF7NANOV7/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#define BEEPER_PIN PB0
#define BEEPER_INVERTED

#define ENABLE_DSHOT_DMAR true
#define ENABLE_DSHOT_DMAR DSHOT_DMAR_ON

// *************** Gyro & ACC **********************
#define USE_SPI
Expand Down
2 changes: 1 addition & 1 deletion src/main/target/OMNINXT/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#define BEEPER_PIN PC13
#define BEEPER_INVERTED

#define ENABLE_DSHOT_DMAR true
#define ENABLE_DSHOT_DMAR DSHOT_DMAR_ON

#ifdef OMNINXT4
#define USE_INVERTER
Expand Down
2 changes: 1 addition & 1 deletion src/main/target/REVO/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@
#define PINIO2_PIN PC14

#define DEFAULT_MIXER MIXER_QUADX
#define ENABLE_DSHOT_DMAR true
#define ENABLE_DSHOT_DMAR DSHOT_DMAR_ON
#define USE_TARGET_CONFIG
#define SOFTSERIAL1_TX_PIN PC9
#define SOFTSERIAL2_RX_PIN PA8
Expand Down

0 comments on commit c37a7c9

Please sign in to comment.