mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-17 13:25:30 +03:00
Merge pull request #6060 from jirif/npr_6056
Fixed null pointer reference
This commit is contained in:
commit
cb3d1d6ad4
2 changed files with 8 additions and 11 deletions
|
@ -347,7 +347,7 @@ static bool fportProcessFrame(const rxRuntimeConfig_t *rxRuntimeConfig)
|
||||||
if (clearToSend) {
|
if (clearToSend) {
|
||||||
DEBUG_SET(DEBUG_FPORT, DEBUG_FPORT_TELEMETRY_DELAY, currentTimeUs - lastTelemetryFrameReceivedUs);
|
DEBUG_SET(DEBUG_FPORT, DEBUG_FPORT_TELEMETRY_DELAY, currentTimeUs - lastTelemetryFrameReceivedUs);
|
||||||
|
|
||||||
if (consecutiveSensorCount >= FPORT_TELEMETRY_MAX_CONSECUTIVE_SENSORS && !smartPortPayloadContainsMSP(mspPayload)) {
|
if (consecutiveSensorCount >= FPORT_TELEMETRY_MAX_CONSECUTIVE_SENSORS && !(mspPayload && smartPortPayloadContainsMSP(mspPayload))) {
|
||||||
// Stop one cycle to avoid saturating the buffer in the RX, since the
|
// Stop one cycle to avoid saturating the buffer in the RX, since the
|
||||||
// downstream bandwidth doesn't allow sensor sensors on every cycle.
|
// downstream bandwidth doesn't allow sensor sensors on every cycle.
|
||||||
// We allow MSP frames to run over the resting period, expecting that
|
// We allow MSP frames to run over the resting period, expecting that
|
||||||
|
|
|
@ -464,18 +464,15 @@ void processSmartPortTelemetry(smartPortPayload_t *payload, volatile bool *clear
|
||||||
static uint8_t smartPortIdOffset = 0;
|
static uint8_t smartPortIdOffset = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (payload) {
|
|
||||||
// do not check the physical ID here again
|
|
||||||
// unless we start receiving other sensors' packets
|
|
||||||
|
|
||||||
#if defined(USE_MSP_OVER_TELEMETRY)
|
#if defined(USE_MSP_OVER_TELEMETRY)
|
||||||
if (smartPortPayloadContainsMSP(payload)) {
|
if (payload && smartPortPayloadContainsMSP(payload)) {
|
||||||
// Pass only the payload: skip frameId
|
// Do not check the physical ID here again
|
||||||
uint8_t *frameStart = (uint8_t *)&payload->valueId;
|
// unless we start receiving other sensors' packets
|
||||||
smartPortMspReplyPending = handleMspFrame(frameStart, SMARTPORT_MSP_PAYLOAD_SIZE);
|
// Pass only the payload: skip frameId
|
||||||
}
|
uint8_t *frameStart = (uint8_t *)&payload->valueId;
|
||||||
#endif
|
smartPortMspReplyPending = handleMspFrame(frameStart, SMARTPORT_MSP_PAYLOAD_SIZE);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bool doRun = true;
|
bool doRun = true;
|
||||||
while (doRun && *clearToSend) {
|
while (doRun && *clearToSend) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue