From 4e7adab128852a0b54f2761a27e35edb06f410e0 Mon Sep 17 00:00:00 2001
From: nerdCopter <56646290+nerdCopter@users.noreply.github.com>
Date: Wed, 6 Mar 2024 10:54:54 -0600
Subject: [PATCH 1/2] [target] ALIENWHOOP fix compile warning and refresh; add
ADC; add MPU9250 (#987)
---
src/main/target/ALIENWHOOP/target.h | 24 ++++++++++++++++++++----
src/main/target/ALIENWHOOP/target.mk | 1 +
2 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/src/main/target/ALIENWHOOP/target.h b/src/main/target/ALIENWHOOP/target.h
index d5b04e3b1e..063672ca1e 100644
--- a/src/main/target/ALIENWHOOP/target.h
+++ b/src/main/target/ALIENWHOOP/target.h
@@ -38,12 +38,17 @@
/* Multi-Arch Support for 168MHz or 216MHz ARM Cortex processors - STM32F405RGT or STM32F7RET
*/
+
+#define TARGET_MANUFACTURER_IDENTIFIER "ALWH"
+
#if defined(ALIENWHOOPF4)
-#define TARGET_BOARD_IDENTIFIER "AWF4"
-#define USBD_PRODUCT_STRING "AlienWhoopF4"
+#define USBD_PRODUCT_STRING "ALIENWHOOPF4"
+#define FC_TARGET_MCU STM32F405 // not used in EmuF
+#define TARGET_BOARD_IDENTIFIER "S405" // generic ID
#else
-#define TARGET_BOARD_IDENTIFIER "AWF7"
-#define USBD_PRODUCT_STRING "AlienWhoopF7"
+#define USBD_PRODUCT_STRING "ALIENWHOOPF7"
+#define FC_TARGET_MCU STM32F7X2 // not used in EmuF
+#define TARGET_BOARD_IDENTIFIER "S7X2"
#endif
#define USE_TARGET_CONFIG // see config.c for target specific customizations
@@ -125,6 +130,9 @@
// MPU
#define MPU6500_CS_PIN SPI1_NSS_PIN
#define MPU6500_SPI_INSTANCE SPI1
+#define MPU9250_CS_PIN SPI1_NSS_PIN
+#define MPU9250_SPI_INSTANCE SPI1
+
#define USE_MPU_DATA_READY_SIGNAL
#define ENSURE_MPU_DATA_READY_IS_LOW
// MAG
@@ -136,11 +144,15 @@
// GYRO
#define USE_GYRO
#define USE_GYRO_SPI_MPU6500
+#define USE_GYRO_SPI_MPU9250
#define GYRO_MPU6500_ALIGN CW0_DEG
+#define GYRO_MPU9250_ALIGN CW0_DEG
// ACC
#define USE_ACC
#define USE_ACC_SPI_MPU6500
+#define USE_ACC_SPI_MPU9250
#define ACC_MPU6500_ALIGN CW0_DEG
+#define ACC_MPU9250_ALIGN CW0_DEG
/* Optional Digital Pressure Sensor (barometer) - Bosch BMP280
* TODO: not implemented on V1 or V2 pcb
@@ -232,6 +244,10 @@
#define TARGET_IO_PORTE 0xffff
#endif
+#define USE_ADC
+#define ADC1_DMA_OPT 1
+#define ADC1_DMA_STREAM DMA2_Stream4 //# ADC 1: DMA2 Stream 4 Channel 0
+
/* Timers
*/
#define USABLE_TIMER_CHANNEL_COUNT 5
diff --git a/src/main/target/ALIENWHOOP/target.mk b/src/main/target/ALIENWHOOP/target.mk
index 4d72357939..73c66b293b 100644
--- a/src/main/target/ALIENWHOOP/target.mk
+++ b/src/main/target/ALIENWHOOP/target.mk
@@ -20,6 +20,7 @@ FEATURES += ONBOARDFLASH VCP
TARGET_SRC = \
drivers/accgyro/accgyro_mpu6500.c \
drivers/accgyro/accgyro_spi_mpu6500.c \
+ drivers/accgyro/accgyro_spi_mpu9250.c \
drivers/barometer/barometer_bmp280.c \
drivers/compass/compass_ak8963.c \
drivers/flash_m25p16.c \
From 3bf72157aa8a79a61a142b5142ffcaa07f745842 Mon Sep 17 00:00:00 2001
From: nerdCopter <56646290+nerdCopter@users.noreply.github.com>
Date: Wed, 6 Mar 2024 11:37:45 -0600
Subject: [PATCH 2/2] [target] NBDHMBF41S et al - fix compile warnings and make
config.c usable if desired (#988)
---
src/main/target/NBDHMBF41S/config.c | 102 +++++++++++++++-------------
1 file changed, 54 insertions(+), 48 deletions(-)
diff --git a/src/main/target/NBDHMBF41S/config.c b/src/main/target/NBDHMBF41S/config.c
index 92fe2d8b70..3f85579094 100644
--- a/src/main/target/NBDHMBF41S/config.c
+++ b/src/main/target/NBDHMBF41S/config.c
@@ -17,7 +17,7 @@
*
* If not, see .
*/
-/*
+
#include
#include
#include
@@ -38,7 +38,7 @@
#include "fc/config.h"
#include "fc/controlrate_profile.h"
-#include "fc/core.h"
+#include "fc/fc_core.h"
#include "fc/rc_adjustments.h"
#include "fc/rc_modes.h"
#include "fc/rc_controls.h"
@@ -49,18 +49,19 @@
#include "pg/vcd.h"
#include "pg/rx.h"
-#include "pg/motor.h"
-#include "pg/vtx_table.h"
+//#include "pg/motor.h"
+#include "io/motors.h"
+//#include "pg/vtx_table.h"
#include "rx/rx.h"
#include "rx/cc2500_frsky_common.h"
#include "pg/rx.h"
#include "pg/rx_spi.h"
-#include "pg/rx_spi_cc2500.h"
+#include "drivers/rx/rx_cc2500.h"
#include "pg/vcd.h"
-#include "osd/osd.h"
+#include "io/osd.h"
#include "io/serial.h"
#include "io/vtx.h"
@@ -74,14 +75,14 @@
void targetConfiguration(void)
{
- osdConfigMutable()->item_pos[OSD_CRAFT_NAME] = OSD_POS(9, 10) | OSD_PROFILE_1_FLAG;
- osdConfigMutable()->item_pos[OSD_MAIN_BATT_VOLTAGE] = OSD_POS(23, 9) | OSD_PROFILE_1_FLAG;
- osdConfigMutable()->item_pos[OSD_ITEM_TIMER_2] = OSD_POS(2, 9) | OSD_PROFILE_1_FLAG;
- osdConfigMutable()->item_pos[OSD_FLYMODE] = OSD_POS(17, 9) | OSD_PROFILE_1_FLAG;
- osdConfigMutable()->item_pos[OSD_VTX_CHANNEL] = OSD_POS(9, 9) | OSD_PROFILE_1_FLAG;
- osdConfigMutable()->item_pos[OSD_RSSI_VALUE] = OSD_POS(2, 10) | OSD_PROFILE_1_FLAG;
+ osdConfigMutable()->item_pos[OSD_CRAFT_NAME] = OSD_POS(9, 10); //| OSD_PROFILE_1_FLAG;
+ osdConfigMutable()->item_pos[OSD_MAIN_BATT_VOLTAGE] = OSD_POS(23, 9); //| OSD_PROFILE_1_FLAG;
+ osdConfigMutable()->item_pos[OSD_ITEM_TIMER_2] = OSD_POS(2, 9); //| OSD_PROFILE_1_FLAG;
+ osdConfigMutable()->item_pos[OSD_FLYMODE] = OSD_POS(17, 9); //| OSD_PROFILE_1_FLAG;
+ osdConfigMutable()->item_pos[OSD_VTX_CHANNEL] = OSD_POS(9, 9); //| OSD_PROFILE_1_FLAG;
+ osdConfigMutable()->item_pos[OSD_RSSI_VALUE] = OSD_POS(2, 10); //| OSD_PROFILE_1_FLAG;
osdConfigMutable()->item_pos[OSD_WARNINGS] = OSD_POS(9, 10);
- osdConfigMutable()->item_pos[OSD_CURRENT_DRAW] = OSD_POS(22,10) | OSD_PROFILE_1_FLAG;
+ osdConfigMutable()->item_pos[OSD_CURRENT_DRAW] = OSD_POS(22,10); //| OSD_PROFILE_1_FLAG;
batteryConfigMutable()->batteryCapacity = 250;
@@ -113,13 +114,17 @@ void targetConfiguration(void)
strcpy(pilotConfigMutable()->name, "Humming Bird");
gyroConfigMutable()->gyro_lowpass_type = FILTER_PT1;
- gyroConfigMutable()->gyro_lowpass_hz = 200;
+ gyroConfigMutable()->gyro_lowpass_hz[ROLL] = 200;
+ gyroConfigMutable()->gyro_lowpass_hz[PITCH] = 200;
+ gyroConfigMutable()->gyro_lowpass_hz[YAW] = 200;
#ifdef USE_GYRO_LPF2
- gyroConfigMutable()->gyro_lowpass2_hz = 200;
+ gyroConfigMutable()->gyro_lowpass2_hz[ROLL] = 500;
+ gyroConfigMutable()->gyro_lowpass2_hz[PITCH] = 500;
+ gyroConfigMutable()->gyro_lowpass2_hz[YAW] = 500;
#endif
gyroConfigMutable()->yaw_spin_threshold = 1950;
- gyroConfigMutable()->dyn_lpf_gyro_min_hz = 160;
- gyroConfigMutable()->dyn_lpf_gyro_max_hz = 400;
+ gyroConfigMutable()->dyn_notch_min_hz = 160;
+ gyroConfigMutable()->dyn_notch_max_hz = 400;
rxConfigMutable()->mincheck = 1075;
rxConfigMutable()->maxcheck = 1900;
rxConfigMutable()->rc_smoothing_type = RC_SMOOTHING_TYPE_FILTER;
@@ -127,32 +132,34 @@ void targetConfiguration(void)
rxConfigMutable()->rssi_channel = 9;
motorConfigMutable()->digitalIdleOffsetValue = 1000;
motorConfigMutable()->dev.useBurstDshot = true;
- motorConfigMutable()->dev.useDshotTelemetry = false;
+ //motorConfigMutable()->dev.useDshotTelemetry = false;
motorConfigMutable()->motorPoleCount = 12;
motorConfigMutable()->dev.motorPwmProtocol = PWM_TYPE_DSHOT600;
batteryConfigMutable()->batteryCapacity = 300;
- batteryConfigMutable()->vbatmaxcellvoltage = 450;
- batteryConfigMutable()->vbatfullcellvoltage = 400;
- batteryConfigMutable()->vbatmincellvoltage = 290;
- batteryConfigMutable()->vbatwarningcellvoltage = 320;
+ batteryConfigMutable()->vbatmaxcellvoltage = 45;
+ batteryConfigMutable()->vbatfullcellvoltage = 42;
+ batteryConfigMutable()->vbatmincellvoltage = 29;
+ batteryConfigMutable()->vbatwarningcellvoltage = 32;
voltageSensorADCConfigMutable(0)->vbatscale = 110;
mixerConfigMutable()->yaw_motors_reversed = false;
mixerConfigMutable()->crashflip_motor_percent = 0;
imuConfigMutable()->small_angle = 180;
pidConfigMutable()->pid_process_denom = 1;
pidConfigMutable()->runaway_takeoff_prevention = true;
- //osdConfigMutable()->enabledWarnings &= ~(1 << OSD_WARNING_CORE_TEMPERATURE);
+ osdConfigMutable()->enabledWarnings &= ~(1 << OSD_WARNING_CORE_TEMPERATURE);
osdConfigMutable()->cap_alarm = 2200;
pidProfilesMutable(0)->dterm_filter_type = FILTER_PT1;
- pidProfilesMutable(0)->dyn_lpf_dterm_min_hz = 56;
- pidProfilesMutable(0)->dyn_lpf_dterm_max_hz = 136;
- pidProfilesMutable(0)->dterm_lowpass_hz = 150;
- pidProfilesMutable(0)->dterm_lowpass2_hz = 120;
- pidProfilesMutable(0)->dterm_notch_cutoff = 0;
- pidProfilesMutable(0)->vbatPidCompensation = true;
+ //pidProfilesMutable(0)->dyn_lpf_dterm_min_hz = 56;
+ //pidProfilesMutable(0)->dyn_lpf_dterm_max_hz = 136;
+ pidProfilesMutable(0)->dFilter[ROLL].dLpf = 150;
+ pidProfilesMutable(0)->dFilter[PITCH].dLpf = 150;
+ pidProfilesMutable(0)->dFilter[YAW].dLpf = 150;
+ //pidProfilesMutable(0)->dterm_lowpass2_hz = 120;
+ //pidProfilesMutable(0)->dterm_notch_cutoff = 0;
+ //pidProfilesMutable(0)->vbatPidCompensation = true;
pidProfilesMutable(0)->iterm_rotation = true;
- pidProfilesMutable(0)->itermThrottleThreshold = 250;
+ //pidProfilesMutable(0)->itermThrottleThreshold = 250;
pidProfilesMutable(0)->yawRateAccelLimit = 0;
pidProfilesMutable(0)->pidSumLimit = 500;
pidProfilesMutable(0)->pidSumLimitYaw = 400;
@@ -168,16 +175,16 @@ void targetConfiguration(void)
pidProfilesMutable(0)->pid[PID_YAW].I = 55;
pidProfilesMutable(0)->pid[PID_YAW].D = 0;
pidProfilesMutable(0)->pid[PID_YAW].F = 0;
- pidProfilesMutable(0)->pid[PID_LEVEL].P = 70;
- pidProfilesMutable(0)->pid[PID_LEVEL].I = 70;
- pidProfilesMutable(0)->pid[PID_LEVEL].D = 100;
+ //pidProfilesMutable(0)->pid[PID_LEVEL].P = 70;
+ //pidProfilesMutable(0)->pid[PID_LEVEL].I = 70;
+ //pidProfilesMutable(0)->pid[PID_LEVEL].D = 100;
pidProfilesMutable(0)->levelAngleLimit = 85;
pidProfilesMutable(0)->horizon_tilt_effect = 75;
- pidProfilesMutable(0)->d_min[FD_ROLL] = 20;
- pidProfilesMutable(0)->d_min[FD_PITCH] = 18;
- pidProfilesMutable(0)->d_min_gain = 25;
- pidProfilesMutable(0)->d_min_advance = 1;
- pidProfilesMutable(0)->horizon_tilt_expert_mode = false;
+ //pidProfilesMutable(0)->d_min[FD_ROLL] = 20;
+ //pidProfilesMutable(0)->d_min[FD_PITCH] = 18;
+ //pidProfilesMutable(0)->d_min_gain = 25;
+ //pidProfilesMutable(0)->d_min_advance = 1;
+ //pidProfilesMutable(0)->horizon_tilt_expert_mode = false;
controlRateProfilesMutable(0)->rcRates[FD_YAW] = 100;
controlRateProfilesMutable(0)->rates[FD_ROLL] = 73;
@@ -186,25 +193,24 @@ void targetConfiguration(void)
controlRateProfilesMutable(0)->rcExpo[FD_ROLL] = 15;
controlRateProfilesMutable(0)->rcExpo[FD_PITCH] = 15;
controlRateProfilesMutable(0)->rcExpo[FD_YAW] = 15;
- controlRateProfilesMutable(0)->dynThrPID = 65;
+ //controlRateProfilesMutable(0)->dynThrPID = 65;
controlRateProfilesMutable(0)->tpa_breakpoint = 1250;
- ledStripStatusModeConfigMutable()->ledConfigs[0] = DEFINE_LED(7, 7, 8, 0, LF(COLOR), LO(LARSON_SCANNER) | LO(THROTTLE), 0);
- ledStripStatusModeConfigMutable()->ledConfigs[1] = DEFINE_LED(8, 7, 13, 0, LF(COLOR), LO(LARSON_SCANNER) | LO(THROTTLE), 0);
- ledStripStatusModeConfigMutable()->ledConfigs[2] = DEFINE_LED(9, 7, 11, 0, LF(COLOR), LO(LARSON_SCANNER) | LO(THROTTLE), 0);
- ledStripStatusModeConfigMutable()->ledConfigs[3] = DEFINE_LED(10, 7, 4, 0, LF(COLOR), LO(LARSON_SCANNER) | LO(THROTTLE), 0);
+ ledStripConfigMutable()->ledConfigs[0] = DEFINE_LED(7, 7, 8, 0, LF(COLOR), LO(LARSON_SCANNER) | LO(THROTTLE), 0);
+ ledStripConfigMutable()->ledConfigs[1] = DEFINE_LED(8, 7, 13, 0, LF(COLOR), LO(LARSON_SCANNER) | LO(THROTTLE), 0);
+ ledStripConfigMutable()->ledConfigs[2] = DEFINE_LED(9, 7, 11, 0, LF(COLOR), LO(LARSON_SCANNER) | LO(THROTTLE), 0);
+ ledStripConfigMutable()->ledConfigs[3] = DEFINE_LED(10, 7, 4, 0, LF(COLOR), LO(LARSON_SCANNER) | LO(THROTTLE), 0);
do {
// T8SG
uint8_t defaultTXHopTable[50] = {0,30,60,91,120,150,180,210,5,35,65,95,125,155,185,215,10,40,70,100,130,160,190,221,15,45,75,105,135,165,195,225,20,50,80,110,140,170,200,230,25,55,85,115,145,175,205,0,0,0};
- rxCc2500SpiConfigMutable()->bindOffset = 33;
- rxCc2500SpiConfigMutable()->bindTxId[0] = 198;
- rxCc2500SpiConfigMutable()->bindTxId[1] = 185;
+ rxFrSkySpiConfigMutable()->bindOffset = 33;
+ rxFrSkySpiConfigMutable()->bindTxId[0] = 198;
+ rxFrSkySpiConfigMutable()->bindTxId[1] = 185;
for (uint8_t i = 0; i < 50; i++) {
- rxCc2500SpiConfigMutable()->bindHopData[i] = defaultTXHopTable[i];
+ rxFrSkySpiConfigMutable()->bindHopData[i] = defaultTXHopTable[i];
}
} while (0);
serialConfigMutable()->portConfigs[findSerialPortIndexByIdentifier(SERIAL_PORT_USART2)].functionMask = FUNCTION_MSP;
}
#endif
-*/