mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-13 11:29:58 +03:00
Fix review
This commit is contained in:
parent
50549081b2
commit
b30f46790e
2 changed files with 10 additions and 7 deletions
|
@ -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_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) },
|
{ "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
|
#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
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#include "common/time.h"
|
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
|
|
||||||
#include "blackbox/blackbox.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
|
#ifdef USE_MSP_DISPLAYPORT_DISARM_DELAY
|
||||||
|
|
||||||
|
#define DISARM_DELAY_MULTIPLIER_US 100000
|
||||||
|
|
||||||
static void mspDisplayportDelayDisarm(mspDescriptor_t srcDesc, boxBitmask_t *flightModeFlags)
|
static void mspDisplayportDelayDisarm(mspDescriptor_t srcDesc, boxBitmask_t *flightModeFlags)
|
||||||
{
|
{
|
||||||
static mspDescriptor_t displayPortMspDescriptor = -1;
|
static mspDescriptor_t displayPortMspDescriptor;
|
||||||
static bool displayPortMspArmState = false;
|
static bool displayPortMspArmState = false;
|
||||||
|
static bool descriptorInitialized = false;
|
||||||
|
|
||||||
if (displayPortMspDescriptor == -1) {
|
if (!descriptorInitialized) {
|
||||||
mspDescriptor_t tmp = getMspSerialPortDescriptor(displayPortMspGetSerial());
|
descriptorInitialized = true;
|
||||||
displayPortMspDescriptor = (tmp != -1) ? tmp : -2;
|
displayPortMspDescriptor = getMspSerialPortDescriptor(displayPortMspGetSerial());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (displayPortMspDescriptor == srcDesc) {
|
if (displayPortMspDescriptor == srcDesc) {
|
||||||
bool currentState = bitArrayGet(flightModeFlags, BOXARM);
|
bool currentState = bitArrayGet(flightModeFlags, BOXARM);
|
||||||
if (displayPortMspArmState) {
|
if (displayPortMspArmState) {
|
||||||
if (!currentState) {
|
if (!currentState) {
|
||||||
if (cmpTimeUs(micros(), getLastDisarmTimeUs()) < 100000 * displayPortProfileMsp()->useDisarmDelay) {
|
if (cmpTimeUs(micros(), getLastDisarmTimeUs()) < DISARM_DELAY_MULTIPLIER_US * displayPortProfileMsp()->useDisarmDelay) {
|
||||||
bitArraySet(flightModeFlags, BOXARM);
|
bitArraySet(flightModeFlags, BOXARM);
|
||||||
} else {
|
} else {
|
||||||
displayPortMspArmState = false;
|
displayPortMspArmState = false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue