1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-24 00:35:39 +03:00

CONFIG: Register defaults for align-board (#12539)

Register defaults for align-board
This commit is contained in:
Mark Haslinghuis 2023-03-21 04:18:13 +01:00 committed by GitHub
parent 6dc59bc4a1
commit 05b3e7a7dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 25 additions and 10 deletions

View file

@ -103,7 +103,7 @@
#define DEFAULT_BLACKBOX_DEVICE BLACKBOX_DEVICE_FLASH
#define DEFAULT_DSHOT_BURST DSHOT_DMAR_ON
//TODO #define MOTOR_PWM_PROTOCOL DSHOT600
//TODO #define ALIGN_BOARD_YAW 45
#define DEFAULT_ALIGN_BOARD_YAW 45
#define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC
#define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC
#define DEFAULT_CURRENT_METER_SCALE 100

View file

@ -114,7 +114,7 @@
#define USE_BARO
#define BARO_I2C_INSTANCE (I2CDEV_4)
#define DEFAULT_BLACKBOX_DEVICE BLACKBOX_DEVICE_FLASH
//TODO #define ALIGN_BOARD_YAW 135
#define DEFAULT_ALIGN_BOARD_YAW 135
#define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC
#define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC
#define DEFAULT_CURRENT_METER_SCALE 200

View file

@ -116,4 +116,4 @@
#define GYRO_2_SPI_INSTANCE SPI2
#define GYRO_2_ALIGN CW180_DEG
#define GYRO_2_ALIGN_YAW 1800
//TODO #define ALIGN_BOARD_YAW -45
#define DEFAULT_ALIGN_BOARD_YAW -45

View file

@ -102,8 +102,8 @@
//TODO #define DSHOT_IDLE_VALUE 450
#define DEFAULT_DSHOT_BURST DSHOT_DMAR_ON
//TODO #define MOTOR_PWM_PROTOCOL DSHOT600
//TODO #define ALIGN_BOARD_ROLL 180
//TODO #define ALIGN_BOARD_YAW 90
#define DEFAULT_ALIGN_BOARD_ROLL 180
#define DEFAULT_ALIGN_BOARD_YAW 90
#define PINIO1_BOX 0
#define PINIO1_CONFIG 129
#define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC

View file

@ -93,7 +93,7 @@
#define RX_SPI_LED_INVERTED
#define DEFAULT_DSHOT_BURST DSHOT_DMAR_AUTO
#define DEFAULT_DSHOT_BITBANG DSHOT_BITBANG_OFF
//TODO #define ALIGN_BOARD_YAW 45
#define DEFAULT_ALIGN_BOARD_YAW 45
#define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC
#define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC
#define DEFAULT_CURRENT_METER_SCALE 250

View file

@ -105,5 +105,5 @@
#define FLASH_SPI_INSTANCE SPI3
#define USE_SPI_GYRO
#define GYRO_1_SPI_INSTANCE SPI1
//TODO #define ALIGN_BOARD_YAW -45
#define DEFAULT_ALIGN_BOARD_YAW -45
#define PINIO1_BOX 40

View file

@ -71,7 +71,7 @@
#define DEFAULT_DSHOT_BURST DSHOT_DMAR_ON
//TODO #define MOTOR_PWM_PROTOCOL DSHOT300
//TODO #define MOTOR_POLES 12
//TODO #define ALIGN_BOARD_ROLL 180
#define DEFAULT_ALIGN_BOARD_ROLL 180
//TODO #define VBAT_MAX_CELL_VOLTAGE 435
#define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_NONE
#define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC

View file

@ -40,8 +40,23 @@
static bool standardBoardAlignment = true; // board orientation correction
static fp_rotationMatrix_t boardRotation;
// no template required since defaults are zero
PG_REGISTER(boardAlignment_t, boardAlignment, PG_BOARD_ALIGNMENT, 0);
PG_REGISTER_WITH_RESET_TEMPLATE(boardAlignment_t, boardAlignment, PG_BOARD_ALIGNMENT, 1);
#ifndef DEFAULT_ALIGN_BOARD_ROLL
#define DEFAULT_ALIGN_BOARD_ROLL 0
#endif
#ifndef DEFAULT_ALIGN_BOARD_PITCH
#define DEFAULT_ALIGN_BOARD_PITCH 0
#endif
#ifndef DEFAULT_ALIGN_BOARD_YAW
#define DEFAULT_ALIGN_BOARD_YAW 0
#endif
PG_RESET_TEMPLATE(boardAlignment_t, boardAlignment,
.rollDegrees = DEFAULT_ALIGN_BOARD_ROLL,
.pitchDegrees = DEFAULT_ALIGN_BOARD_PITCH,
.yawDegrees = DEFAULT_ALIGN_BOARD_YAW,
);
static bool isBoardAlignmentStandard(const boardAlignment_t *boardAlignment)
{