betaflight / config

Betaflight target definitions
GNU General Public License v3.0
30 stars 105 forks source link

Add JHEF745V2 target board #427

Closed jhemcu closed 4 months ago

jhemcu commented 4 months ago

The old version uses the MPU6000 sensor, this version uses the ICM42688 sensor, and the other pin configurations are the same.

b316b2426d764ee561885c2c4d00d69

nerdCopter commented 4 months ago

here is a diff of the two, (some are not different, just different alignment).

i wonder if only updating the existing to include the gyro is more appropriate? it might requires some #ifdef for gyro alignment. unsure if this is possible, to be honest.

--- #pragma once    Fri May 17 08:31:15 2024
+++ /*  Fri May 17 08:31:15 2024
@@ -1,15 +1,35 @@
+/*
+ * This file is part of Betaflight.
+ *
+ * Betaflight is free software. You can redistribute this software
+ * and/or modify this software under the terms of the GNU General
+ * Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later
+ * version.
+ *
+ * Betaflight is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this software.
+ *
+ * If not, see <http://www.gnu.org/licenses/>.
+ */
+
 #pragma once

 #define FC_TARGET_MCU     STM32F745

-#define BOARD_NAME        JHEF745_ICM
+#define BOARD_NAME        JHEF745
 #define MANUFACTURER_ID   JHEF

 #define USE_ACC
-#define USE_ACC_SPI_ICM42688P
+#define USE_ACC_SPI_MPU6000
 #define USE_GYRO
-#define USE_GYRO_SPI_ICM42688P
-
+#define USE_GYRO_SPI_MPU6000
 #define USE_BARO
 #define USE_BARO_BMP280
 #define USE_BARO_DPS310
@@ -76,24 +96,21 @@
     TIMER_PIN_MAP( 7, PD12, 1,  0) \
     TIMER_PIN_MAP( 8, PB3 , 1,  0)

+
 #define ADC1_DMA_OPT        1
 #define DEFAULT_DSHOT_BITBANG DSHOT_BITBANG_ON

-#define MAG_I2C_INSTANCE    (I2CDEV_1)
-#define BARO_I2C_INSTANCE   (I2CDEV_1)
+#define MAG_I2C_INSTANCE (I2CDEV_1)
+#define BARO_I2C_INSTANCE (I2CDEV_1)

-#define USE_MAG
-#define USE_GPS
-#define USE_LED_STRIP
+#define DEFAULT_BLACKBOX_DEVICE     BLACKBOX_DEVICE_FLASH
+#define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC
+#define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC
+#define DEFAULT_CURRENT_METER_SCALE 275
+#define BEEPER_INVERTED

-#define DEFAULT_BLACKBOX_DEVICE         BLACKBOX_DEVICE_FLASH
-#define DEFAULT_CURRENT_METER_SOURCE    CURRENT_METER_ADC
-#define DEFAULT_VOLTAGE_METER_SOURCE    VOLTAGE_METER_ADC
-#define DEFAULT_CURRENT_METER_SCALE     275
-#define BEEPER_INVERTED
-#define PINIO1_BOX                      40
+#define MAX7456_SPI_INSTANCE SPI2

-#define MAX7456_SPI_INSTANCE    SPI2
-#define FLASH_SPI_INSTANCE      SPI1
-#define GYRO_1_SPI_INSTANCE     SPI4
-#define GYRO_1_ALIGN            CW0_DEG
+#define FLASH_SPI_INSTANCE SPI1
+#define GYRO_1_SPI_INSTANCE SPI4
+#define GYRO_1_ALIGN CW270_DEG
jhemcu commented 4 months ago

You are right. The only difference is the gyroscope...but I think the current compilation system cannot support the #ifdef operation.

jhemcu commented 4 months ago

here is a diff of the two, (some are not different, just different alignment).

i wonder if only updating the existing to include the gyro is more appropriate? it might requires some #ifdef for gyro alignment. unsure if this is possible, to be honest.

--- #pragma once  Fri May 17 08:31:15 2024
+++ /*    Fri May 17 08:31:15 2024
@@ -1,15 +1,35 @@
+/*
+ * This file is part of Betaflight.
+ *
+ * Betaflight is free software. You can redistribute this software
+ * and/or modify this software under the terms of the GNU General
+ * Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later
+ * version.
+ *
+ * Betaflight is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this software.
+ *
+ * If not, see <http://www.gnu.org/licenses/>.
+ */
+
 #pragma once

 #define FC_TARGET_MCU     STM32F745

-#define BOARD_NAME        JHEF745_ICM
+#define BOARD_NAME        JHEF745
 #define MANUFACTURER_ID   JHEF

 #define USE_ACC
-#define USE_ACC_SPI_ICM42688P
+#define USE_ACC_SPI_MPU6000
 #define USE_GYRO
-#define USE_GYRO_SPI_ICM42688P
-
+#define USE_GYRO_SPI_MPU6000
 #define USE_BARO
 #define USE_BARO_BMP280
 #define USE_BARO_DPS310
@@ -76,24 +96,21 @@
     TIMER_PIN_MAP( 7, PD12, 1,  0) \
     TIMER_PIN_MAP( 8, PB3 , 1,  0)

+
 #define ADC1_DMA_OPT        1
 #define DEFAULT_DSHOT_BITBANG DSHOT_BITBANG_ON

-#define MAG_I2C_INSTANCE    (I2CDEV_1)
-#define BARO_I2C_INSTANCE   (I2CDEV_1)
+#define MAG_I2C_INSTANCE (I2CDEV_1)
+#define BARO_I2C_INSTANCE (I2CDEV_1)

-#define USE_MAG
-#define USE_GPS
-#define USE_LED_STRIP
+#define DEFAULT_BLACKBOX_DEVICE     BLACKBOX_DEVICE_FLASH
+#define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC
+#define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC
+#define DEFAULT_CURRENT_METER_SCALE 275
+#define BEEPER_INVERTED

-#define DEFAULT_BLACKBOX_DEVICE         BLACKBOX_DEVICE_FLASH
-#define DEFAULT_CURRENT_METER_SOURCE    CURRENT_METER_ADC
-#define DEFAULT_VOLTAGE_METER_SOURCE    VOLTAGE_METER_ADC
-#define DEFAULT_CURRENT_METER_SCALE     275
-#define BEEPER_INVERTED
-#define PINIO1_BOX                      40
+#define MAX7456_SPI_INSTANCE SPI2

-#define MAX7456_SPI_INSTANCE    SPI2
-#define FLASH_SPI_INSTANCE      SPI1
-#define GYRO_1_SPI_INSTANCE     SPI4
-#define GYRO_1_ALIGN            CW0_DEG
+#define FLASH_SPI_INSTANCE SPI1
+#define GYRO_1_SPI_INSTANCE SPI4
+#define GYRO_1_ALIGN CW270_DEG

Hi @nerdCopter. I tried, but this method is not feasible. I can only target them independently. Before we find a reasonable solution, I hope to merge it because our users need it...

nerdCopter commented 4 months ago

if @haslinghuis approves, i will approve

nerdCopter commented 4 months ago

thank you @haslinghuis

@jhemcu , please note the board name is JHEF745V2