1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-12 19:10:32 +03:00

Fix review

This commit is contained in:
Ivan 2025-06-18 22:04:53 +00:00
parent 50549081b2
commit b30f46790e
2 changed files with 10 additions and 7 deletions

View file

@ -1743,7 +1743,7 @@ const clivalue_t valueTable[] = {
{ "displayport_msp_fonts", VAR_UINT8 | MASTER_VALUE | MODE_ARRAY, .config.array.length = 4, PG_DISPLAY_PORT_MSP_CONFIG, offsetof(displayPortProfile_t, fontSelection) },
{ "displayport_msp_use_device_blink", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_DISPLAY_PORT_MSP_CONFIG, offsetof(displayPortProfile_t, useDeviceBlink) },
#ifdef USE_MSP_DISPLAYPORT_DISARM_DELAY
{ "displayport_msp_use_disarm_delay", VAR_UINT8 | MASTER_VALUE, .config.minmax = { 0, UINT8_MAX }, PG_DISPLAY_PORT_MSP_CONFIG, offsetof(displayPortProfile_t, useDisarmDelay) },
{ "displayport_msp_use_disarm_delay", VAR_UINT8 | MASTER_VALUE, .config.minmaxUnsigned = { 0, UINT8_MAX }, PG_DISPLAY_PORT_MSP_CONFIG, offsetof(displayPortProfile_t, useDisarmDelay) },
#endif
#endif

View file

@ -26,7 +26,6 @@
#include <limits.h>
#include <ctype.h>
#include "common/time.h"
#include "platform.h"
#include "blackbox/blackbox.h"
@ -1082,21 +1081,25 @@ static bool mspCommonProcessOutCommand(int16_t cmdMSP, sbuf_t *dst, mspPostProce
}
#ifdef USE_MSP_DISPLAYPORT_DISARM_DELAY
#define DISARM_DELAY_MULTIPLIER_US 100000
static void mspDisplayportDelayDisarm(mspDescriptor_t srcDesc, boxBitmask_t *flightModeFlags)
{
static mspDescriptor_t displayPortMspDescriptor = -1;
static mspDescriptor_t displayPortMspDescriptor;
static bool displayPortMspArmState = false;
static bool descriptorInitialized = false;
if (displayPortMspDescriptor == -1) {
mspDescriptor_t tmp = getMspSerialPortDescriptor(displayPortMspGetSerial());
displayPortMspDescriptor = (tmp != -1) ? tmp : -2;
if (!descriptorInitialized) {
descriptorInitialized = true;
displayPortMspDescriptor = getMspSerialPortDescriptor(displayPortMspGetSerial());
}
if (displayPortMspDescriptor == srcDesc) {
bool currentState = bitArrayGet(flightModeFlags, BOXARM);
if (displayPortMspArmState) {
if (!currentState) {
if (cmpTimeUs(micros(), getLastDisarmTimeUs()) < 100000 * displayPortProfileMsp()->useDisarmDelay) {
if (cmpTimeUs(micros(), getLastDisarmTimeUs()) < DISARM_DELAY_MULTIPLIER_US * displayPortProfileMsp()->useDisarmDelay) {
bitArraySet(flightModeFlags, BOXARM);
} else {
displayPortMspArmState = false;