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

Changed 'mspSerialPush()' to not check displayPort when request… (#9104)

Changed 'mspSerialPush()' to not check displayPort when requesting current data.
This commit is contained in:
Michael Keller 2019-11-06 13:30:09 +13:00 committed by GitHub
commit 4ba9602e66
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 13 deletions

View file

@ -54,7 +54,7 @@ static int output(displayPort_t *displayPort, uint8_t cmd, uint8_t *buf, int len
return 0;
}
#endif
return mspSerialPush(cmd, buf, len, MSP_DIRECTION_REPLY);
return mspSerialPush(displayPortProfileMsp()->displayPortSerial, cmd, buf, len, MSP_DIRECTION_REPLY);
}
static int heartbeat(displayPort_t *displayPort)

View file

@ -34,7 +34,6 @@
#include "drivers/system.h"
#include "io/serial.h"
#include "io/displayport_msp.h"
#include "msp/msp.h"
@ -69,12 +68,6 @@ void mspSerialAllocatePorts(void)
bool sharedWithTelemetry = isSerialPortShared(portConfig, FUNCTION_MSP, TELEMETRY_PORT_FUNCTIONS_MASK);
resetMspPort(mspPort, serialPort, sharedWithTelemetry);
#ifdef USE_MSP_DISPLAYPORT
if (serialPort->identifier == displayPortProfileMsp()->displayPortSerial) {
mspPort->isDisplayPort = true;
}
#endif
portIndex++;
}
@ -565,14 +558,15 @@ void mspSerialInit(void)
mspSerialAllocatePorts();
}
int mspSerialPush(uint8_t cmd, uint8_t *data, int datalen, mspDirection_e direction)
int mspSerialPush(serialPortIdentifier_e port, uint8_t cmd, uint8_t *data, int datalen, mspDirection_e direction)
{
int ret = 0;
for (int portIndex = 0; portIndex < MAX_MSP_PORT_COUNT; portIndex++) {
mspPort_t * const mspPort = &mspPorts[portIndex];
if (!mspPort->port || !mspPort->isDisplayPort) {
// XXX Kludge!!! Avoid zombie VCP port (avoid VCP entirely for now)
if (!mspPort->port || mspPort->port->identifier == SERIAL_PORT_USB_VCP || (port != SERIAL_PORT_NONE && mspPort->port->identifier != port)) {
continue;
}

View file

@ -21,6 +21,9 @@
#pragma once
#include "drivers/time.h"
#include "io/serial.h"
#include "msp/msp.h"
// Each MSP port requires state and a receive buffer, revisit this default if someone needs more than 3 MSP ports.
@ -111,7 +114,6 @@ typedef struct mspPort_s {
uint8_t checksum2;
bool sharedWithTelemetry;
mspDescriptor_t descriptor;
bool isDisplayPort;
} mspPort_t;
void mspSerialInit(void);
@ -120,5 +122,5 @@ void mspSerialProcess(mspEvaluateNonMspData_e evaluateNonMspData, mspProcessComm
void mspSerialAllocatePorts(void);
void mspSerialReleasePortIfAllocated(struct serialPort_s *serialPort);
void mspSerialReleaseSharedTelemetryPorts(void);
int mspSerialPush(uint8_t cmd, uint8_t *data, int datalen, mspDirection_e direction);
int mspSerialPush(serialPortIdentifier_e port, uint8_t cmd, uint8_t *data, int datalen, mspDirection_e direction);
uint32_t mspSerialTxBytesFree(void);

View file

@ -279,7 +279,7 @@ void currentMeterMSPRefresh(timeUs_t currentTimeUs)
if (cmp32(currentTimeUs, streamRequestAt) > 0) {
streamRequestAt = currentTimeUs + ((1000 * 1000) / 10); // 10hz
mspSerialPush(MSP_ANALOG, NULL, 0, MSP_DIRECTION_REQUEST);
mspSerialPush(SERIAL_PORT_NONE, MSP_ANALOG, NULL, 0, MSP_DIRECTION_REQUEST);
}
}