Skip to content

Commit

Permalink
Merge branch 'master' into 20240305_imuf9001_compile_warnings_fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nerdCopter authored Mar 6, 2024
2 parents 71cbe24 + 3bf7215 commit 98e3731
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 52 deletions.
24 changes: 20 additions & 4 deletions src/main/target/ALIENWHOOP/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/main/target/ALIENWHOOP/target.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
102 changes: 54 additions & 48 deletions src/main/target/NBDHMBF41S/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*
* If not, see <http://www.gnu.org/licenses/>.
*/
/*

#include <stdbool.h>
#include <stdint.h>
#include <string.h>
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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;
Expand Down Expand Up @@ -113,46 +114,52 @@ 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;
rxConfigMutable()->fpvCamAngleDegrees = 0;
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;
Expand All @@ -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;
Expand All @@ -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
*/

0 comments on commit 98e3731

Please sign in to comment.