mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-23 16:25:31 +03:00
Merge pull request #10489 from etracer65/msp_displayport_serial_validation
Fix incorrect displayport_msp_serial default and add validation
This commit is contained in:
commit
bd5c813bb8
2 changed files with 21 additions and 1 deletions
|
@ -68,6 +68,7 @@
|
|||
#include "pg/adc.h"
|
||||
#include "pg/beeper.h"
|
||||
#include "pg/beeper_dev.h"
|
||||
#include "pg/displayport_profiles.h"
|
||||
#include "pg/gyrodev.h"
|
||||
#include "pg/motor.h"
|
||||
#include "pg/pg.h"
|
||||
|
@ -598,6 +599,18 @@ static void validateAndFixConfig(void)
|
|||
batteryConfigMutable()->vbatmaxcellvoltage = VBAT_CELL_VOLTAGE_DEFAULT_MAX;
|
||||
}
|
||||
|
||||
// validate that displayport_msp_serial is referencing a valid UART that actually has MSP enabled
|
||||
if (displayPortProfileMsp()->displayPortSerial != SERIAL_PORT_NONE) {
|
||||
const serialPortConfig_t *portConfig = serialFindPortConfiguration(displayPortProfileMsp()->displayPortSerial);
|
||||
if (!portConfig || !(portConfig->functionMask & FUNCTION_MSP)
|
||||
#ifndef USE_MSP_PUSH_OVER_VCP
|
||||
|| (portConfig->identifier == SERIAL_PORT_USB_VCP)
|
||||
#endif
|
||||
) {
|
||||
displayPortProfileMspMutable()->displayPortSerial = SERIAL_PORT_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(TARGET_VALIDATECONFIG)
|
||||
// This should be done at the end of the validation
|
||||
targetValidateConfiguration();
|
||||
|
|
|
@ -22,13 +22,20 @@
|
|||
|
||||
#include "platform.h"
|
||||
|
||||
#include "io/serial.h"
|
||||
|
||||
#include "pg/displayport_profiles.h"
|
||||
#include "pg/pg.h"
|
||||
#include "pg/pg_ids.h"
|
||||
|
||||
#if defined(USE_MSP_DISPLAYPORT)
|
||||
|
||||
PG_REGISTER(displayPortProfile_t, displayPortProfileMsp, PG_DISPLAY_PORT_MSP_CONFIG, 0);
|
||||
PG_REGISTER_WITH_RESET_FN(displayPortProfile_t, displayPortProfileMsp, PG_DISPLAY_PORT_MSP_CONFIG, 0);
|
||||
|
||||
void pgResetFn_displayPortProfileMsp(displayPortProfile_t *displayPortProfile)
|
||||
{
|
||||
displayPortProfile->displayPortSerial = SERIAL_PORT_NONE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue