mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-19 06:15:16 +03:00
a bit more cleanup
This commit is contained in:
parent
160bfaf907
commit
d38d4949e9
2 changed files with 6 additions and 12 deletions
|
@ -374,14 +374,6 @@ void checkSmartPortTelemetryState(void)
|
||||||
freeSmartPortTelemetryPort();
|
freeSmartPortTelemetryPort();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void resetMspPacket(mspPacket_t* packet)
|
|
||||||
{
|
|
||||||
packet->buf.ptr = NULL;
|
|
||||||
packet->buf.end = NULL;
|
|
||||||
packet->cmd = -1;
|
|
||||||
packet->result = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void initSmartPortMspReply(int16_t cmd)
|
static void initSmartPortMspReply(int16_t cmd)
|
||||||
{
|
{
|
||||||
smartPortMspReply.buf.ptr = smartPortMspTxBuffer;
|
smartPortMspReply.buf.ptr = smartPortMspTxBuffer;
|
||||||
|
@ -544,7 +536,7 @@ void handleSmartPortMspFrame(smartPortFrame_t* sp_frame)
|
||||||
}
|
}
|
||||||
else if (((lastSeq + 1) & SMARTPORT_MSP_SEQ_MASK) != seq) {
|
else if (((lastSeq + 1) & SMARTPORT_MSP_SEQ_MASK) != seq) {
|
||||||
// packet loss detected!
|
// packet loss detected!
|
||||||
resetMspPacket(&cmd);
|
mspStarted = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ local function mspReceivedReply(payload)
|
||||||
-- return error
|
-- return error
|
||||||
-- CRC checking missing
|
-- CRC checking missing
|
||||||
|
|
||||||
--return bit32.band(payload[idx],0xFF)
|
--return payload[idx]
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -93,8 +93,10 @@ local function mspReceivedReply(payload)
|
||||||
elseif not mspStarted then
|
elseif not mspStarted then
|
||||||
mspReceivedReply_cnt3 = mspReceivedReply_cnt3 + 1
|
mspReceivedReply_cnt3 = mspReceivedReply_cnt3 + 1
|
||||||
return nil
|
return nil
|
||||||
-- TODO: add sequence number checking
|
|
||||||
-- elseif ...
|
elseif bit32.band(lastSeq+1,0x0F) ~= seq then
|
||||||
|
mspStarted = false
|
||||||
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
while (idx <= 6) and (mspRxIdx <= mspRxSize) do
|
while (idx <= 6) and (mspRxIdx <= mspRxSize) do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue