mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-16 21:05:35 +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:
commit
4ba9602e66
4 changed files with 9 additions and 13 deletions
|
@ -54,7 +54,7 @@ static int output(displayPort_t *displayPort, uint8_t cmd, uint8_t *buf, int len
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#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)
|
static int heartbeat(displayPort_t *displayPort)
|
||||||
|
|
|
@ -34,7 +34,6 @@
|
||||||
|
|
||||||
#include "drivers/system.h"
|
#include "drivers/system.h"
|
||||||
|
|
||||||
#include "io/serial.h"
|
|
||||||
#include "io/displayport_msp.h"
|
#include "io/displayport_msp.h"
|
||||||
|
|
||||||
#include "msp/msp.h"
|
#include "msp/msp.h"
|
||||||
|
@ -69,12 +68,6 @@ void mspSerialAllocatePorts(void)
|
||||||
bool sharedWithTelemetry = isSerialPortShared(portConfig, FUNCTION_MSP, TELEMETRY_PORT_FUNCTIONS_MASK);
|
bool sharedWithTelemetry = isSerialPortShared(portConfig, FUNCTION_MSP, TELEMETRY_PORT_FUNCTIONS_MASK);
|
||||||
resetMspPort(mspPort, serialPort, sharedWithTelemetry);
|
resetMspPort(mspPort, serialPort, sharedWithTelemetry);
|
||||||
|
|
||||||
#ifdef USE_MSP_DISPLAYPORT
|
|
||||||
if (serialPort->identifier == displayPortProfileMsp()->displayPortSerial) {
|
|
||||||
mspPort->isDisplayPort = true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
portIndex++;
|
portIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -565,14 +558,15 @@ void mspSerialInit(void)
|
||||||
mspSerialAllocatePorts();
|
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;
|
int ret = 0;
|
||||||
|
|
||||||
for (int portIndex = 0; portIndex < MAX_MSP_PORT_COUNT; portIndex++) {
|
for (int portIndex = 0; portIndex < MAX_MSP_PORT_COUNT; portIndex++) {
|
||||||
mspPort_t * const mspPort = &mspPorts[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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,9 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "drivers/time.h"
|
#include "drivers/time.h"
|
||||||
|
|
||||||
|
#include "io/serial.h"
|
||||||
|
|
||||||
#include "msp/msp.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.
|
// 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;
|
uint8_t checksum2;
|
||||||
bool sharedWithTelemetry;
|
bool sharedWithTelemetry;
|
||||||
mspDescriptor_t descriptor;
|
mspDescriptor_t descriptor;
|
||||||
bool isDisplayPort;
|
|
||||||
} mspPort_t;
|
} mspPort_t;
|
||||||
|
|
||||||
void mspSerialInit(void);
|
void mspSerialInit(void);
|
||||||
|
@ -120,5 +122,5 @@ void mspSerialProcess(mspEvaluateNonMspData_e evaluateNonMspData, mspProcessComm
|
||||||
void mspSerialAllocatePorts(void);
|
void mspSerialAllocatePorts(void);
|
||||||
void mspSerialReleasePortIfAllocated(struct serialPort_s *serialPort);
|
void mspSerialReleasePortIfAllocated(struct serialPort_s *serialPort);
|
||||||
void mspSerialReleaseSharedTelemetryPorts(void);
|
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);
|
uint32_t mspSerialTxBytesFree(void);
|
||||||
|
|
|
@ -279,7 +279,7 @@ void currentMeterMSPRefresh(timeUs_t currentTimeUs)
|
||||||
if (cmp32(currentTimeUs, streamRequestAt) > 0) {
|
if (cmp32(currentTimeUs, streamRequestAt) > 0) {
|
||||||
streamRequestAt = currentTimeUs + ((1000 * 1000) / 10); // 10hz
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue