Code: Select all
while idx <= 6
if mspRxIdx <= mspRxSize
temp = payload[idx]
mspRxBuf[mspRxIdx]=temp
mspRxCRC ^= payload[idx]
mspRxIdx += 1
idx += 1
end
end
Mike.
Code: Select all
while idx <= 6
if mspRxIdx <= mspRxSize
temp = payload[idx]
mspRxBuf[mspRxIdx]=temp
mspRxCRC ^= payload[idx]
mspRxIdx += 1
idx += 1
end
end
Code: Select all
a = 0
b = 2
while (a<5) & (b>0)
a += 1
if a>3 then b = 0
end
cutdact wrote: ↑Tue Sep 19, 2017 7:52 pm Thank you for clarifying. I think it's the application ID that is throwing me off here. In LUA they use a bunch of bitwise operations and i can't really get my head around why. https://github.com/betaflight/betafligh ... msp_sp.lua
for example:
sportMspSeq = bit32.band(sportMspSeq + 1, 0x0F)
Isnt this the same as sportMspSeq += 1, with a max value of 15?
so it could be solved like,
sportMspSeq += 1
if sportMspSeq = 15 then sportMspSeq = 0
end
Martin
Code: Select all
while (idx <= protocol.maxRxBufferSize) and (mspRxIdx <= mspRxSize) do
mspRxBuf[mspRxIdx] = payload[idx]
mspRxCRC = bit32.bxor(mspRxCRC,payload[idx])
mspRxIdx = mspRxIdx + 1
idx = idx + 1
end
Code: Select all
protocol.maxRxBufferSize = 6
MikeB wrote: ↑Thu Oct 05, 2017 2:41 pm This code looks suspicious to me:if idx is less than 6, but mspRxIdx is greater than mspRxSize then idx doesn't get incremented so the while loop runs forever.Code: Select all
while idx <= 6 if mspRxIdx <= mspRxSize temp = payload[idx] mspRxBuf[mspRxIdx]=temp mspRxCRC ^= payload[idx] mspRxIdx += 1 idx += 1 end end
Mike.
[/quote]pafleraf wrote: ↑Tue Nov 14, 2017 4:06 pm Hi Martin!
sorry for being such a pain-in-the-butt to you Next time I'll try without bit-operations. But seriously, if you have any trouble with the protocol, juts let me know, I should be able to help you. But please note that I use only opentx and frsky hardware, so that I can probably not test anything for you.
Probably Radio Setup / General??
Code: Select all
if not sportTelemetryPush() then
return true
end