From 58aa772ae6a9ff8c8f8262784fc642ab9b04e7f9 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Sat, 16 Dec 2023 18:28:12 +0100 Subject: [PATCH 01/12] IFLIGHT_BLITZ_H743_WING --- .../IFLIGHT_BLITZ_H743_WING/CMakeLists.txt | 1 + .../target/IFLIGHT_BLITZ_H743_WING/config.c | 32 ++++ .../target/IFLIGHT_BLITZ_H743_WING/target.c | 49 +++++ .../target/IFLIGHT_BLITZ_H743_WING/target.h | 175 ++++++++++++++++++ 4 files changed, 257 insertions(+) create mode 100644 src/main/target/IFLIGHT_BLITZ_H743_WING/CMakeLists.txt create mode 100644 src/main/target/IFLIGHT_BLITZ_H743_WING/config.c create mode 100644 src/main/target/IFLIGHT_BLITZ_H743_WING/target.c create mode 100644 src/main/target/IFLIGHT_BLITZ_H743_WING/target.h diff --git a/src/main/target/IFLIGHT_BLITZ_H743_WING/CMakeLists.txt b/src/main/target/IFLIGHT_BLITZ_H743_WING/CMakeLists.txt new file mode 100644 index 00000000000..3dd95a51014 --- /dev/null +++ b/src/main/target/IFLIGHT_BLITZ_H743_WING/CMakeLists.txt @@ -0,0 +1 @@ +target_stm32h743xi(IFLIGHT_BLITZ_H743_WING) \ No newline at end of file diff --git a/src/main/target/IFLIGHT_BLITZ_H743_WING/config.c b/src/main/target/IFLIGHT_BLITZ_H743_WING/config.c new file mode 100644 index 00000000000..1065971614a --- /dev/null +++ b/src/main/target/IFLIGHT_BLITZ_H743_WING/config.c @@ -0,0 +1,32 @@ +/* + * This file is part of Cleanflight. + * + * Cleanflight is free software: you can redistribute it and/or modify + * it 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. + * + * Cleanflight 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 Cleanflight. If not, see . + */ + +#include + +#include "platform.h" + +#include "fc/fc_msp_box.h" +#include "fc/config.h" + +#include "io/piniobox.h" + +void targetConfiguration(void) +{ + pinioBoxConfigMutable()->permanentId[0] = BOX_PERMANENT_ID_USER1; + pinioBoxConfigMutable()->permanentId[1] = BOX_PERMANENT_ID_USER2; + beeperConfigMutable()->pwmMode = true; +} diff --git a/src/main/target/IFLIGHT_BLITZ_H743_WING/target.c b/src/main/target/IFLIGHT_BLITZ_H743_WING/target.c new file mode 100644 index 00000000000..23dd0e0c37a --- /dev/null +++ b/src/main/target/IFLIGHT_BLITZ_H743_WING/target.c @@ -0,0 +1,49 @@ +/* + * This file is part of INAV. + * + * INAV is free software: you can redistribute it and/or modify + * it 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. + * + * INAV 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 INAV. If not, see . + */ + +#include + +#include "platform.h" + +#include "drivers/bus.h" +#include "drivers/io.h" +#include "drivers/pwm_mapping.h" +#include "drivers/timer.h" +#include "drivers/pinio.h" +#include "drivers/sensor.h" + +timerHardware_t timerHardware[] = { + DEF_TIM(TIM3, CH3, PB0, TIM_USE_OUTPUT_AUTO, 0, 0), // S1 + DEF_TIM(TIM3, CH4, PB1, TIM_USE_OUTPUT_AUTO, 0, 1), // S2 + + DEF_TIM(TIM5, CH1, PA0, TIM_USE_OUTPUT_AUTO, 0, 2), // S3 + DEF_TIM(TIM5, CH2, PA1, TIM_USE_OUTPUT_AUTO, 0, 3), // S4 + DEF_TIM(TIM5, CH3, PA2, TIM_USE_OUTPUT_AUTO, 0, 4), // S5 + DEF_TIM(TIM5, CH4, PA3, TIM_USE_OUTPUT_AUTO, 0, 5), // S6 + + DEF_TIM(TIM4, CH1, PD12, TIM_USE_OUTPUT_AUTO, 0, 6), // S7 + DEF_TIM(TIM4, CH2, PD13, TIM_USE_OUTPUT_AUTO, 0, 7), // S8 + DEF_TIM(TIM4, CH3, PD14, TIM_USE_OUTPUT_AUTO, 0, 0), // S9 + DEF_TIM(TIM4, CH4, PD15, TIM_USE_OUTPUT_AUTO, 0, 0), // S10 DMA_NONE + + DEF_TIM(TIM15, CH1, PE5, TIM_USE_OUTPUT_AUTO, 0, 0), // S11 + DEF_TIM(TIM15, CH2, PE6, TIM_USE_OUTPUT_AUTO, 0, 0), // S12 DMA_NONE + + DEF_TIM(TIM1, CH1, PA8, TIM_USE_LED, 0, 9), // LED_2812 +}; + +const int timerHardwareCount = sizeof(timerHardware) / sizeof(timerHardware[0]); diff --git a/src/main/target/IFLIGHT_BLITZ_H743_WING/target.h b/src/main/target/IFLIGHT_BLITZ_H743_WING/target.h new file mode 100644 index 00000000000..6fa112d489a --- /dev/null +++ b/src/main/target/IFLIGHT_BLITZ_H743_WING/target.h @@ -0,0 +1,175 @@ +/* + * This file is part of INAV. + * + * INAV is free software: you can redistribute it and/or modify + * it 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. + * + * INAV 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 INAV. If not, see . + */ + + +#pragma once + +#define TARGET_BOARD_IDENTIFIER "IH7W" + +#define USBD_PRODUCT_STRING "IFLIGHT_BLITZ_H743_WING" + +#define USE_TARGET_CONFIG + +#define LED0 PE3 +#define LED1 PE4 + +#define BEEPER PA15 +#define BEEPER_INVERTED + +// SPI1 +#define USE_SPI +#define USE_SPI_DEVICE_1 +#define SPI1_SCK_PIN PA5 +#define SPI1_MISO_PIN PA6 +#define SPI1_MOSI_PIN PD7 + +// SPI2 +#define USE_SPI_DEVICE_2 +#define SPI2_SCK_PIN PB13 +#define SPI2_MISO_PIN PB14 +#define SPI2_MOSI_PIN PB15 + +// SPI3 - not connected +#define USE_SPI_DEVICE_3 +#define SPI3_SCK_PIN PB3 +#define SPI3_MISO_PIN PB4 +#define SPI3_MOSI_PIN PB5 + +// SPI4 - GYRO2 not used in INAV +#define USE_SPI_DEVICE_4 +#define SPI4_SCK_PIN PE12 +#define SPI4_MISO_PIN PE13 +#define SPI4_MOSI_PIN PE14 + +// ICM42605 +#define USE_IMU_ICM42605 +#define IMU_ICM42605_ALIGN CW0_DEG +#define ICM42605_SPI_BUS BUS_SPI1 +#define ICM42605_CS_PIN PC15 + +// OSD +#define USE_MAX7456 +#define MAX7456_SPI_BUS BUS_SPI2 +#define MAX7456_CS_PIN PB12 + +// I2C +#define USE_I2C +#define USE_I2C_DEVICE_1 +#define I2C1_SCL PB6 +#define I2C1_SDA PB7 + +#define USE_I2C_DEVICE_2 +#define I2C2_SCL PB10 +#define I2C2_SDA PB11 + +#define USE_BARO +#define BARO_I2C_BUS BUS_I2C2 +#define USE_BARO_ALL + +#define USE_MAG +#define MAG_I2C_BUS BUS_I2C1 +#define USE_MAG_ALL + +#define TEMPERATURE_I2C_BUS BUS_I2C2 +#define PITOT_I2C_BUS BUS_I2C2 + +#define USE_RANGEFINDER +#define RANGEFINDER_I2C_BUS BUS_I2C1 + +// *************** UART ***************************** +#define USE_VCP + +#define USE_UART1 +#define UART1_TX_PIN PA9 +#define UART1_RX_PIN PA10 + +#define USE_UART2 +#define UART2_TX_PIN PD5 +#define UART2_RX_PIN PD6 + +#define USE_UART3 +#define UART3_TX_PIN PD8 +#define UART3_RX_PIN PD9 + +#define USE_UART4 +#define UART4_TX_PIN PB9 +#define UART4_RX_PIN PB8 + +#define USE_UART6 +#define UART6_TX_PIN PC6 +#define UART6_RX_PIN PC7 + +#define USE_UART7 +#define UART7_TX_PIN PE8 +#define UART7_RX_PIN PE7 + +#define USE_UART8 +#define UART8_TX_PIN PE1 +#define UART8_RX_PIN PE0 + +#define SERIAL_PORT_COUNT 8 + +#define DEFAULT_RX_TYPE RX_TYPE_SERIAL +#define SERIALRX_PROVIDER SERIALRX_CRSF +#define SERIALRX_UART SERIAL_PORT_USART6 + +// *************** SDIO SD BLACKBOX******************* +#define USE_SDCARD +#define USE_SDCARD_SDIO +#define SDCARD_SDIO_DEVICE SDIODEV_1 +#define SDCARD_SDIO_4BIT + +#define ENABLE_BLACKBOX_LOGGING_ON_SDCARD_BY_DEFAULT + +// *************** ADC ***************************** +#define USE_ADC +#define ADC_INSTANCE ADC1 + +#define ADC_CHANNEL_1_PIN PC0 //ADC123 VBAT1 +#define ADC_CHANNEL_2_PIN PC1 //ADC123 CURR1 +#define ADC_CHANNEL_3_PIN PC5 //ADC12 RSSI +#define ADC_CHANNEL_4_PIN PC4 //ADC12 AirS + +#define VBAT_ADC_CHANNEL ADC_CHN_1 +#define CURRENT_METER_ADC_CHANNEL ADC_CHN_2 +#define RSSI_ADC_CHANNEL ADC_CHN_3 +#define AIRSPEED_ADC_CHANNEL ADC_CHN_4 + +// *************** PINIO *************************** +#define USE_PINIO +#define USE_PINIOBOX +#define PINIO1_PIN PD10 // VTX power switcher +#define PINIO2_PIN PD11 // 2xCamera switcher + +// *************** LEDSTRIP ************************ +#define USE_LED_STRIP +#define WS2811_PIN PA8 + +#define DEFAULT_FEATURES (FEATURE_OSD | FEATURE_TELEMETRY | FEATURE_CURRENT_METER | FEATURE_VBAT | FEATURE_TX_PROF_SEL | FEATURE_BLACKBOX) +#define CURRENT_METER_SCALE 250 + +#define USE_SERIAL_4WAY_BLHELI_INTERFACE + +#define TARGET_IO_PORTA 0xffff +#define TARGET_IO_PORTB 0xffff +#define TARGET_IO_PORTC 0xffff +#define TARGET_IO_PORTD 0xffff +#define TARGET_IO_PORTE 0xffff + +#define MAX_PWM_OUTPUT_PORTS 12 +#define USE_DSHOT +#define USE_ESC_SENSOR \ No newline at end of file From 2e3c85f8ccef5df784fe287793b0c04c2d3675f9 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Wed, 20 Dec 2023 17:38:39 +0100 Subject: [PATCH 02/12] Update VBAT and current sensor calibration --- src/main/target/IFLIGHT_BLITZ_H743_WING/target.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/target/IFLIGHT_BLITZ_H743_WING/target.h b/src/main/target/IFLIGHT_BLITZ_H743_WING/target.h index 6fa112d489a..50b515ad896 100644 --- a/src/main/target/IFLIGHT_BLITZ_H743_WING/target.h +++ b/src/main/target/IFLIGHT_BLITZ_H743_WING/target.h @@ -160,7 +160,8 @@ #define WS2811_PIN PA8 #define DEFAULT_FEATURES (FEATURE_OSD | FEATURE_TELEMETRY | FEATURE_CURRENT_METER | FEATURE_VBAT | FEATURE_TX_PROF_SEL | FEATURE_BLACKBOX) -#define CURRENT_METER_SCALE 250 +#define CURRENT_METER_SCALE 212 +#define VBAT_SCALE_DEFAULT 1135 #define USE_SERIAL_4WAY_BLHELI_INTERFACE From 02171f432f41d1494d6961d24356f73974c2f58d Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Sun, 21 Jan 2024 19:49:58 +0100 Subject: [PATCH 03/12] target rename --- src/main/target/IFLIGHT_BLITZ_H743_WING/CMakeLists.txt | 1 - src/main/target/IFLIGHT_BLITZ_H7_PRO/CMakeLists.txt | 1 + .../config.c | 0 .../target.c | 0 .../target.h | 4 ++-- 5 files changed, 3 insertions(+), 3 deletions(-) delete mode 100644 src/main/target/IFLIGHT_BLITZ_H743_WING/CMakeLists.txt create mode 100644 src/main/target/IFLIGHT_BLITZ_H7_PRO/CMakeLists.txt rename src/main/target/{IFLIGHT_BLITZ_H743_WING => IFLIGHT_BLITZ_H7_PRO}/config.c (100%) rename src/main/target/{IFLIGHT_BLITZ_H743_WING => IFLIGHT_BLITZ_H7_PRO}/target.c (100%) rename src/main/target/{IFLIGHT_BLITZ_H743_WING => IFLIGHT_BLITZ_H7_PRO}/target.h (97%) diff --git a/src/main/target/IFLIGHT_BLITZ_H743_WING/CMakeLists.txt b/src/main/target/IFLIGHT_BLITZ_H743_WING/CMakeLists.txt deleted file mode 100644 index 3dd95a51014..00000000000 --- a/src/main/target/IFLIGHT_BLITZ_H743_WING/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -target_stm32h743xi(IFLIGHT_BLITZ_H743_WING) \ No newline at end of file diff --git a/src/main/target/IFLIGHT_BLITZ_H7_PRO/CMakeLists.txt b/src/main/target/IFLIGHT_BLITZ_H7_PRO/CMakeLists.txt new file mode 100644 index 00000000000..b8fc79235d4 --- /dev/null +++ b/src/main/target/IFLIGHT_BLITZ_H7_PRO/CMakeLists.txt @@ -0,0 +1 @@ +target_stm32h743xi(IFLIGHT_BLITZ_H7_PRO) \ No newline at end of file diff --git a/src/main/target/IFLIGHT_BLITZ_H743_WING/config.c b/src/main/target/IFLIGHT_BLITZ_H7_PRO/config.c similarity index 100% rename from src/main/target/IFLIGHT_BLITZ_H743_WING/config.c rename to src/main/target/IFLIGHT_BLITZ_H7_PRO/config.c diff --git a/src/main/target/IFLIGHT_BLITZ_H743_WING/target.c b/src/main/target/IFLIGHT_BLITZ_H7_PRO/target.c similarity index 100% rename from src/main/target/IFLIGHT_BLITZ_H743_WING/target.c rename to src/main/target/IFLIGHT_BLITZ_H7_PRO/target.c diff --git a/src/main/target/IFLIGHT_BLITZ_H743_WING/target.h b/src/main/target/IFLIGHT_BLITZ_H7_PRO/target.h similarity index 97% rename from src/main/target/IFLIGHT_BLITZ_H743_WING/target.h rename to src/main/target/IFLIGHT_BLITZ_H7_PRO/target.h index 50b515ad896..23fde63466c 100644 --- a/src/main/target/IFLIGHT_BLITZ_H743_WING/target.h +++ b/src/main/target/IFLIGHT_BLITZ_H7_PRO/target.h @@ -18,9 +18,9 @@ #pragma once -#define TARGET_BOARD_IDENTIFIER "IH7W" +#define TARGET_BOARD_IDENTIFIER "IB7P" -#define USBD_PRODUCT_STRING "IFLIGHT_BLITZ_H743_WING" +#define USBD_PRODUCT_STRING "IFLIGHT_BLITZ_H7_PRO" #define USE_TARGET_CONFIG From 6e95aea456146094cdb451ad70233ff0ab4e31ad Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Fri, 9 Feb 2024 19:23:16 +0100 Subject: [PATCH 04/12] 1st cut of T-motor Velox F7 V2 target. --- .../target/TMOTORVELOXF7V2/CMakeLists.txt | 1 + src/main/target/TMOTORVELOXF7V2/config.c | 32 ++++ src/main/target/TMOTORVELOXF7V2/target.c | 43 +++++ src/main/target/TMOTORVELOXF7V2/target.h | 147 ++++++++++++++++++ 4 files changed, 223 insertions(+) create mode 100644 src/main/target/TMOTORVELOXF7V2/CMakeLists.txt create mode 100644 src/main/target/TMOTORVELOXF7V2/config.c create mode 100644 src/main/target/TMOTORVELOXF7V2/target.c create mode 100644 src/main/target/TMOTORVELOXF7V2/target.h diff --git a/src/main/target/TMOTORVELOXF7V2/CMakeLists.txt b/src/main/target/TMOTORVELOXF7V2/CMakeLists.txt new file mode 100644 index 00000000000..15160ea350d --- /dev/null +++ b/src/main/target/TMOTORVELOXF7V2/CMakeLists.txt @@ -0,0 +1 @@ +target_stm32f722xe(TMOTORVELOXF7V2) diff --git a/src/main/target/TMOTORVELOXF7V2/config.c b/src/main/target/TMOTORVELOXF7V2/config.c new file mode 100644 index 00000000000..8134059c38d --- /dev/null +++ b/src/main/target/TMOTORVELOXF7V2/config.c @@ -0,0 +1,32 @@ +/* + * This file is part of Cleanflight. + * + * Cleanflight is free software: you can redistribute it and/or modify + * it 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. + * + * Cleanflight 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 Cleanflight. If not, see . + */ + +#include + +#include "platform.h" + +#include "drivers/pwm_mapping.h" + +#include "fc/fc_msp_box.h" + +#include "io/piniobox.h" +#include "io/serial.h" + +void targetConfiguration(void) +{ + +} diff --git a/src/main/target/TMOTORVELOXF7V2/target.c b/src/main/target/TMOTORVELOXF7V2/target.c new file mode 100644 index 00000000000..7d9ae0d3292 --- /dev/null +++ b/src/main/target/TMOTORVELOXF7V2/target.c @@ -0,0 +1,43 @@ +/* + * This file is part of INAV. + * + * INAV is free software: you can redistribute it and/or modify + * it 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. + * + * INAV 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 INAV. If not, see . + */ + +#include + +#include "platform.h" + +#include "drivers/bus.h" +#include "drivers/io.h" +#include "drivers/pwm_mapping.h" +#include "drivers/timer.h" +#include "drivers/pinio.h" +#include "drivers/sensor.h" + +timerHardware_t timerHardware[] = { + DEF_TIM(TIM3, CH1, PB4, TIM_USE_OUTPUT_AUTO, 0, 0), // S1 UP1-2 D(1, 4, 5) + DEF_TIM(TIM3, CH2, PB5, TIM_USE_OUTPUT_AUTO, 0, 0), // S2 UP1-2 D(1, 5, 5) + DEF_TIM(TIM3, CH3, PB0, TIM_USE_OUTPUT_AUTO, 0, 0), // S3 UP1-2 D(1, 7, 5) + DEF_TIM(TIM3, CH4, PB1, TIM_USE_OUTPUT_AUTO, 0, 0), // S4 UP1-2 D(1, 2, 5) + + DEF_TIM(TIM2, CH1, PA15, TIM_USE_OUTPUT_AUTO, 0, 0), // S5 UP1-7 D(1, 5, 3) - clash with S2 + DEF_TIM(TIM2, CH2, PB3, TIM_USE_OUTPUT_AUTO, 0, 0), // S6 UP1-7 D(1, 6, 3) + DEF_TIM(TIM4, CH1, PB6, TIM_USE_OUTPUT_AUTO, 0, 0), // S7 UP1-6 D(1, 0, 2) // used to be fw motor + DEF_TIM(TIM4, CH2, PB7, TIM_USE_OUTPUT_AUTO, 0, 0), // S8 UP1-6 D(1, 3, 2) // used to be fw motor + + DEF_TIM(TIM1, CH1, PA8, TIM_USE_LED, 0, 1), // LED +}; + +const int timerHardwareCount = sizeof(timerHardware) / sizeof(timerHardware[0]); diff --git a/src/main/target/TMOTORVELOXF7V2/target.h b/src/main/target/TMOTORVELOXF7V2/target.h new file mode 100644 index 00000000000..09f30857ec8 --- /dev/null +++ b/src/main/target/TMOTORVELOXF7V2/target.h @@ -0,0 +1,147 @@ +/* + * This file is part of INAV. + * + * INAV is free software: you can redistribute it and/or modify + * it 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. + * + * INAV 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 INAV. If not, see . + */ + + +#pragma once + +#define TARGET_BOARD_IDENTIFIER "TVF7" + +#define USBD_PRODUCT_STRING "TMOTORVELOXF7V2" + +#define LED0 PA14 +#define LED1 PA13 + +#define BEEPER PC13 +#define BEEPER_INVERTED + + +// SPI +#define USE_SPI +#define USE_SPI_DEVICE_1 +#define SPI1_SCK_PIN PA5 +#define SPI1_MISO_PIN PA6 +#define SPI1_MOSI_PIN PA7 + +#define USE_SPI_DEVICE_2 +#define SPI2_SCK_PIN PB13 +#define SPI2_MISO_PIN PB14 +#define SPI2_MOSI_PIN PB15 + +#define USE_SPI_DEVICE_3 +#define SPI3_SCK_PIN PC10 +#define SPI3_MISO_PIN PC11 +#define SPI3_MOSI_PIN PC12 + +//GYRO +#define USE_IMU_ICM42605 +#define IMU_ICM42605_ALIGN CW270_DEG +#define ICM42605_CS_PIN PB2 +#define ICM42605_SPI_BUS BUS_SPI1 + + +// *************** I2C /Baro/Mag ********************* +#define USE_I2C +#define USE_I2C_DEVICE_1 +#define I2C1_SCL PB8 +#define I2C1_SDA PB9 + +#define USE_BARO +#define BARO_I2C_BUS BUS_I2C1 +#define USE_BARO_ALL + +#define USE_MAG +#define MAG_I2C_BUS BUS_I2C1 +#define USE_MAG_ALL + +#define TEMPERATURE_I2C_BUS BUS_I2C1 +#define PITOT_I2C_BUS BUS_I2C1 +#define RANGEFINDER_I2C_BUS BUS_I2C1 + +// *************** SPI2 OSD *********************** +#define USE_MAX7456 +#define MAX7456_SPI_BUS BUS_SPI2 +#define MAX7456_CS_PIN PB12 + +// *************** SPI3 SD BLACKBOX******************* +#define USE_FLASHFS +#define USE_FLASH_M25P16 +#define M25P16_SPI_BUS BUS_SPI3 +#define M25P16_CS_PIN PD2 +#define ENABLE_BLACKBOX_LOGGING_ON_SPIFLASH_BY_DEFAULT + +// *************** UART ***************************** +#define USE_VCP + +#define USE_UART1 +#define UART1_TX_PIN PA9 +#define UART1_RX_PIN PA10 + +#define USE_UART2 +#define UART2_TX_PIN PA2 +#define UART2_RX_PIN PA3 + +#define USE_UART3 +#define UART3_TX_PIN PB10 +#define UART3_RX_PIN PB11 + +#define USE_UART4 +#define UART4_TX_PIN PA0 +#define UART4_RX_PIN PA1 + +#define USE_UART6 +#define UART6_TX_PIN PC6 +#define UART6_RX_PIN PC7 + +#define SERIAL_PORT_COUNT 6 + +#define DEFAULT_RX_TYPE RX_TYPE_SERIAL +#define SERIALRX_PROVIDER SERIALRX_SBUS +#define SERIALRX_UART SERIAL_PORT_USART1 + +// *************** ADC ***************************** +#define USE_ADC +#define ADC_INSTANCE ADC1 +#define ADC1_DMA_STREAM DMA2_Stream0 + +#define ADC_CHANNEL_1_PIN PC2 +#define ADC_CHANNEL_2_PIN PC1 +#define ADC_CHANNEL_3_PIN PC0 + +#define VBAT_ADC_CHANNEL ADC_CHN_1 +#define CURRENT_METER_ADC_CHANNEL ADC_CHN_2 +#define RSSI_ADC_CHANNEL ADC_CHN_3 + +// *************** LEDSTRIP ************************ +#define USE_LED_STRIP +#define WS2811_PIN PA8 + +#define DEFAULT_FEATURES (FEATURE_OSD | FEATURE_CURRENT_METER | FEATURE_VBAT | FEATURE_TX_PROF_SEL | FEATURE_BLACKBOX) +#define CURRENT_METER_SCALE 250 + +#define USE_SERIAL_4WAY_BLHELI_INTERFACE + +#define TARGET_IO_PORTA 0xffff +#define TARGET_IO_PORTB 0xffff +#define TARGET_IO_PORTC 0xffff +#define TARGET_IO_PORTD 0xffff + +#define MAX_PWM_OUTPUT_PORTS 8 +#define USE_DSHOT +#define USE_SERIALSHOT +#define USE_DSHOT_DMAR +#define USE_ESC_SENSOR + From 9848c6dddce45551121d86809dee1174b265f8f9 Mon Sep 17 00:00:00 2001 From: Scavanger Date: Tue, 13 Feb 2024 11:34:39 -0300 Subject: [PATCH 05/12] SITL - RealFlight --- .gitignore | 1 + docs/SITL/RealFlight.md | 11 +++++++++-- src/main/target/SITL/sim/realFlight.c | 13 +++++++------ 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index b2c3b9ff546..6b7c8734dca 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,7 @@ cov-int* /downloads/ /debug/ /release/ +/*_SITL/ # script-generated files docs/Manual.pdf diff --git a/docs/SITL/RealFlight.md b/docs/SITL/RealFlight.md index a30963af025..6124b1e7b57 100644 --- a/docs/SITL/RealFlight.md +++ b/docs/SITL/RealFlight.md @@ -3,8 +3,15 @@ Supported are RealFlight 9.5S and RealFlight Evolution, NOT RealFlight-X. RealFlight is very well suited to simulate the model flight specific aspects. Autolaunch and the mixers can be used. -However, since the sceneries do not correspond to a real environment, the GPS data must be "faked". The position is always shown somewhere in southern Nevada ;). -GPS data and flight modes work fine though, only for missions with waypoints it is of course not ideal. + +The RealFlight 3D sceneries are based on real topographic data of the Sierra Nevada in Southern Spain. +INAV uses as reference the scenery "RealFlight Ranch" which is located at the coordinates Lat: 37.118949°, Lon: -2.772960. +Use these scenery to use the mission planner and other GPS features. + +> [!CAUTION]: +> The immediate surroundings of the airfield have been levelled in the scenery. If, for example, Autoland is to be tested here, do not use "Sea level ref" and the automatically determined heights of the Configurator. +> Either use relarive elevations or correct the elevation manually. +> The altitude of the airfield is exactly 1300 metres. ## Joystick In the settings, calibrate the joystick, set it up and assign the axes in the same order as in INAV. diff --git a/src/main/target/SITL/sim/realFlight.c b/src/main/target/SITL/sim/realFlight.c index b4e5b9283ab..9a060c576e5 100644 --- a/src/main/target/SITL/sim/realFlight.c +++ b/src/main/target/SITL/sim/realFlight.c @@ -58,9 +58,10 @@ #define RF_PORT 18083 #define RF_MAX_CHANNEL_COUNT 12 -// RealFlight scenerys doesn't represent real landscapes, so fake some nice coords: Area 51 ;) -#define FAKE_LAT 37.277127f -#define FAKE_LON -115.799669f +// "RealFlight Ranch" is located in Sierra Nevada, southern Spain +// This is not the Position of the Ranch, it's the Point of 0,0 in the Map (bottom left corner) +#define FAKE_LAT 36.910610 +#define FAKE_LON -2.876605 static uint8_t pwmMapping[RF_MAX_PWM_OUTS]; static uint8_t mappingCount; @@ -399,9 +400,9 @@ static void exchangeData(void) computeQuaternionFromRPY(&quat, roll_inav, pitch_inav, yaw_inav); transformVectorEarthToBody(&north, &quat); fakeMagSet( - constrainToInt16(north.x * 1024.0f), - constrainToInt16(north.y * 1024.0f), - constrainToInt16(north.z * 1024.0f) + constrainToInt16(north.x * 16000.0f), + constrainToInt16(north.y * 16000.0f), + constrainToInt16(north.z * 16000.0f) ); free(rfValues.m_currentAircraftStatus); From fa1ee97dd17dd391ad6f29bae531a4f66861beed Mon Sep 17 00:00:00 2001 From: Scavanger Date: Tue, 13 Feb 2024 11:44:00 -0300 Subject: [PATCH 06/12] Forget the f --- .gitignore | 1 - src/main/target/SITL/sim/realFlight.c | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 6b7c8734dca..b2c3b9ff546 100644 --- a/.gitignore +++ b/.gitignore @@ -22,7 +22,6 @@ cov-int* /downloads/ /debug/ /release/ -/*_SITL/ # script-generated files docs/Manual.pdf diff --git a/src/main/target/SITL/sim/realFlight.c b/src/main/target/SITL/sim/realFlight.c index 9a060c576e5..1bd048e1b69 100644 --- a/src/main/target/SITL/sim/realFlight.c +++ b/src/main/target/SITL/sim/realFlight.c @@ -60,8 +60,8 @@ #define RF_MAX_CHANNEL_COUNT 12 // "RealFlight Ranch" is located in Sierra Nevada, southern Spain // This is not the Position of the Ranch, it's the Point of 0,0 in the Map (bottom left corner) -#define FAKE_LAT 36.910610 -#define FAKE_LON -2.876605 +#define FAKE_LAT 36.910610f +#define FAKE_LON -2.876605f static uint8_t pwmMapping[RF_MAX_PWM_OUTS]; static uint8_t mappingCount; From fe5adb30a5d91a965e20472f0a8dbe6e95e9a4d4 Mon Sep 17 00:00:00 2001 From: Andi Kanzler Date: Sun, 18 Feb 2024 16:45:20 -0300 Subject: [PATCH 07/12] Fix realFlight.c --- src/main/target/SITL/sim/realFlight.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/target/SITL/sim/realFlight.c b/src/main/target/SITL/sim/realFlight.c index eb361ead483..a8d241425d1 100644 --- a/src/main/target/SITL/sim/realFlight.c +++ b/src/main/target/SITL/sim/realFlight.c @@ -57,7 +57,8 @@ #include "rx/sim.h" #define RF_PORT 18083 -#define RF_MAX_CHA +#define RF_MAX_CHANNEL_COUNT 12 + // "RealFlight Ranch" is located in Sierra Nevada, southern Spain // This is not the Position of the Ranch, it's the Point of 0,0 in the Map (bottom left corner) #define FAKE_LAT 36.910610f From 1108ba1ec4eb84cb54f3450cf6cc6681c663e788 Mon Sep 17 00:00:00 2001 From: Darren Lines Date: Tue, 20 Feb 2024 19:32:09 +0000 Subject: [PATCH 08/12] Revert GPS/Baro weight parameters to 7.0 Revert `inav_w_z_baro_p`, `inav_w_z_gps_p`, and `inav_w_z_gps_v` to the defaults from INAV 7.0. Changed in #9387 Altitude estimation is less accurate with the new 9387 settings. --- docs/Settings.md | 6 +++--- src/main/fc/settings.yaml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/Settings.md b/docs/Settings.md index 244298a9ee5..1f5ccde178e 100644 --- a/docs/Settings.md +++ b/docs/Settings.md @@ -1928,7 +1928,7 @@ Weight of barometer measurements in estimated altitude and climb rate. Setting i | Default | Min | Max | | --- | --- | --- | -| 0.4 | 0 | 10 | +| 0.35 | 0 | 10 | --- @@ -1938,7 +1938,7 @@ Weight of GPS altitude measurements in estimated altitude. Setting is used on bo | Default | Min | Max | | --- | --- | --- | -| 0.4 | 0 | 10 | +| 0.2 | 0 | 10 | --- @@ -1948,7 +1948,7 @@ Weight of GPS climb rate measurements in estimated climb rate. Setting is used o | Default | Min | Max | | --- | --- | --- | -| 0.8 | 0 | 10 | +| 0.1 | 0 | 10 | --- diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index 5c597c95d86..0f63c66ddd5 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -2337,19 +2337,19 @@ groups: field: w_z_baro_p min: 0 max: 10 - default_value: 0.4 + default_value: 0.35 - name: inav_w_z_gps_p description: "Weight of GPS altitude measurements in estimated altitude. Setting is used on both airplanes and multirotors." field: w_z_gps_p min: 0 max: 10 - default_value: 0.4 + default_value: 0.2 - name: inav_w_z_gps_v description: "Weight of GPS climb rate measurements in estimated climb rate. Setting is used on both airplanes and multirotors." field: w_z_gps_v min: 0 max: 10 - default_value: 0.8 + default_value: 0.1 - name: inav_w_xy_gps_p description: "Weight of GPS coordinates in estimated UAV position and speed." default_value: 1.0 From 170dc2c914747673f8c90e76bfb8b130a940f8ab Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Wed, 21 Feb 2024 09:08:58 +0100 Subject: [PATCH 09/12] FURYF4OSD update --- src/main/target/FURYF4OSD/target.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/target/FURYF4OSD/target.h b/src/main/target/FURYF4OSD/target.h index 79c26d178ae..71abc9a8c68 100644 --- a/src/main/target/FURYF4OSD/target.h +++ b/src/main/target/FURYF4OSD/target.h @@ -45,6 +45,12 @@ #define MPU6000_CS_PIN PA4 #define MPU6000_SPI_BUS BUS_SPI1 +// ICM42605/ICM42688P +#define USE_IMU_ICM42605 +#define IMU_ICM42605_ALIGN CW180_DEG +#define ICM42605_SPI_BUS BUS_SPI1 +#define ICM42605_CS_PIN PA4 + #define ENABLE_BLACKBOX_LOGGING_ON_SPIFLASH_BY_DEFAULT #define USE_SPI_DEVICE_3 #define SPI3_SCK_PIN PC10 @@ -112,10 +118,7 @@ #define USE_BARO #define BARO_I2C_BUS DEFAULT_I2C_BUS -#define USE_BARO_BMP280 -#define USE_BARO_MS5611 -#define USE_BARO_BMP085 -#define USE_BARO_DPS310 +#define USE_BARO_ALL #define USE_MAG #define MAG_I2C_BUS DEFAULT_I2C_BUS From 538f0cad1ea0a38133b6bcdea4924a58f1e68590 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 22 Feb 2024 20:32:11 +0100 Subject: [PATCH 10/12] Backport #9743 spektrum telemetry fix from master --- src/main/telemetry/srxl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/telemetry/srxl.c b/src/main/telemetry/srxl.c index 8e01e47ef8e..2c73a1e85ea 100644 --- a/src/main/telemetry/srxl.c +++ b/src/main/telemetry/srxl.c @@ -165,11 +165,13 @@ typedef struct INT8 dBm_A, // Average signal for A antenna in dBm INT8 dBm_B; // Average signal for B antenna in dBm. // If only 1 antenna, set B = A + UINT16 spare[2]; + UINT16 fastbootUptime; // bit 15 = fastboot flag. Bits 0-14= uptime in seconds. 0x0000 --> no data } STRU_TELE_RPM; */ #define STRU_TELE_RPM_EMPTY_FIELDS_COUNT 8 -#define STRU_TELE_RPM_EMPTY_FIELDS_VALUE 0xff +#define STRU_TELE_RPM_EMPTY_FIELDS_VALUE 0x00 #define SPEKTRUM_RPM_UNUSED 0xffff #define SPEKTRUM_TEMP_UNUSED 0x7fff From ec4a1962b3ec510442e570b893394a060d022fc2 Mon Sep 17 00:00:00 2001 From: Roman Lut <11955117+RomanLut@users.noreply.github.com> Date: Wed, 28 Feb 2024 20:24:54 +0100 Subject: [PATCH 11/12] fixed led_pin_pwm programming framework functionality --- src/main/programming/logic_condition.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/programming/logic_condition.c b/src/main/programming/logic_condition.c index 1fa6cb0c7b8..8fcca4dabcd 100644 --- a/src/main/programming/logic_condition.c +++ b/src/main/programming/logic_condition.c @@ -476,8 +476,9 @@ static int logicConditionCompute( } break; -#ifdef LED_PIN +#ifdef USE_LED_STRIP case LOGIC_CONDITION_LED_PIN_PWM: + if (operandA >=0 && operandA <= 100) { ledPinStartPWM((uint8_t)operandA); } else { From 9a942a5e9735e5a00f3e12d7a28248623c305e00 Mon Sep 17 00:00:00 2001 From: breadoven <56191411+breadoven@users.noreply.github.com> Date: Sun, 3 Mar 2024 21:00:21 +0000 Subject: [PATCH 12/12] Update navigation.c --- src/main/navigation/navigation.c | 58 ++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/src/main/navigation/navigation.c b/src/main/navigation/navigation.c index a4a0224e7d2..46090ff24d0 100644 --- a/src/main/navigation/navigation.c +++ b/src/main/navigation/navigation.c @@ -4322,22 +4322,6 @@ static navigationFSMEvent_t selectNavEventFromBoxModeInput(void) } posControl.rthSanityChecker.rthSanityOK = true; - /* WP mission activation control: - * canActivateWaypoint & waypointWasActivated are used to prevent WP mission - * auto restarting after interruption by Manual or RTH modes. - * WP mode must be deselected before it can be reactivated again. */ - static bool waypointWasActivated = false; - const bool isWpMissionLoaded = isWaypointMissionValid(); - bool canActivateWaypoint = isWpMissionLoaded && !posControl.flags.wpMissionPlannerActive; // Block activation if using WP Mission Planner - - if (waypointWasActivated && !FLIGHT_MODE(NAV_WP_MODE)) { - canActivateWaypoint = false; - if (!IS_RC_MODE_ACTIVE(BOXNAVWP)) { - canActivateWaypoint = true; - waypointWasActivated = false; - } - } - /* Airplane specific modes */ if (STATE(AIRPLANE)) { // LAUNCH mode has priority over any other NAV mode @@ -4377,14 +4361,36 @@ static navigationFSMEvent_t selectNavEventFromBoxModeInput(void) return NAV_FSM_EVENT_SWITCH_TO_RTH; } - /* Pilot-triggered RTH, also fall-back for WP if there is no mission loaded. - * WP prevented from falling back to RTH if WP mission planner is active */ - const bool wpRthFallbackIsActive = IS_RC_MODE_ACTIVE(BOXNAVWP) && !isWpMissionLoaded && !posControl.flags.wpMissionPlannerActive; + /* WP mission activation control: + * canActivateWaypoint & waypointWasActivated are used to prevent WP mission + * auto restarting after interruption by Manual or RTH modes. + * WP mode must be deselected before it can be reactivated again + * WP Mode also inhibited when Mission Planner is active */ + static bool waypointWasActivated = false; + bool canActivateWaypoint = isWaypointMissionValid(); + bool wpRthFallbackIsActive = false; + + if (IS_RC_MODE_ACTIVE(BOXMANUAL) || posControl.flags.wpMissionPlannerActive) { + canActivateWaypoint = false; + } else { + if (waypointWasActivated && !FLIGHT_MODE(NAV_WP_MODE)) { + canActivateWaypoint = false; + + if (!IS_RC_MODE_ACTIVE(BOXNAVWP)) { + canActivateWaypoint = true; + waypointWasActivated = false; + } + } + + wpRthFallbackIsActive = IS_RC_MODE_ACTIVE(BOXNAVWP) && !canActivateWaypoint; + } + + /* Pilot-triggered RTH, also fall-back for WP if no mission is loaded. + * Check for isExecutingRTH to prevent switching our from RTH in case of a brief GPS loss + * Without this loss of any of the canActivateNavigation && canActivateAltHold + * will kick us out of RTH state machine via NAV_FSM_EVENT_SWITCH_TO_IDLE and will prevent any of the fall-back + * logic kicking in (waiting for GPS on airplanes, switch to emergency landing etc) */ if (IS_RC_MODE_ACTIVE(BOXNAVRTH) || wpRthFallbackIsActive) { - // Check for isExecutingRTH to prevent switching our from RTH in case of a brief GPS loss - // Without this loss of any of the canActivateNavigation && canActivateAltHold - // will kick us out of RTH state machine via NAV_FSM_EVENT_SWITCH_TO_IDLE and will prevent any of the fall-back - // logic kicking in (waiting for GPS on airplanes, switch to emergency landing etc) if (isExecutingRTH || (canActivateNavigation && canActivateAltHold && STATE(GPS_FIX_HOME))) { return NAV_FSM_EVENT_SWITCH_TO_RTH; } @@ -4398,11 +4404,11 @@ static navigationFSMEvent_t selectNavEventFromBoxModeInput(void) // Pilot-activated waypoint mission. Fall-back to RTH if no mission loaded. // Also check multimission mission change status before activating WP mode. #ifdef USE_MULTI_MISSION - if (updateWpMissionChange() && IS_RC_MODE_ACTIVE(BOXNAVWP) && canActivateWaypoint) { + if (updateWpMissionChange() && IS_RC_MODE_ACTIVE(BOXNAVWP)) { #else - if (IS_RC_MODE_ACTIVE(BOXNAVWP) && canActivateWaypoint) { + if (IS_RC_MODE_ACTIVE(BOXNAVWP)) { #endif - if (FLIGHT_MODE(NAV_WP_MODE) || (canActivateNavigation && canActivateAltHold && STATE(GPS_FIX_HOME))) { + if (FLIGHT_MODE(NAV_WP_MODE) || (canActivateWaypoint && canActivateNavigation && canActivateAltHold && STATE(GPS_FIX_HOME))) { waypointWasActivated = true; return NAV_FSM_EVENT_SWITCH_TO_WAYPOINT; }