Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX CONFIG: MATEKF405TEMINI SPI3 + CONFIG DEFAULT_VOLTAGE_METER_SCALE + SYSTEM_HSE_MHZ #12468

Merged
merged 3 commits into from
Mar 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/config/DALRCF722DUAL/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
#define ENABLE_DSHOT_DMAR DSHOT_DMAR_ON
#define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC
#define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC
//TODO #define VBAT_SCALE 160
#define DEFAULT_VOLTAGE_METER_SCALE 160
#define DEFAULT_CURRENT_METER_SCALE 166
#define BEEPER_INVERTED
#define MAX7456_SPI_INSTANCE SPI2
Expand Down
2 changes: 1 addition & 1 deletion src/config/GRAVITYF7/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
#define ENABLE_DSHOT_DMAR DSHOT_DMAR_ON
#define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC
#define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC
//TODO #define VBAT_SCALE 111
#define DEFAULT_VOLTAGE_METER_SCALE 111
#define DEFAULT_CURRENT_METER_SCALE 182
#define BEEPER_INVERTED
//TODO #define OSD_DISPLAYPORT_DEVICE MAX7456
Expand Down
2 changes: 1 addition & 1 deletion src/config/JBF7/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
#define ENABLE_DSHOT_DMAR DSHOT_DMAR_ON
#define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ESC
#define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC
//TODO #define VBAT_SCALE 110
#define DEFAULT_VOLTAGE_METER_SCALE 110
#define DEFAULT_CURRENT_METER_SCALE 100
#define BEEPER_INVERTED
#define USE_SDCARD_SPI
Expand Down
2 changes: 1 addition & 1 deletion src/config/JBF7_DJI/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
#define ENABLE_DSHOT_DMAR DSHOT_DMAR_ON
#define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC
#define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC
//TODO #define VBAT_SCALE 110
#define DEFAULT_VOLTAGE_METER_SCALE 110
#define DEFAULT_CURRENT_METER_SCALE 100
#define BEEPER_INVERTED
#define USE_SDCARD_SPI
Expand Down
2 changes: 1 addition & 1 deletion src/config/KAKUTEH7/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
#define DEFAULT_BLACKBOX_DEVICE BLACKBOX_DEVICE_SDCARD
#define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC
#define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC
//TODO #define VBAT_SCALE 109
#define DEFAULT_VOLTAGE_METER_SCALE 109
#define DEFAULT_CURRENT_METER_SCALE 168
#define BEEPER_INVERTED
//TODO #define SDCARD_DETECT_INVERTED ON
Expand Down
2 changes: 1 addition & 1 deletion src/config/KAKUTEH7MINI/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
#define DEFAULT_BLACKBOX_DEVICE BLACKBOX_DEVICE_FLASH
#define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC
#define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC
//TODO #define VBAT_SCALE 110
#define DEFAULT_VOLTAGE_METER_SCALE 110
#define DEFAULT_CURRENT_METER_SCALE 168
#define BEEPER_INVERTED
//TODO #define SDCARD_MODE OFF
Expand Down
2 changes: 1 addition & 1 deletion src/config/KAKUTEH7V2/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
//TODO #define SDCARD_MODE OFF
#define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC
#define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC
//TODO #define VBAT_SCALE 109
#define DEFAULT_VOLTAGE_METER_SCALE 109
#define DEFAULT_CURRENT_METER_SCALE 168
#define BEEPER_INVERTED
#define FLASH_SPI_INSTANCE SPI1
Expand Down
2 changes: 1 addition & 1 deletion src/config/MAMBAH743/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
#define BEEPER_INVERTED
#define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC
#define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC
//TODO #define VBAT_SCALE 110
#define DEFAULT_VOLTAGE_METER_SCALE 110
#define DEFAULT_CURRENT_METER_SCALE 400
//TODO #define PINIO_CONFIG 129,1,1,1
//TODO #define PINIO_BOX 0,255,255,255
Expand Down
2 changes: 1 addition & 1 deletion src/config/MATEKF405TE/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
#define BARO_I2C_INSTANCE (I2CDEV_1)
#define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC
#define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC
//TODO #define VBAT_SCALE 210
#define DEFAULT_VOLTAGE_METER_SCALE 210
#define DEFAULT_CURRENT_METER_SCALE 150
#define BEEPER_INVERTED
#define SYSTEM_HSE_MHZ 8
Expand Down
67 changes: 36 additions & 31 deletions src/config/MATEKF405TEMINI/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,13 @@
#define LED1_PIN PA13
#define SPI1_SCK_PIN PA5
#define SPI2_SCK_PIN PB13
#define SPI3_SCK_PIN NONE
#define SPI1_MISO_PIN PB4
#define SPI2_MISO_PIN PC2
#define SPI3_MISO_PIN NONE
#define SPI1_MOSI_PIN PA7
#define SPI2_MOSI_PIN PC3
#define SPI3_MOSI_PIN NONE
#define ADC_VBAT_PIN PC4
#define ADC_RSSI_PIN PB0
#define ADC_CURR_PIN PC5
Expand All @@ -83,43 +86,45 @@
#define GYRO_1_CS_PIN PC14

#define TIMER_PIN_MAPPING \
TIMER_PIN_MAP( 0, PC9 , 2, 0) \
TIMER_PIN_MAP( 1, PC8 , 2, 0) \
TIMER_PIN_MAP( 2, PB15, 1, 1) \
TIMER_PIN_MAP( 3, PA8 , 1, 1) \
TIMER_PIN_MAP( 4, PB11, 1, 0) \
TIMER_PIN_MAP( 5, PB10, 1, 0) \
TIMER_PIN_MAP( 6, PB3 , 1, 0) \
TIMER_PIN_MAP( 7, PA15, 1, 0) \
TIMER_PIN_MAP( 8, PB14, 3, -1) \
TIMER_PIN_MAP( 9, PA6 , 2, -1) \
TIMER_PIN_MAP(10, PB6 , 1, 0) \
TIMER_PIN_MAP(11, PB1 , 2, 0) \
TIMER_PIN_MAP(12, PB9 , 2, -1) \
TIMER_PIN_MAP(13, PA3 , 3, -1) \
TIMER_PIN_MAP(14, PA2 , 2, 0)
TIMER_PIN_MAP( 0, MOTOR1_PIN, 2, 0) \
TIMER_PIN_MAP( 1, MOTOR2_PIN, 2, 0) \
TIMER_PIN_MAP( 2, MOTOR3_PIN, 1, 1) \
TIMER_PIN_MAP( 3, MOTOR4_PIN, 1, 1) \
TIMER_PIN_MAP( 4, MOTOR5_PIN, 1, 0) \
TIMER_PIN_MAP( 5, MOTOR6_PIN, 1, 0) \
TIMER_PIN_MAP( 6, MOTOR7_PIN, 1, 0) \
TIMER_PIN_MAP( 7, MOTOR8_PIN, 1, 0) \
TIMER_PIN_MAP( 8, SERVO1_PIN, 3, -1) \
TIMER_PIN_MAP( 9, SERVO2_PIN, 2, -1) \
TIMER_PIN_MAP(10, SERVO3_PIN, 1, 0) \
TIMER_PIN_MAP(11, LED_STRIP_PIN, 2, 0) \
TIMER_PIN_MAP(12, BEEPER_PIN, 2, -1) \
TIMER_PIN_MAP(13, RX_PPM_PIN, 3, -1) \
TIMER_PIN_MAP(14, UART2_TX_PIN, 2, 0)


#define ADC1_DMA_OPT 1
#define ADC1_DMA_OPT 1

//TODO #define MAG_BUSTYPE I2C
#define MAG_I2C_INSTANCE (I2CDEV_1)
#define MAG_I2C_INSTANCE (I2CDEV_1)
//TODO #define MAG_HARDWARE AUTO
#define USE_BARO
#define BARO_I2C_INSTANCE (I2CDEV_1)
#define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC
#define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC
//TODO #define VBAT_SCALE 210
#define DEFAULT_CURRENT_METER_SCALE 150
#define BARO_I2C_INSTANCE (I2CDEV_1)
#define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC
#define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC
#define DEFAULT_VOLTAGE_METER_SCALE 210
#define DEFAULT_CURRENT_METER_SCALE 150
#define BEEPER_INVERTED
#define SYSTEM_HSE_MHZ 8
#define DEFAULT_BLACKBOX_DEVICE BLACKBOX_DEVICE_FLASH
#define MAX7456_SPI_INSTANCE SPI1
#define SYSTEM_HSE_MHZ 8
#define DEFAULT_BLACKBOX_DEVICE BLACKBOX_DEVICE_FLASH
#define MAX7456_SPI_INSTANCE SPI1
//TODO #define PINIO_BOX 40,41,255,255
#define FLASH_SPI_INSTANCE SPI2
#define FLASH_SPI_INSTANCE SPI2
#define USE_SPI_GYRO
#define GYRO_1_SPI_INSTANCE SPI1
#define GYRO_1_ALIGN CW270_DEG_FLIP
#define GYRO_1_ALIGN_PITCH 1800
#define GYRO_1_ALIGN_YAW 2700
//TODO #define SERIALRX_PROVIDER CRSF
#define GYRO_1_SPI_INSTANCE SPI1
#define GYRO_1_ALIGN CW270_DEG_FLIP
#define GYRO_1_ALIGN_PITCH 1800
#define GYRO_1_ALIGN_YAW 2700

#define DEFAULT_RX_FEATURE FEATURE_RX_SERIAL
#define SERIALRX_PROVIDER SERIALRX_CRSF
2 changes: 1 addition & 1 deletion src/config/MATEKH743/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
#define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC
#define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC
#define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC
#define VBAT_SCALE_DEFAULT 110
#define DEFAULT_VOLTAGE_METER_SCALE_DEFAULT 110
#define DEFAULT_CURRENT_METER_SCALE 250
#define BEEPER_INVERTED
#define BEEPER_PWM_HZ 2500
Expand Down
2 changes: 1 addition & 1 deletion src/config/NEUTRONRCF7AIO/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
//TODO #define MOTOR_PWM_PROTOCOL DSHOT600
#define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC
#define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC
//TODO #define VBAT_SCALE 210
#define DEFAULT_VOLTAGE_METER_SCALE 210
#define DEFAULT_CURRENT_METER_SCALE 100
#define BEEPER_INVERTED
#define MAX7456_SPI_INSTANCE SPI4
Expand Down
2 changes: 1 addition & 1 deletion src/config/PYRODRONEF4/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
//TODO #define MOTOR_PWM_PROTOCOL DSHOT600
#define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC
#define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC
//TODO #define VBAT_SCALE 160
#define DEFAULT_VOLTAGE_METER_SCALE 160
#define DEFAULT_CURRENT_METER_SCALE 150
#define BEEPER_INVERTED
//TODO #define PID_PROCESS_DENOM 1
Expand Down
2 changes: 1 addition & 1 deletion src/config/PYRODRONEF4PDB/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
#define MAX7456_SPI_INSTANCE SPI2
#define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC
#define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC
//TODO #define VBAT_SCALE 160
#define DEFAULT_VOLTAGE_METER_SCALE 160
#define DEFAULT_CURRENT_METER_SCALE 250
#define BEEPER_INVERTED
//TODO #define PID_PROCESS_DENOM 1
Expand Down
2 changes: 1 addition & 1 deletion src/config/PYRODRONEF7/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
#define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC
#define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC
#define DEFAULT_CURRENT_METER_SCALE 250
//TODO #define VBAT_SCALE 160
#define DEFAULT_VOLTAGE_METER_SCALE 160
#define BEEPER_INVERTED
//TODO #define PID_PROCESS_DENOM 1
#define MAX7456_SPI_INSTANCE SPI3
Expand Down
2 changes: 1 addition & 1 deletion src/config/SIRMIXALOT/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
//TODO #define MOTOR_PWM_PROTOCOL DSHOT600
#define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC
#define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC
//TODO #define VBAT_SCALE 80
#define DEFAULT_VOLTAGE_METER_SCALE 80
#define DEFAULT_CURRENT_METER_SCALE 210
#define BEEPER_INVERTED
//TODO #define PID_PROCESS_DENOM 1
Expand Down
2 changes: 1 addition & 1 deletion src/config/SPEEDYBEEF7V3/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
#define ENABLE_DSHOT_DMAR DSHOT_DMAR_ON
#define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC
#define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC
//TODO #define VBAT_SCALE 110
#define DEFAULT_VOLTAGE_METER_SCALE 110
#define DEFAULT_CURRENT_METER_SCALE 490
#define BEEPER_INVERTED
#define USE_SDCARD_SPI
Expand Down
2 changes: 1 addition & 1 deletion src/config/TALONF7DJIHD/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
#define ENABLE_DSHOT_DMAR DSHOT_DMAR_ON
#define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC
#define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC
//TODO #define VBAT_SCALE 110
#define DEFAULT_VOLTAGE_METER_SCALE 110
#define DEFAULT_CURRENT_METER_SCALE 250
#define BEEPER_INVERTED
//TODO #define PID_PROCESS_DENOM 1
Expand Down
2 changes: 1 addition & 1 deletion src/config/TALONF7FUSION/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
//TODO #define MOTOR_PWM_PROTOCOL DSHOT600
#define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC
#define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC
//TODO #define VBAT_SCALE 160
#define DEFAULT_VOLTAGE_METER_SCALE 160
#define DEFAULT_CURRENT_METER_SCALE 150
#define BEEPER_INVERTED
//TODO #define PID_PROCESS_DENOM 1
Expand Down
2 changes: 1 addition & 1 deletion src/config/TALONF7V2/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
//TODO #define MOTOR_PWM_PROTOCOL DSHOT600
#define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC
#define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC
//TODO #define VBAT_SCALE 160
#define DEFAULT_VOLTAGE_METER_SCALE 160
#define DEFAULT_CURRENT_METER_SCALE 150
#define BEEPER_INVERTED
//TODO #define PID_PROCESS_DENOM 1
Expand Down
2 changes: 1 addition & 1 deletion src/config/TMOTORF722SE/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
#define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC
#define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC
#define DEFAULT_CURRENT_METER_SCALE 68
//TODO #define VBAT_SCALE 110
#define DEFAULT_VOLTAGE_METER_SCALE 110
#define BEEPER_INVERTED
#define FLASH_SPI_INSTANCE SPI3
#define MAX7456_SPI_INSTANCE SPI2
Expand Down
2 changes: 1 addition & 1 deletion src/config/ZEEZF7/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
//TODO #define MOTOR_PWM_PROTOCOL DSHOT600
#define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC
#define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC
//TODO #define VBAT_SCALE 110
#define DEFAULT_VOLTAGE_METER_SCALE 110
#define DEFAULT_CURRENT_METER_SCALE 350
#define BEEPER_INVERTED
#define MAX7456_SPI_INSTANCE SPI3
Expand Down
2 changes: 1 addition & 1 deletion src/main/config/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ PG_RESET_TEMPLATE(systemConfig_t, systemConfig,
.cpu_overclock = DEFAULT_CPU_OVERCLOCK,
.powerOnArmingGraceTime = 5,
.boardIdentifier = TARGET_BOARD_IDENTIFIER,
.hseMhz = SYSTEM_HSE_VALUE, // Only used for F4 and G4 targets
.hseMhz = SYSTEM_HSE_MHZ, // Only used for F4 and G4 targets
.configurationState = CONFIGURATION_STATE_DEFAULTS_BARE,
.enableStickArming = false,
);
Expand Down
6 changes: 3 additions & 3 deletions src/main/sensors/voltage.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ void voltageMeterReset(voltageMeter_t *meter)
// ADC
//

#ifndef VBAT_SCALE_DEFAULT
#define VBAT_SCALE_DEFAULT 110
#ifndef DEFAULT_VOLTAGE_METER_SCALE
#define DEFAULT_VOLTAGE_METER_SCALE 110
#endif

#ifndef VBAT_RESDIVVAL_DEFAULT
Expand Down Expand Up @@ -134,7 +134,7 @@ void pgResetFn_voltageSensorADCConfig(voltageSensorADCConfig_t *instance)
{
for (int i = 0; i < MAX_VOLTAGE_SENSOR_ADC; i++) {
RESET_CONFIG(voltageSensorADCConfig_t, &instance[i],
.vbatscale = VBAT_SCALE_DEFAULT,
.vbatscale = DEFAULT_VOLTAGE_METER_SCALE,
.vbatresdivval = VBAT_RESDIVVAL_DEFAULT,
.vbatresdivmultiplier = VBAT_RESDIVMULTIPLIER_DEFAULT,
);
Expand Down
1 change: 1 addition & 0 deletions src/main/target/SITL/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

#define SIMULATOR_MULTITHREAD

#define SYSTEM_HSE_MHZ 0
#define DEFAULT_CPU_OVERCLOCK 1
#define DMA_RAM
#define DMA_RW_AXI
Expand Down
6 changes: 4 additions & 2 deletions src/main/target/common_post.h
Original file line number Diff line number Diff line change
Expand Up @@ -386,8 +386,10 @@
// Setup crystal frequency on F4 for backward compatibility
// Should be set to zero for generic targets to ensure USB is working
// when unconfigured for targets with non-standard crystal.
// Can be set at runtime with with CLI parameter 'system_hse_value'.
#define SYSTEM_HSE_VALUE 0
// Can be set at runtime with with CLI parameter 'system_hse_mhz'.
#ifndef SYSTEM_HSE_MHZ
#define SYSTEM_HSE_MHZ 0
#endif

// Number of pins that needs pre-init
#ifdef USE_SPI
Expand Down