mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-18 22:05:17 +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();
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
smartPortMspReply.buf.ptr = smartPortMspTxBuffer;
|
||||
|
@ -544,7 +536,7 @@ void handleSmartPortMspFrame(smartPortFrame_t* sp_frame)
|
|||
}
|
||||
else if (((lastSeq + 1) & SMARTPORT_MSP_SEQ_MASK) != seq) {
|
||||
// packet loss detected!
|
||||
resetMspPacket(&cmd);
|
||||
mspStarted = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ local function mspReceivedReply(payload)
|
|||
-- return error
|
||||
-- CRC checking missing
|
||||
|
||||
--return bit32.band(payload[idx],0xFF)
|
||||
--return payload[idx]
|
||||
return nil
|
||||
end
|
||||
|
||||
|
@ -93,8 +93,10 @@ local function mspReceivedReply(payload)
|
|||
elseif not mspStarted then
|
||||
mspReceivedReply_cnt3 = mspReceivedReply_cnt3 + 1
|
||||
return nil
|
||||
-- TODO: add sequence number checking
|
||||
-- elseif ...
|
||||
|
||||
elseif bit32.band(lastSeq+1,0x0F) ~= seq then
|
||||
mspStarted = false
|
||||
return nil
|
||||
end
|
||||
|
||||
while (idx <= 6) and (mspRxIdx <= mspRxSize) do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue